LEANCODE: Understanding Models Better for Code Simplification of Pre-trained Large Language Models

Yan Wang, Ling Ding, Tien N Nguyen, Shaohua Wang, Yanan Zheng
5/20/2025
cs.SEcs.LG

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

Large Language Models for code often entail significant computational complexity, which grows significantly with the length of the input code sequence. We propose LeanCode for code simplification to reduce training and prediction time, leveraging code contexts in utilizing attention scores to represent the tokens' importance. We advocate for the selective removal of tokens based on the average context-aware attention scores rather than average scores across all inputs. LeanCode uses the attention scores of `CLS' tokens within the encoder for classification tasks, such as code search. It also employs the encoder-decoder attention scores to determine token significance for sequence-to-sequence tasks like code summarization. Our evaluation shows LeanCode's superiority over the SOTAs DietCode and Slimcode, with improvements of 60% and 16% for code search, and 29% and 27% for code summarization, respectively.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wang2025leancode,
  title  = {LEANCODE: Understanding Models Better for Code Simplification of Pre-trained Large Language Models},
  author = {Yan Wang and Ling Ding and Tien N Nguyen and Shaohua Wang and Yanan Zheng},
  year   = {2025},
  eprint = {2505.14759},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.14759v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.14759.svg)](https://codeofpaper.com/paper/2505.14759)

Discussion