GainCtrl: Predicting Remaining Gains for Efficient LLM Agent Execution

Kangwen Zhao, Jianfeng Cai, Ruopei Sun, Mingxiao Feng, Peng Zhang, Wengang Zhou, Houqiang LiarXiv 2026 · arXiv

TL;DR

GainCtrl is a lightweight, CPU-based execution controller designed to make LLM agents more cost-effective by predicting when an attempt is unlikely to yield further improvements. By estimating the "expected positive gain" of continuing a trajectory, it allows agents to stop unpromising attempts early, achieving significant token savings (up to 67% in some cases) while maintaining high task quality across diverse environments.

What Problem Does This Paper Address?

Large Language Model (LLM) agents often solve complex tasks by making multiple attempts—a strategy known as "Best-of-N" sampling. While this improves the chances of success, it is incredibly expensive. Every additional step in a trajectory incurs token costs, and later steps are often more expensive as the interaction history grows.

The core challenge is early stopping: how do we know when to quit an attempt?

  1. The Uncertainty Gap: An attempt that looks stuck might just be one step away from a breakthrough, while a smooth-looking attempt might plateau for hundreds of tokens.
  2. Black-Box Limitations: Many existing monitoring methods rely on internal model activations (white-box) or token log-probabilities, which are often unavailable or expensive to retrieve from commercial LLM APIs.
  3. Portfolio Awareness: In a Best-of-N setting, an attempt is only valuable if it beats the best score achieved in all previous attempts. Most controllers only look at the current trajectory in isolation.

Methods

The authors introduce GainCtrl, which treats execution control as a regression problem. Instead of predicting binary success or failure, it predicts the expected positive gain—the amount by which the final score is expected to exceed a specific reference score.

The Architecture

  • Lightweight Predictor: Unlike LLM-based monitors, GainCtrl uses a multi-output ExtraTrees regressor that runs on a single CPU thread with millisecond latency.
  • Feature Representation: It combines two types of inputs:
  • Action Text Features: The interaction history (tasks, actions, observations) is encoded using TF-IDF followed by SVD to create a compact 64-dimensional vector.
  • Statistical Features: Environment-specific metrics like step budget used, recent score changes, and action diversity.
  • Gain Vectoring: The model predicts a 10-dimensional vector representing potential gains at fixed reference scores (0.0, 0.1, ..., 0.9). It uses linear interpolation to estimate the gain for any arbitrary score.

Two Control Strategies

  1. GainCtrl-T (Trajectory-level): Decides to stop if the predicted gain over the current attempt's best score is below a threshold.
  2. GainCtrl-P (Portfolio-level): Decides to stop if the predicted gain over the best score across all attempts so far is below a threshold. This makes the controller "smarter" as the session progresses.

Datasets

The researchers evaluated GainCtrl across three distinct environments using three different LLM "actors" (Qwen3.5-4B, Qwen3.5-9B, and GPT-6-Luna):

  • WebShop: A web-based shopping task where scores are non-decreasing.
  • ScienceWorld: A complex science simulation where scores can fluctuate as the agent interacts with the environment.
  • ALFWorld: An embodied AI benchmark with binary (success/failure) rewards.

Key Insights and Ideas

  • Magnitude Matters: Predicting how much an agent might improve is more effective for cost-balancing than simply predicting if it will succeed.
  • Contextual Stopping: The "Portfolio-level" approach (GainCtrl-P) is a major "aha" moment. If an agent has already achieved a score of 0.95 in attempt #1, attempt #2 should be held to a much higher standard of potential gain to justify its cost.
  • CPU > GPU for Monitoring: The paper demonstrates that a well-designed classical machine learning model (ExtraTrees) can outperform or match neural monitors while being orders of magnitude faster and cheaper to run.
  • Black-Box Compatibility: Because GainCtrl only looks at the text and basic stats of the interaction, it can be wrapped around any LLM (like GPT-4 or Claude) without needing access to the model's internal weights or hidden states.

Key Results

  • Token Efficiency: GainCtrl-P consistently outperformed the baseline (FailFast) on the quality-cost Pareto frontier. At matched target quality, GainCtrl-P saved significantly more tokens—for example, 36.8% to 37.3% savings in ScienceWorld and up to 67.6% in WebShop for the Luna actor.
  • Quality Retention: With a single fixed stopping threshold, GainCtrl maintained task quality very close to "Full Execution" (completing every step of every attempt) while drastically reducing token usage.
  • Speed: The predictor has a median latency of 7.0–11.9 ms on a single CPU thread. In contrast, neural-based monitors often require GPUs and take 60–120 ms per check.

Limitations and Future Work

  • Training Requirements: GainCtrl requires a pool of recorded "complete" trajectories to train the regressor. It cannot be used "out of the box" for a brand-new environment without prior data.
  • Feature Engineering: While the text features are general, the statistical features are currently hand-designed for each environment. Future work could explore more automated feature extraction.
  • Environment Reset Costs: The study focuses on token costs. In some real-world applications, the time/compute cost of resetting an environment (e.g., a physical robot or a complex database) might outweigh the token savings.
  • Sparse Rewards: The method relies on intermediate feedback or scores. Its effectiveness might diminish in "all-or-nothing" tasks where no progress signal is available until the very end.

Summary updated

Abstract

Large language models (LLMs) are widely used to power agents that interact with tools and environments to solve complex tasks. Repeated attempts improve the quality of tool-using agents, but continued execution incurs additional costs even when it is unlikely to improve the best result ultimately returned. This raises the question of when to stop an attempt to reduce execution cost while preserving task-level Best-of-N quality. To address this question, we introduce GainCtrl, a gain-based execution controller for LLMs. In GainCtrl, a lightweight CPU predictor uses interaction histories to estimate expected positive gains over retained scores, which are then used to guide stopping decisions with calibrated thresholds to limit the loss in mean Best-of-N task quality. We evaluate the controller through trajectory replay across three environments and three LLM actors. Comparisons of interpolated quality-cost Pareto frontiers show that GainCtrl generally uses fewer tokens than baselines at matched target quality. Fixed policies also achieve quality close to that of full execution while substantially reducing token consumption. The predictor runs at millisecond latency on a single CPU thread, supporting repeated monitoring without access to LLM internals.
BibTeX
@misc{zhao2026gainctrl,
  author = {Kangwen Zhao and Jianfeng Cai and Ruopei Sun and Mingxiao Feng and Peng Zhang and Wengang Zhou and Houqiang Li},
  title = {{GainCtrl: Predicting Remaining Gains for Efficient LLM Agent Execution}},
  year = {2026},
  eprint = {2611.20736},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.20736},
}
Figure