Natural Is The Best: Model-Agnostic Code Simplification for Pre-trained Large Language Models
Not on the map. Why?
Abstract (arXiv)
Pre-trained Large Language Models (LLM) have achieved remarkable successes in several domains. However, code-oriented LLMs are heavy in computational complexity, and quadratically with the length of the input. Toward simplifying the input program of an LLM, the state-of-the-art approach has the strategies to filter the input code tokens based on the attention scores given by the LLM. The decision to simplify the input should not rely on the attention patterns of an LLM, as these patterns are influenced by both the model architecture and the pre-training dataset. Since the model and dataset are part of the solution domain, not the problem domain where the input belongs, the outcome may differ when the model is pre-trained on a different dataset. We propose SlimCode, a model-agnostic code simplification solution for LLMs that depends on the nature of input code tokens. As an empirical study on the LLMs including CodeBERT, CodeT5, and GPT-4 for two main tasks: code search and summarization, we reported that 1) the removal ratio of code has a linear-like relation with the saving ratio on training time, 2) the impact of categorized tokens on code simplification can vary significantly, 3) the impact of categorized tokens on code simplification is task-specific but model-agnostic, and 4) the above findings hold for the paradigm-prompt engineering and interactive in-context learning. The empirical results showed that SlimCode can improve the state-of-the-art technique by 9.46% and 5.15% in terms of MRR and BLEU score on code search and summarization. Moreover, SlimCode is 133 times faster than the state-of-the-art approach. Additionally, SlimCode can reduce the cost of invoking GPT-4 by up to 24% per API query, while still producing comparable results to those with the original code.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). First posted on arXiv 18 May 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 2; 2026: 8.
10 papers.
- 2025Reducing Cost of LLM Agents with Trajectory Reductioncited by 44
- 2026SWE-Pruner: Self-Adaptive Context Pruning for Coding Agentscited by 40
- 2025LongCodeZip: Compress Long Context for Code Language Modelscited by 38
- 2026Seeing is Coding: On the Effectiveness of Vision Language Models in Code Understandingcited by 13
- 2026SWE-Pruner Pro: The Coder LLM Already Knows What to Prunecited by 2
- 2026Prompt-Driven Code Summarization: A Systematic Literature Reviewcited by 0
- 2026On Problems of Implicit Context Compression for Software Engineering Agentscited by 0
- 2026CodeShrink: Adaptive Visual Compression for Efficient Multimodal Code Understandingcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0
- 2026Compress What You See, Not What You Say: Anchored Context Distillation for Latent-Observation Software Engineering Agentscited by 0
- 2026Compress What You See, Not What You Say: Anchored Context Distillation for Latent-Observation Software Engineering Agents25 Sep 2026
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026CodeShrink: Adaptive Visual Compression for Efficient Multimodal Code Understanding31 Jul 2026
- 2026SWE-Pruner Pro: The Coder LLM Already Knows What to Prune20 Jul 2026
- 2026On Problems of Implicit Context Compression for Software Engineering Agents11 May 2026
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2026Seeing is Coding: On the Effectiveness of Vision Language Models in Code Understanding2 Feb 2026
- 2026SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents23 Jan 2026
- 2025LongCodeZip: Compress Long Context for Code Language Models1 Oct 2025
- 2025Reducing Cost of LLM Agents with Trajectory Reduction28 Sep 2025