---
title: Budget-Aware Context Management (BACM)
url: https://www.emergentmind.com/topics/budget-aware-context-management-bacm
type: topic
---

# Budget-Aware Context Management (BACM)

Searching arXiv for the cited BACM-related papers and closely related work to ground the article.
{"query":"all:Budget-Aware Context Management OR ti:\"ContextBudget\" OR ti:\"Spend Less, Reason Better\" OR ti:\"PACMS\" OR ti:\"BudgetThinker\" OR ti:\"Budget-Aware Tool-Use Enables Effective Agent Scaling\"","max_results":10,"sort_by":"submittedDate","sort_order":"descending"}
Budget-Aware Context Management (BACM) denotes a family of methods for managing prompt assembly, interaction history, retrieval outputs, tool traces, and reasoning under explicit resource limits such as token budgets, tool-call budgets, memory ceilings, latency targets, and monetary cost. In current work, BACM appears as a budget-constrained sequential decision process for long-horizon agents, a knapsack-constrained query-conditioned context-selection problem, a budget-aware tree search over reasoning and tool trajectories, and an explicit budget-signaling scheme for generation control [2604.01664] [2606.20047] [2603.12634] [2508.17196]. Across these formulations, the common premise is that budget should be an active control signal rather than a passive accounting artifact, and that context should be managed before overflow or waste occurs.

## 1. Problem formulation and scope

BACM arises because LLM agents accumulate context from several directions simultaneously: user and assistant turns, persistent memory, retrieved passages, tool outputs, intermediate reasoning, and environment observations. Once the cumulative context exceeds the model’s token budget, the system must decide what to keep, what to compress, what to evict, and when to stop gathering more evidence [2606.20047]. In long-horizon settings, this induces a trade-off between retaining past information and staying within a constrained context window imposed by memory footprint, inference latency, and serving cost [2604.01664].

Several works formalize this resource state explicitly. In ContextBudget, the budget-conditioned state is
$$
b_t = (s_t, r_t, |o_t|), \qquad r_t = B - |\mathcal{C}_t|,
$$
where $s_t$ is the current reasoning state, $B$ is the fixed budget, $|\mathcal{C}_t|$ is the current context length, and $|o_t|$ is the token length of the pending observation [2604.01664]. In Budget-Aware Value Tree search, the agent instead tracks a dynamic state
$$
b_t = (b_{\mathrm{tool},t}, b_{\mathrm{token},t}),
$$
with component-wise updates
$$
b_{t+1} = b_t - C(a_t),
$$
so that tool calls and token generation are budgeted jointly at inference time [2603.12634]. BAGEN generalizes this perspective by distinguishing internal budgets from agent computation and external budgets from agent actions, and defines budget-awareness as progressive interval estimation over remaining requirement rather than remaining capacity alone [2606.00198].

A minimal unifying view is that BACM governs an evolving set of context units under a hard or soft constraint. In some systems the units are retrieved passages or turns; in others they are reasoning-tree nodes, commit blocks, typed episodes, or labeled examples in a stream. This suggests that BACM is not a single algorithm but a systems-level discipline for constrained information retention and acquisition.

## 2. Canonical mathematical formulations

Current BACM work uses several recurrent optimization templates.

| Formulation | Core objective or constraint | Representative systems |
|---|---|---|
| Sequential decision process | Maintain context under a fixed budget before appending new observations | ContextBudget, CAT |
| Knapsack-constrained selection | Maximize utility of selected context under token cost | PACMS, Budget-Aware Routing |
| Budget-aware search | Allocate tool and token budget across reasoning branches | BAVT, BATS |
| Bounded online memory | Update retained context under fixed memory bound | CURE, CWL |

In query-conditioned prompt assembly, PACMS casts BACM as knapsack-constrained submodular maximization over pooled candidates. Let $C=\{c_1,\dots,c_n\}$ be the pooled candidate set, $q$ the current query, $B$ the token budget, and $M \subseteq C$ an optional mandatory subset. With embeddings $e_i$ for candidate $i$ and $e_q$ for the query, PACMS defines
$$
\mathrm{rel}(i,q)=\max(0,\cos(e_i,e_q)),
$$
$$
w_{ij}=\mathrm{rel}(i,q)\cdot \max(0,\cos(e_i,e_j)),
$$
and the facility-location coverage objective
$$
F(S;q)=\sum_i \max_{j\in S} w_{ij}
$$
subject to $\sum_{j\in S}\mathrm{tok}(j)\le B$ and $M\subseteq S$ [2606.20047]. Budget-Aware Routing for long clinical text uses the same knapsack pattern, but with a monotone submodular objective
$$
F(S)=\alpha R(S)+\beta C(S)+\gamma D(S)
$$
balancing relevance, facility-location coverage, and log-determinant diversity under a token budget [2605.00336].

