r/learnmachinelearning • • 13h ago

LLM/Agent Failure Modes

I'm running into an issue in an agentic system that I'm building. I'm finding that while the task of a specific model is quite bounded/basic(just editing another model's output for clarity), its spending almost all or all of its token output budget on tool calls and reasoning. Then, it returns incomplete or empty output due to reaching the maximum token budget. I think the budget is reasonable but it reasons for too long. How would you handle a system like this in production, where the output of this model is used as an input to another step in the pipeline?

3 Upvotes

2 comments sorted by

1

u/Temporary-Budget-605 10h ago

I would:

Review your traces to find biggest bottle necks and places where the agent spins out

Put instructions on how to plan and use tools in your system prompt or skill-based instructions. I.e no more than x number of tool calls per plan, no more than y number of retries per tool.

Add clear program exit instructions. “You have accomplished the task when x,y,z conditions are fulfilled”.

Limit the number of tools and drastically simplify and standardize their inputs and outputs, ideally based on a common resource model.

Ensure tools have impeccable natural language descriptions.

If the workflow is too large then decompose it into smaller pieces.

You mention that tokens are being run through so make sure to see the inputs and outputs of the LLM. Are you short of input / output, both? Is context window being managed?

1

u/Otherwise-Bat2036 54m ago

A few things I'd try, roughly in this order:

First, check whether this step needs tools or reasoning at all. If it's only cleaning up another model's output, try it with no tools and reasoning set to low or off, or use a non-reasoning model. Rewriting text rarely gains much from long reasoning, and every tool you give it is another reason to go exploring.

Second, give reasoning its own budget, separate from the output. Many APIs let you cap reasoning or thinking tokens on their own. If yours doesn't, limit the number of tool calls in your harness and force a final answer after N steps, so it can't run until it hits max tokens.

Third, expect empty or cut-off output and handle it. Check the finish reason. If it hit the length limit, retry once with tighter settings, or pass the original text through unchanged. The next step should never quietly get an empty string.

I'm less sure about prompt fixes like "be concise." They help a bit, but I wouldn't count on them alone. I'd put the hard limits in code.