Context Pruning for Coding Agents via Multi-Rubric Latent Reasoning
Jingjing Wang, Xiwen Chen, Wenhui Zhu, Huayu Li, University of Arizona, [email protected], Zhengxiao He, University of Arizona, [email protected], Feiyang Cai, Clemson University, [email protected], Ana S. Carreon-Rascon, Xuanzhao Dong, Arizona State University, [email protected], Feng Luo, Clemson University, [email protected] · 2026
Read Context Pruning for Coding Agents via Multi-Rubric Latent Reasoning by Jingjing Wang, Xiwen Chen, Wenhui Zhu, Huayu Li, University of Arizona, [email protected], Zhengxiao He, University of Arizona, [email protected], Feiyang Cai, Clemson University, [email protected], Ana S. Carreon-Rascon, Xuanzhao Dong, Arizona State University, [email protected], Feng Luo, Clemson University, [email protected] (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-15315.txt.
Introduction
Jingjing Wang and eight colleagues propose LaMR, a structured context-pruning framework for coding agents that spend most tokens reading repository files. Single-objective pruners collapse relevance into one score, forcing one transition prior to serve both contiguous semantic spans and sparse structural lines. LaMR splits relevance into semantic evidence and dependency support, each with its own conditional random field. They fuse through mixture-of-experts gating and a final aggregation layer. Labels come from AST-based analysis of existing corpora, denoising teacher labels without new annotation.
Catalog record
| CREATOR | Jingjing Wang, Xiwen Chen, Wenhui Zhu, Huayu Li, University of Arizona, [email protected], Zhengxiao He, University of Arizona, [email protected], Feiyang Cai, Clemson University, [email protected], Ana S. Carreon-Rascon, Xuanzhao Dong, Arizona State University, [email protected], Feng Luo, Clemson University, [email protected] |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 62346 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.15315
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Context Pruning for Coding Agents via Multi-Rubric Latent Reasoning Jingjing Wang, Xiwen Chen, Wenhui Zhu, Huayu Li, University of Arizona, [email protected], Zhengxiao He, University of Arizona, [email protected], Feiyang Cai, Clemson University, [email protected], Ana S. Carreon-Rascon, Xuanzhao Dong, Arizona State University, [email protected], Feng Luo, Clemson University, [email protected] Abstract LLM-powered coding agents spend the majority of their token budget reading repository files, yet much of the retrieved code is irrelevant to the task at hand. Existing learned pruners compress this context with a single-objective sequence labeler, collapsing all facets of code relevance into one score and one transition matrix. We show that this formulation creates a modeling bottleneck: a single CRF transition prior must serve heterogeneous retention patterns, including contiguous semantic spans and sparse structural support lines. We propose LaMR (Latent Multi-Rubric) , a structured pruning framework that decomposes code relevance into two interpretable quality dimensions, semantic evidence and dependency support, each modeled by a dedicated CRF with dimension-specific transition dynamics. A mixture-of-experts gating network dynamically weights the per-rubric emissions conditioned on the query, and a final CRF layer on the fused emissions produces the aggregate keep-or-prune decision. To supervise each dimension without additional annotation cost, we derive multi-rubric labels from the existing training corpus via AST-based program analysis, simultaneously denoising the teacher’s binary labels. By effectively filtering distracting noise, LaMR frequently matches or even outperforms unpruned full-context baselines. Experiments on four benchmarks (SWE-Bench Verified, SWE-QA, LCC, LongCodeQA) show that LaMR wins 12 of 16 head-to-head multi-turn comparisons. It saves up to 31% more tokens on multi-turn agent tasks and improves Exact Match by up to +3.5 on single-turn tasks, while performance is frequently enhanced by denoising the context, and any remaining drops are marginal. Figure 1 : Effect of LaMR across two backbone models and three benchmarks. Left : Token consumption (K tokens); percentage labels show reduction by LaMR relative to unpruned. Middle/Right : Task quality (SWE-Bench solve rate in %; SWE-QA average score on a 10-point scale). Gray bars are unpruned baselines; blue bars are with LaMR. LaMR consistently reduces token usage while maintaining or slightly improving quality. 1 Introduction LLM-powered coding agents are rapidly reshaping software engineering, with state-of-the-art (SOTA) frameworks such as SWE-agent ( 31 ) , OpenHands ( 26 ) , and Agentless ( 29 ) automating complex, repository-level tasks. Commercial success followed suit: Anthropic’s Claude Code and Cursor have reached multi-billion dollar valuations by processing millions of lines of code daily. However, these agents have hit a context wall : they spend approximately 67–76% of their token budget simply reading files ( 28 ) . This context bloat not only incurs prohibitive API costs but also triggers "attention dilution" and the lost-in-the-middle phenomenon ( 15 ) , where irrelevant code segments degrade the agent’s reasoning precision. The quest for context efficiency has evolved through three distinct paradigms. Initially, task-agnostic heuristics were employed, such as perplexity-based token pruning ( 7 ; 13 ) or similarity-based RAG ( 3 ) . However, as noted by ( 22 ) , these methods primarily target natural language and face critical limitations when applied to code: token-level pruning frequently compromises syntactic validity, while abstractive techniques discard character-level details essential for debugging. Furthermore, these approaches operate with static compression ratios and task-agnostic criteria, failing to adapt to the evolving informational needs of multi-turn agent interactions ( 31 ) . Recently, SWE-Pruner ( 28 ) mitigated this issue by framing code context pruning as a structured sequence labeling task. It trains a 0.6B-parameter neural skimmer by minimizing the conditional random field negative log likelihood (CRF-NLL) ( 37 ) . This allows adaptive token usage reduction while keeping character-level integrity. However, this single-objective formulation introduces an inherent conflict: it uses one transition matrix to model all types of code relevance. Code relevance operates across distinct dimensions. Semantic relevance usually forms continuous blocks, which require high self-transition probabilities in the CRF. In contrast, structural dependencies (like import statements) and control-flow pairs (like try / except ) are scattered. A single transition matrix creates a modeling bottleneck: it must serve both dense semantic spans (contiguous keep-blocks) and sparse structural support (scattered single-line jumps) with one set of parameters. Forced to compromise, the model biases toward the denser semantic blocks. It retains the main function body but discards necessary structural lines ( fig. 2 ). This missing structure severely impacts strong coding agents. When models like Claude 4.6 encounter broken syntax or missing context, they fail and repeatedly retry the task. These iterative retries end up consuming more tokens than the unpruned baseline. To address this, we propose LaMR ( La tent M ulti- R ubric). We decompose code relevance into K latent rubrics, each modeled by a dedicated CRF head with its own transition matrix. This allows dimension-specific sequence patterns. A query-adaptive Mixture-of-Experts (MoE) gate then combines the per-dimension CRF emissions, dynamically balancing semantic and structural signals for the current task. Since existing datasets provide only binary keep-or-prune masks, we introduce Rubric-Guided Labeling to derive fine-grained supervision without additional annotation. Using Abstract Syntax Tree (AST) analysis, we extract dimension-specific labels from the existing masks and recover structurally necessary lines that the teacher may omit, such as imports, class headers, and control-flow companions. This produces a cleaner training signal for the neural skimmer. More broadly, LaMR is not merely deleting tokens; it aims to preserve self-contained evidence-support units: task-relevant lines together with the structural context needed to interpret them. By effectively extracting signal from noise, LaMR provides agents with higher-quality observations. We empirically demonstrate that this structure-aware approach not only compresses the context but carries the potential to elevate the agent’s final task performance. We summarize our contributions below: (i) Latent Multi-Rubric Formulation. We identify the transition conflict in single-objective pruning and resolve it by modeling code relevance through K separate CRF heads. (ii) Query-Adaptive Gating. We use an MoE gating network to adjust the focus between semantic and structural code based on the agent’s query. (iii) AST-based Label Denoising. We develop a zero-cost pipeline to extract multi-dimensional labels from binary masks, which corrects missing structural tokens in the teacher data. (iv) Superior Efficiency-Performance Tradeoff. We extensively evaluate LaMR across four benchmarks and two state-of-the-art LLM backbones. As a lightweight middleware, it consistently mitigates token bloat and achieves a strictly better tradeoff between context compression and downstream task quality compared to prior methods. Query: “How does the middleware validate JWT tokens?” ⬇ 1 import jwt \blacktriangleleft dep 2 from config import SECRET_KEY \blacktriangleleft dep 3 4 class AuthMiddleware : \blacktriangleleft dep 5 def validate_token ( self , token ): \blacktriangleleft sem 6 try : \blacktriangleleft dep 7 payload = jwt . decode ( \blacktriangleleft sem 8 token , SECRET_KEY , \blacktriangleleft sem 9 algorithms =[" HS256 "] \blacktriangleleft sem 10 ) 11 return payload \blacktriangleleft sem 12 except ExpiredSignatureError : \blacktriangleleft dep 13 return None \blacktriangleleft dep 14 except InvalidTokenError : \blacktriangleleft dep 15 return None \blacktriangleleft dep 16 def process_request ( self , req ): 17 ... (a) Single-objective × L1–2: prunes imports (low semantic) × L4: prunes class header (structural) ✓ L5–11: keeps core logic (high semantic) × L12–15: prunes except (control-flow) (b) LaMR (multi-rubric) ✓ L1–2: keeps imports via dep ✓ L4: keeps class