In long-horizon agent control, ContextBudget formalizes BACM as a sequential decision problem in which the policy chooses a refinement action $u_t$ before loading the pending observation so that the updated context $\mathcal{C}'_t$ satisfies $|\mathcal{C}'_t|\le B-|o_t|$, after which
$$
\mathcal{C}_{t+1}=\mathcal{C}'_t \oplus o_t.
$$
Reward is task performance gated by budget feasibility at every turn: if any turn violates the stage-specific budget, the rollout reward is set to zero [2604.01664].

In budget-aware reasoning and tool use, BAVT models inference as search over a dynamic tree with values $V(n)$ on nodes and a remaining-resource ratio
$$
r_t=\min\!\left(\frac{b_{\mathrm{tool},t}}{B_{\mathrm{tool}}},\frac{b_{\mathrm{token},t}}{B_{\mathrm{token}}}\right), \qquad \alpha_t=\frac{1}{r_t},
$$
so that candidate-node selection probability is derived from $V(n)^{\alpha_t}$ [2603.12634]. Budget-aware tool-use work adds a unified cash-denominated cost
$$
C_{\mathrm{unified}}(x;\pi)=c_{\mathrm{token}}(x;\pi)+\sum_{i=1}^{K} c_i(x;\pi)\cdot P_i,
$$
combining priced tokens and tool calls, and uses explicit per-tool budgets as hard constraints [2511.17006].

These formulations differ in granularity, but each treats context management as constrained optimization over informational utility.

## 3. Mechanism families

A major BACM family uses query-aware selection over a pooled candidate set. PACMS selects uniformly over heterogeneous pooled candidates—conversation turns, persistent memory entries, and tool outputs—rather than using silo-specific heuristics such as “keep last $m$ turns” plus “top-$k$ memories.” Its assemble() procedure is implemented with CELF lazy-greedy, using marginal gain
$$
\Delta F(a \mid S)=\sum_i \max(0,w_{ia}-m(i;S))
$$
and the density criterion $\Delta F(a \mid S)/\mathrm{tok}(a)$ under the knapsack budget [2606.20047]. Budget-Aware Routing reaches a similar end by selecting document units produced by sentence-, section-, window-, or cluster-based unitization, then routing among Lead, MMR, and RCD according to budget regime and document statistics [2605.00336].

A second family uses budget-aware compression or aggregation before context overflow. ContextBudget segments the context buffer into commit blocks and lets the policy choose Null, Partial, or Full aggregation before appending the next observation, with deferred loading exposing $|o_t|$ before the compression decision [2604.01664]. CAT restructures the working context as
$$
C(t) = (Q, M(t), I^{(k)}(t)),
$$
where $Q$ is stable task semantics, $M(t)$ condensed long-term memory, and $I^{(k)}(t)$ the most recent $k$ high-fidelity interactions; the agent can select a “context” action to proactively rewrite the historical segment into a structured memory block [2512.22087].

A third family replaces summarization with structured eviction. CWL maintains a typed DAG of exploratory and action episodes, preserves user turns and active exploratory context, and evicts “oldest-and-most-recoverable” content when the token budget is exceeded. Its evictability predicate makes closed action episodes immediately eligible, while exploratory episodes become evictable only after all dependent actions are fully evicted [2606.11213]. This yields a deterministic, LLM-free eviction policy rather than a rewrite-based compaction policy.

A fourth family makes budget-awareness explicit during reasoning. BudgetThinker inserts a fixed set of special control tokens $C=\{c_1,\dots,c_K\}$ at ratio-based positions $t=k\cdot\lfloor B/K \rfloor$ so the model is periodically informed of remaining reasoning budget; at budget exhaustion, the decoding engine appends a final-answer trigger and allocates an additional 50 tokens solely for the final answer [2508.17196]. Budget Tracker uses a prompt-level budget-status block after each tool response, while BATS adds budget-aware planning, self-verification, and a dig-deeper versus pivot decision based on remaining resources [2511.17006].

