Token Budget

Token budget is the allocation of context length across instructions, task state, retrieved evidence, tool results, examples, and expected output. It is the practical version of the context window constraint.

If is the model context limit:

where each is a token allocation.

For an LLM Wiki workflow, the useful budget is not only total length but the ratio between evidence and overhead:

If is too small, the model has no grounding. If overhead is too small, the model may ignore constraints, task state, or output requirements.

Why It Matters

  • Too much retrieved text can push out the actual instruction.
  • Too many examples can remove fresh evidence.
  • Large tool outputs can hide the relevant signal.
  • Under-budgeted output space can truncate reasoning, code, or citations.
  • Long context increases cost and can make attention to key evidence less reliable.

Budget Map

Budget AreaKeepTrim First
Instructionsdurable rules, current objective, constraintsrepeated policy text already linked elsewhere
Task statecurrent files, decisions, open questionsstale summaries that conflict with current source
Evidenceexact relevant snippets, citations, command outputsbroad dumps and duplicate sources
Tool resultsstructured facts and errorsfull logs without relevance filtering
Examplesonly examples that shape output formatold examples with different constraints
Outputenough room for final answer or patch reasoningunnecessary verbosity

Allocation Strategy

  • Reserve output budget before filling input context.
  • Keep durable rules short and link to source documents.
  • Retrieve only the evidence needed for the next step.
  • Summarize tool output into structured facts when possible.
  • Prefer iterative retrieval over loading everything.
  • Drop duplicated evidence before dropping the current task constraints.

Checks

  • What information must be present for this call?
  • What can be fetched later?
  • Is output budget explicitly reserved?
  • Are stale summaries competing with fresh evidence?
  • Are untrusted documents separated from instructions?
  • Is the retrieved context tied to the current question rather than the whole topic?
  • Can a later verifier recover the cited evidence from stable paths or links?