Lune

ICSE2026顶会

The Hidden Cost of Readability: How Code Formatting Silently Consumes Your LLM Budget

Dangfeng Pan, Zhensu Sun, Cenyuan Zhang, David Lo, Xiaoning Du

摘要

Source code is usually formatted with elements like indentation and newlines to improve readability for human developers. However, these visual aids do not seem to be beneficial for large language models (LLMs) in the same way since the code is processed as a linear sequence of tokens. Furthermore, these additional tokens can lead to increased computational costs and longer response times for LLMs. If such formatting elements are non-essential to LLMs, we can reduce such costs by removing them from the code. To figure out the role played by formatting elements, we conduct a comprehensive empirical study to evaluate the impact of code formatting on LLM performance and efficiency. Through large-scale experiments on Fill-in-the-Middle Code Completion tasks across four programming languages (Java, Python, C++, C#) and ten LLMs-including both commercial and open-source models-we systematically analyze token count and performance when formatting elements are removed. Key findings indicate that LLMs can maintain performance across formatted code and unformatted code, achieving an average input token reduction of 24.5% with negligible output token reductions. This makes code format removal a practical optimization strategy for improving LLM efficiency. Further exploration reveals that both prompting and fine-tuning LLMs can lead to significant reductions (up to 36.1%) in output code length without compromising correctness. To facilitate practical applications, we develop a bidirectional code transformation tool for format processing, which can be seamlessly integrated into existing LLM inference workflows, ensuring both human readability and LLM efficiency.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 4 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Seeing Is Coding: On the Effectiveness of Vision Language Models in Code Understanding 引用了 Token Sugar: Making Source Code Sweeter for LLMs through Token-Efficient Shorthand
  • Magicoder: Empowering Code Generation with OSS-Instruct 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • An extensive study on pre-trained models for program understanding and generation 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper4

  1. Token Sugar: Making Source Code Sweeter for LLMs through Token-Efficient ShorthandZhensu Sun, Chengran Yang, Xiaoning Du, Zhou Yang 等ASE 2025 · 2 次引用
  2. Seeing Is Coding: On the Effectiveness of Vision Language Models in Code UnderstandingYuling Shi, Chaoxiang Xie, Zhensu Sun, Yeheng Chen 等ISSTA 2026 · 1 次引用
  3. Reducing Cost of LLM Agents with Trajectory ReductionYuan-An Xiao, Pengfei Gao, Chao Peng, Yingfei XiongFSE 2026 · 1 次引用
  4. AttnCompress: Dynamic Attention-Guided Trajectory Compression for Software Engineering AgentsZhengran Zeng, Yixin Li, Rui Xie, Wei Ye 等ISSTA 2026

它引用的 Paper12

  1. QLoRA: Efficient Finetuning of Quantized LLMsTim Dettmers, Artidoro Pagnoni, Ari Holtzman, Luke ZettlemoyerNeurIPS 2023 · 5,863 次引用
  2. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 次引用
  3. Magicoder: Empowering Code Generation with OSS-InstructYuxiang Wei, Zhe Wang, Jiawei Liu, Yifeng Ding 等ICML 2024 · 246 次引用
  4. Think before you speak: Training Language Models With Pause TokensSachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon 等ICLR 2024 · 240 次引用
  5. An extensive study on pre-trained models for program understanding and generationZhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li 等ISSTA 2022 · 142 次引用

相关 Paper

  1. AI Coders Are among Us: Rethinking Programming Language Grammar towards Efficient Code GenerationZhensu Sun, Xiaoning Du, Zhou Yang, Li Li 等ISSTA 2024 · 8 次引用
  2. ADO: Automatic Data Optimization for Inputs in LLM PromptsSam Lin, Wenyue Hua, Lingyao Li, Zhenting Wang 等ACL Findings 2025 · 2 次引用
  3. Rethinking Code Refinement: Learning to Judge Code EfficiencyMinju Seo, Jinheon Baek, Sung Ju HwangEMNLP Findings 2024 · 1 次引用
  4. Generating Energy-Efficient Code via Large-Language Models - Where are we now?Radu Apsan, Vincenzo Stoico, Michel Albonico, Rudra Dhar 等ICSE 2026
  5. Beyond Natural Language: LLMs Leveraging Alternative Formats for Enhanced Reasoning and CommunicationWeize Chen, Chenfei Yuan, Jiarui Yuan, Yusheng Su 等EMNLP Findings 2024 · 3 次引用
黄昏的海面,两侧是细线勾勒的悬崖