A fifth family performs step-level valuation and pruning. BAVT uses a residual critic that predicts an information delta $\Delta_t$ and updates child values via
$$
V(n')=\Phi(V(n)+\Delta_t),
$$
with $\Delta_t \in [-4,+4]$ clipped and a terminal threshold $\tau=0.8$ for “Answer now.” Negative or zero $\Delta_t$ induces “Widen,” positive but sub-threshold $\Delta_t$ induces “Deepen,” and backstop answering is triggered when the tool budget is exhausted or the token ratio falls below $\eta=0.2$ [2603.12634]. In tabular stream learning, CURE applies an analogous bounded-memory policy using a short recency bank, an entropy-gated long bank, and same-class redundancy-aware eviction under
$$
D_{t+1}=\mathcal{U}(D_t,z_t), \qquad |D_{t+1}|\le B
$$
[2606.18677].

## 4. Empirical performance across domains

The empirical record shows that budget-awareness can dominate brute-force budget scaling, but the strength of this effect depends on task structure and budget regime.

| System | Setting | Reported result |
|---|---|---|
| BAVT | Multi-hop QA, low budget | Low tier achieves EM = 0.338, surpassing baseline High tier EM = 0.334 at $4\times$ tool calls [2603.12634] |
| ContextBudget | 32-objective QA, 4k budget | 1.7× cumulative F1 improvement over the best baseline (2.06 vs. 1.21) [2604.01664] |
| PACMS | LongMemEval QA, 45% budget | 52.0 and 68.0 QA accuracy, vs top-k 50.0 and 64.0, lc-mmr 44.0 and 56.0 [2606.20047] |
| CWL | Long-horizon agents | 89 sequential tasks across 80 million tokens with no measurable degradation in task accuracy relative to per-task isolated sessions [2606.11213] |
| SWE-Compressor | SWE-Bench-Verified | 57.6% solved rate [2512.22087] |
| Budget Tracker / BATS | BrowseComp with Gemini-2.5-Pro | ReAct 12.6 vs BATS 24.6 at budget 100 per tool [2511.17006] |
| CURE | Tabular stream learning | Up to 27.0% relative improvement over classical stream learners [2606.18677] |

In long-horizon search agents, BACM-RL in ContextBudget consistently outperforms ReAct, Search-R1, Summary Agent, and MEM1 across model scales and task complexities. For Qwen3-30B-A3B-Instruct on multi-objective QA, BACM-RL reaches 1.032, 3.587, 6.255, and 4.545 on 2-, 8-, 16-, and 32-objective settings, while the high-complexity 32-objective regime shows 4.545 versus Summary’s 2.848, described as over 1.6× gains [2604.01664].

In prompt assembly, PACMS provides a stronger distinction between recall and downstream utility. On a 100-question LongMemEval sample, it trails top-k on evidence-round recall at one operating point, yet still leads on end-to-end QA; PACMS also outperforms lc-mmr on QA despite comparable recall at the same budget. The reported interpretation is that facility-location coverage produces more extractable prompts than pairwise diversification or pure relevance ranking [2606.20047].

In reasoning-tree control, BAVT’s budget-conditioned search and residual value pruning are both necessary. The middle-tier ablation reports average EM of approximately 0.268 for the parallel baseline, approximately 0.215 for tree-only random selection, approximately 0.309 for tree plus step-level value, and 0.388 for full BAVT [2603.12634].

In tool-augmented search, larger raw tool budgets do not automatically improve performance. ReAct saturates around budget 100, whereas Budget Tracker continues to improve, and BATS produces markedly better scaling curves. Under budget 100 per tool, BrowseComp results for Gemini-2.5-Pro move from 12.6 with ReAct to 24.6 with BATS; BrowseComp-ZH moves from 31.5 to 46.0; HLE-Search moves from 20.5 to 27.0 [2511.17006].

In non-agentic online settings, bounded-context policies show the same structural benefit. CURE ranks first on all seven streams with average rank 1.00, and its per-step runtime remains practical: total 0.0283s for CURE versus 0.0259s for DualFIFO, with prediction dominating update overhead [2606.18677].

## 5. Misconceptions, contrasts, and design trade-offs

A common misconception is that BACM is equivalent to recency truncation. PACMS explicitly argues that recency truncation is topic-blind, discarding early-but-relevant facts and retaining recent-but-irrelevant material, especially in long-horizon memory tasks [2606.20047]. CWL makes a related point from a systems angle: semantic awareness requires dropping the oldest-and-most-recoverable content according to dependency structure rather than oldest-in-time regardless of relevance [2606.11213].

A second misconception is that BACM is simply summarization. Several approaches rely on summarization or aggregation, but they do so for different reasons and with different failure modes. CAT turns context management into a callable tool that produces structured long-term memory blocks at subtask boundaries and strategy switches [2512.22087]. ContextBudget uses commit-block aggregation learned by reinforcement learning [2604.01664]. CWL, by contrast, is presented as “Beyond Compaction”: it avoids unpredictable lossiness, destruction of causal structure, blocking model cost, and compression-induced hallucination by using a deterministic, LLM-free eviction policy [2606.11213].

A third misconception is that more computation automatically implies better performance. BAVT’s central comparison is that low-budget intelligent search can beat higher-budget brute-force scaling [2603.12634]. Budget-aware tool-use work reports that simply granting larger tool-call budgets fails to improve performance because agents lack budget awareness and quickly hit a performance ceiling [2511.17006]. BAGEN sharpens this further by showing that strong agents do not necessarily have strong budget-awareness, with correlation $r=0.35$, and that frontier models are consistently over-optimistic and continue spending on tasks that are unlikely to succeed [2606.00198].

A fourth misconception is that BACM concerns only the input context window. BudgetThinker addresses output-side reasoning length under a fixed input context and therefore occupies a narrower scope than full BACM [2508.17196]. Conversely, BAGEN and budget-aware tool-use make clear that context, reasoning, and action budgets interact; in practice, BACM often spans prompt tokens, chain-of-thought verbosity, retrieval depth, and tool orchestration simultaneously [2606.00198] [2511.17006].

These contrasts imply real design trade-offs: training-free versus trained control, summarization versus structured eviction, query-aware set selection versus sequential compression, and token-only versus multi-resource budgeting.

## 6. Implementation patterns, limitations, and open directions

Several implementation patterns recur across the literature. Systems track budget explicitly at each step, expose remaining capacity to the model or controller, and enforce a fallback policy near exhaustion. BAVT uses a forced-answer backstop when no answer exists and either $b_{\mathrm{tool},t}=0$ or $b_{\mathrm{token},t}/B_{\mathrm{token}} \le \eta$ [2603.12634]. ContextBudget exposes current context length, pending observation length, remaining budget, and a safety-margined usable limit in a budget-state prompt, with a 1,000-token safety margin subtracted from max model length [2604.01664]. Budget Tracker appends a `<budget>` status block after each tool response, while BATS periodically removes old tool responses and replaces them with verifier summaries, with summarization every $K=10$ steps in the reported implementation [2511.17006].

Selection and retention policies also share common engineering choices. PACMS keeps a warm embedding cache across turns and delegates compaction to the host runtime because ownsCompaction=false [2606.20047]. Budget-Aware Routing recommends sentence- or section-level units as defaults, greedy value-per-cost selection, and metric choice aligned with downstream use: ROUGE for extractive settings and BERTScore for abstractive generation [2605.00336]. CURE stores normalized predictive entropy at prediction time and uses it later for admission decisions, while eviction is performed within the most represented class using same-class nearest-neighbor structure and a recent centroid tie-break [2606.18677].

The limitations are correspondingly diverse. BAVT incurs critic overhead, assumes uniform tool cost in its experiments, and focuses on multi-hop QA rather than irreversible or partially observable environments [2603.12634]. ContextBudget identifies sparse and delayed rewards, coarse segment-level aggregation, and broader generalization to open-ended tool use, multimodal reasoning, and human-agent interaction as open issues [2604.01664]. PACMS notes that under very tight budgets, pure relevance can outperform coverage-driven selection, and that aggressive redundancy penalties may occasionally drop necessary detail [2606.20047]. BAGEN shows that interval calibration remains challenging, with interval coverage capping at 47% after SFT+RL, and that cross-task transfer retains only 17–36% of in-task reward [2606.00198]. CWL depends on correct episode typing and dependency annotation, and tighter ceilings can preserve accuracy while increasing wall-clock time through re-exploration [2606.11213].

Open directions follow directly from these failure modes. The literature repeatedly points toward multi-dimensional cost vectors for heterogeneous tools, stronger or learned relevance estimators, more precise credit assignment for compression actions, finer-grained saliency beyond segment-level aggregation, adaptive joint management of input-context and output-reasoning budgets, and on-policy evaluation in live interactive deployments [2603.12634] [2606.20047] [2508.17196]. A plausible implication is that future BACM systems will increasingly combine explicit budget signals, structured memory operations, and principled utility estimation, rather than relying on a single compression or truncation heuristic.

Source: https://www.emergentmind.com/topics/budget-aware-context-management-bacm