arXiv:2611.07558cs.CLNov 2026

Manuscript Offprint

arXiv:2611.07558

SKIM: Pruning Large Language Model Agents via Selective Knowledge Informed Masking

Moonseok Choi, Jongwon Jeong, Minki Kang, Giung Nam, Juho Lee

Moonseok Choi KAIST ms.choi@kaist.ac.kr

Jongwon Jeong University of Wisconsin-Madison jjeong64@wisc.edu

Minki Kang KAIST minkikang@kaist.ac.kr

Giung Nam† KAIST giung@kaist.ac.kr

Juho Lee† KAIST juholee@kaist.ac.kr

Abstract

Large Language Model (LLM) agents are increasingly deployed under structured generation, where grammar constraints enforce output format at inference time. Whereas existing compression methods target unconstrained generation, we first identify a fundamental mismatch: under structured generation, grammar constraints reduce the model's output distribution to valid tokens, and the logits matter most at the small set of positions that decide the agent's action. Motivated by this finding, we propose SKIM (Selective Knowledge-Informed Masking), the first pruning and distillation framework for LLM agents under structured generation, with both stages guided by token role. SKIM partitions token positions into context, decision, and format categories, and this partition drives two complementary axes: (1) category-aware pruning saliency scores that preserve parameters most relevant for decision positions; and (2) an on-policy distillation objective that aligns student and teacher on valid tokens, paired with category-aware feature matching. We evaluate SKIM on tool-calling benchmarks and within multi-step agent loops, across multiple model scales and sparsity levels. SKIM consistently improves accuracy over baselines, with its superiority becoming most striking in high-sparsity regimes where conventional methods struggle, demonstrating the potential of category-aware compression for deployment-time grammar-constrained agents. The project page is available at link.

1 Introduction

Large Language Model (LLM) agents are widely served under structured generation, where outputs must conform to a predefined format and tokens that would violate it are masked before sampling at every decoding step [40, 8]. This is now standard practice in production serving stacks [8, 47]. Yet the pruning and distillation methods used to compress LLMs are designed under the assumption of unconstrained generation [9, 38, 13, 28], and recent work confirms that off-the-shelf compression degrades sharply on tool-calling tasks [7].

The mismatch is structural, not incidental. Under structured generation, the model's effective distribution at each step is its raw softmax restricted to valid tokens and renormalized [40, 12]. The objectives

Figure

Figure 1: Target behavior.

†Co-corresponding authors.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Figure

Function calling (e.g., API-bank, BFCL, Tau-bench)

System: You are a helpful API assistant. Use tools below to answer.

Tools: GetLat(city), GetLon(city), GetTime(zone).

"Get the current time in London."

Correct

{"name": "GetTime", "zone": "GMT+0"}

Format error

{"name": "GetTime", "zone": "GMT+0"}

Missing comma; parser rejects

Non-format error

{"name": "GetLat", "zone": "GMT+0"}

Wrong tool; yet parses cleanly

Pruning Results

Figure

Figure 2: Token categories and error decomposition under structured generation. Left: Example function call with tokens highlighted by category (Context, Decision, Format) and three response types distinguishing format errors (eliminated by structured decoding) from non-format errors (which require the model itself to be correct). Right: Pruned-then-distilled model performance on Qwen3.5-2B [33] and BFCL-v3 [31] at 25% sparsity. SKIM fully exploits the grammar formatter: without it, SKIM looks broken because format errors dominate, but with it, SKIM easily beats Base (Wanda-sp). Format errors are essentially free under structured decoding, so reducing non-format errors at decision positions is what matters.

used in prior compression work, KL divergence to a teacher [13, 28] and layer-wise activation reconstruction [9, 38], are all computed against the unconstrained output. They preserve parameters that contribute to outputs the runtime masks, wasting capacity on behavior it already enforces.

Our key insight is that not all output tokens play the same role under structured generation. Hinging on this insight, we partition the agent's output into three roles: (1) context positions hold the input the model reads, (2) decision positions are the few output points where the format admits multiple valid options such as the function name or enum-valued arguments, and (3) format positions are the syntactic scaffolding the constraint mechanism enforces [8, 12]. The constraint mechanism enforces format validity for free at deployment [40, 8], so capacity allocated to format positions is wasted on behavior the runtime supplies regardless. Figure 2 (right) shows that even with standard distillation for healing [28, 37], the error of pruned agent models is dominated by non-format error, indicating that compression should preserve capacity at decision rather than format positions.

We propose SKIM (Selective Knowledge-Informed Masking), the first pruning and distillation framework designed for LLM agents deployed under structured generation. The pruning side extends layer-wise reconstruction with per-category activation coefficients that down-weight format positions in the saliency score [38, 2]. The distillation side combines a forward-KL objective between the teacher's and student's constrained distributions on the student's own on-policy rollouts, paired with hidden-state matching at context and decision positions [28]. Both stages share the same token-role partition, aligning the preserved capacity with the deployment regime end-to-end.

We evaluate SKIM on tool-calling benchmarks, BFCL-v3 [31] and API-Bank L1 [19], and within ReAct-style agent loops [44] on HotpotQA [43]. Across model scales from 0.8B to 9B and sparsity levels, SKIM generally outperforms strong pruning and distillation baselines [38, 2, 22], with the largest margins at high sparsity where existing methods collapse but SKIM continues to recover most of the dense model's structured-decoding accuracy.

Our contributions are:

To the best of our knowledge, we are the first to identify the mismatch between standard pruning and distillation objectives and constrained-decoding deployment, and we introduce a token-wise categorization of agent outputs into context, decision, and format positions, which grounds the design of our method ( §3§ 3).

We propose SKIM, a pruning and distillation framework that uses this categorization in both stages: a category-aware saliency that down-weights format positions in layer-wise reconstruction, and an on-policy distillation objective over the teacher's and student's constrained distributions paired with category-aware hidden-state matching ( §4§ 4).

  • We evaluate SKIM on tool-calling benchmarks and within multi-step agent loops across model scales from 0.8B to 9B, showing that SKIM preserves reasoning and tool-use capability with gains widening at higher sparsities (§ 5).

References (45)