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

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

TL;DR

SKIM (Selective Knowledge-Informed Masking) is a novel compression framework that prunes and distills LLM agents by recognizing that not all tokens are created equal. By offloading syntactic formatting to runtime grammar constraints, SKIM reallocates a model's limited capacity toward critical decision-making tokens, maintaining high performance even at 50% sparsity where traditional methods collapse.

What Problem Does This Paper Address?

As LLM agents move into production, efficiency is paramount. However, standard pruning and distillation methods—designed for general-purpose chat—perform poorly on agentic tasks like tool-calling.

The authors identify a "structural mismatch": in production, agents often use structured generation (or constrained decoding), where a "formatter" (like XGrammar or SGLang) masks invalid tokens to ensure the output follows a strict schema (e.g., valid JSON). Traditional compression tries to preserve the model's ability to generate every token, including the brackets and commas that the formatter provides for free. This wastes precious parameters on "format" tokens, leaving insufficient capacity for the "decision" tokens (like function names and arguments) that actually determine the agent's success.

Methods

SKIM introduces a category-aware approach to both pruning and distillation, partitioned into three token roles:

  1. Context: Input tokens (tool descriptions, user queries).
  2. Decision: Output positions where the schema allows multiple valid choices (e.g., which tool to call).
  3. Format: Syntactic scaffolding where the schema allows only one valid token (e.g., the { at the start of a JSON object).

Category-Aware Pruning

Standard pruning uses layer-wise reconstruction to see which weights can be removed with minimal impact on the output. SKIM modifies this by introducing position-aware saliency scores. It applies a weighted Hessian approximation that down-weights format positions ($\alpha_f = 0.2$) and prioritizes context and decision positions ($\alpha_c, \alpha_d = 1.0$). This ensures the pruning process preserves the neurons most critical for reasoning, not just those that happen to fire during repetitive syntax.

On-Policy Distillation

After pruning, SKIM "heals" the model using a specialized distillation objective. Instead of matching the teacher's distribution over the entire vocabulary, it uses a constrained-distribution objective that only aligns the student and teacher on valid tokens. It also employs on-policy rollouts, training the student on its own generated trajectories to ensure it can recover from its own mistakes during multi-step reasoning.

Figure 2: Token categories and error decomposition under structured generation. Left: Exam- ple function call with tokens highlighted by category (Context, Decision, Format) and three re- sponse types distinguishing format errors (eliminated by structured decoding) from non-format er- rors (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 for- matter: 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.

Datasets

The authors evaluated SKIM across multiple model scales (Qwen3.5 0.8B to 27B) using:

  • Tool-calling benchmarks: BFCL-v3 and API-Bank L1.
  • Agentic loops: HotpotQA (using a ReAct-style loop).
  • General reasoning/coding: Spider (Text-to-SQL) and GSM8K.
  • Calibration/Training: A subset of the xLAM-function-calling-60k dataset.

Key Insights and Ideas

  • Format is "Free": In a constrained environment, the model doesn't need to "know" how to format JSON; the runtime enforces it. Pruning methods that don't account for this are essentially over-protecting redundant knowledge.
  • The "Broken" Model Paradox: A SKIM-compressed model often looks "broken" during free-form generation (producing malformed JSON or loops) because it has sacrificed its formatting capacity. However, once placed behind a grammar formatter, it significantly outperforms models that tried to keep their formatting skills intact.
  • Surgical Saliency: Ablation studies showed that removing "format-specialized" neurons barely impacts accuracy, while removing "decision-specialized" neurons causes total collapse.
Figure 3: BFCL-v3 math example on baseline methods and SKIM. SKIM-free’s format errors are intentional: the freed capacity lets SKIM-structured produce the correct call. Baselines fail with wrong arguments or wrong tools, errors grammar cannot fix. See § D for more examples.

Key Results

SKIM consistently outperformed strong baselines like Wanda-sp, FLAP, and SlimGPT, particularly in high-sparsity regimes.

  • High Sparsity Resilience: At 50% sparsity, SKIM retained 68–85% of the dense model's accuracy, while baselines often saw their performance drop to near zero.
  • Efficiency Gains: SKIM physically removes MLP channels and attention components. For a 27B model at 50% sparsity, this resulted in a 1.59x speedup in decoding throughput and a significant reduction in VRAM footprint (roughly 1.2 GiB saved for the 2B model).
  • Cross-Model Generalization: The benefits held true not just for general-purpose models (Qwen) but also for tool-specialized models (Hammer2.1-3B).
Table 1: Post-KD full-match accuracy of Qwen3.5 series across varying sparsity ratios with thinking mode enabled. All reported numbers are measured under the same distillation budget. Each cell reports structured-generation / free-generation accuracy. SKIM achieves the best structured-generation accuracy in most settings, with the gap to baselines widening at higher sparsity.

Limitations and Future Work

  • Scale: While tested up to 27B, the authors note that validation on much larger models (70B+) and different model families remains for future work.
  • Distillation Data: The current distillation uses single-turn traces. The authors found that using multi-step agentic trajectories (trajectory-level healing) could further close the performance gap in complex tasks like HotpotQA.
  • Methodological Scope: The current pruning stage uses layer-wise reconstruction; extending category-awareness to end-to-end pruning or calibration-based quantization is a promising next step.

Summary updated

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.
BibTeX
@inproceedings{choi2026skim,
  author = {Moonseok Choi and Jongwon Jeong and Minki Kang and Giung Nam and Juho Lee},
  title = {{SKIM: Pruning Large Language Model Agents via Selective Knowledge Informed Masking}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=QLGlAPvyfZ},
}
Figure