Cited by 0Software Engineering ResearchTopic ModelingTeaching and Learning Programming

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

Open access
Pan, Dangfeng, Sun, Zhensu, Zhang, Cenyuan, Lo, David, Du, Xiaoning·2026·Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering

Abstract

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.

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1145/3744916.3764556

Cites

Statistics

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

The citation lists haven’t been fetched yet

Research works printed but not linked: 34

  1. [3][3] Yoav Benjamini and Yosef Hochberg. 1995. Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal statistical society: series B (Methodological) 57, 1 (1995), 289-300. -
  2. [4][4] Linzheng Chai, Shukai Liu, Jian Yang, Yuwei Yin, Ke Jin, Jiaheng Liu, Tao Sun, Ge Zhang, Changyu Ren, Hongcheng Guo, et al. 2024. McEval: Massively Multilingual Code Evaluation. arXiv e-prints (2024), arXiv-2406. -
  3. [6][6] Christine Cuskley, Rebecca Woods, and Molly Flaherty. 2024. The Limitations of Large Language Models for Understanding Human Language and Cognition. Open Mind 8 (08 2024), 1058-1083. https://doi.org/10.1162/opmi\_a\_00160 arXiv:https://direct.mit.edu/opmi/articlepdf/doi/10.1162/opmi\_a\_00160/2468254/opmi\_a\_00160.pdf - · DOI
  4. [7][7] Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. 2023. QLoRA: Efficient Finetuning of Quantized LLMs. arXiv preprint arXiv:2305.14314 (2023). - · arXiv
  5. [8][8] Anton Lozhkov et al. 2024. StarCoder 2 and The Stack v2: The Next Generation. arXiv:2402.19173 [cs.SE] https://arxiv.org/abs/2402.19173 - · arXiv
  6. [9][9] An Yang et al. 2024. Qwen2 Technical Report. arXiv:2407.10671 [cs.CL] https: //arxiv.org/abs/2407.10671 - · arXiv
  7. [10][10] DeepSeek-AI et al. 2025. DeepSeek-V3 Technical Report. arXiv:2412.19437 [cs.CL] https://arxiv.org/abs/2412.19437 - · arXiv
  8. [11][11] Gemini Team et al. 2024. Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context. arXiv:2403.05530 [cs.CL] https://arxiv.org/abs/ 2403.05530 - · arXiv
  9. [12][12] Marah Abdin et al. 2024. Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone. arXiv:2404.14219 [cs.CL] https://arxiv.org/abs/ 2404.14219 - · arXiv
  10. [13][13] Mohammad Bavarian et al. 2022. Efficient Training of Language Models to Fill in the Middle. arXiv:2207.14255 [cs.CL] https://arxiv.org/abs/2207.14255 - · arXiv
  11. [14][14] OpenAI et al. 2024. GPT-4 Technical Report. arXiv:2303.08774 [cs.CL] https: //arxiv.org/abs/2303.08774 - · arXiv
  12. [15][15] Yanlin Wang et al. 2024. Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Models. arXiv:2407.00456 [cs.SE] https: //arxiv.org/abs/2407.00456 - · arXiv
  13. [20][20] Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, and Vaishnavh Nagarajan. 2023. Think before you speak: Training language models with pause tokens. arXiv preprint arXiv:2310.02226 (2023). - · arXiv
  14. [21][21] Daya Guo, Qihao Zhu, Dejian Yang, Zhenda Xie, Kai Dong, Wentao Zhang, Guanting Chen, Xiao Bi, Y. Wu, Y. K. Li, Fuli Luo, Yingfei Xiong, and Wenfeng Liang. 2024. DeepSeek-Coder: When the Large Language Model Meets Programming - The Rise of Code Intelligence. arXiv:2401.14196 [cs.SE] https://arxiv.org/abs/2401.14196 - · arXiv
  15. [22][22] Wenpin Hou and Zhicheng Ji. 2024. Comparing Large Language Models and Human Programmers for Generating Programming Code. Advanced Science (30 12 2024). https://doi.org/10.1002/advs.202412279 [Online; accessed 2025-03-10]. - · DOI
  16. [23][23] Chaoet al. Hu. 2024. How Effectively Do Code Language Models Understand PoorReadability Code?. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering (Sacramento, CA, USA) (ASE '24) . Association for Computing Machinery, New York, NY, USA, 795-806. https://doi.org/10. 1145/3691620.3695072 -
  17. [24][24] H. B. Mann and D. R. Whitney. 1947. On a Test of Whether One of Two Random Variables Is Stochastically Larger than the Other. Annals of Mathematical Statistics 18 (1947), 50-60. https://doi.org/10.1214/aoms/1177730491 - · DOI · Paper page
  18. [25][25] Vadim Markovtsev, Waren Long, Hugo Mougard, Konstantin Slavnov, and Egor Bulychev. 2019. STYLE-ANALYZER: fixing code style inconsistencies with interpretable unsupervised algorithms. arXiv:1904.00935 [cs.LG] https: //arxiv.org/abs/1904.00935 - · arXiv
  19. [26][26] Quinn McNemar. 1947. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 12, 2 (June 1947), 153-157. https://doi.org/10.1007/bf02295996 - · DOI · Paper page
  20. [27][27] Qing Mi, Jacky Keung, and Yang Yu. 2016. Measuring the Stylistic Inconsistency in Software Projects using Hierarchical Agglomerative Clustering. In Proceedings of the The 12th International Conference on Predictive Models and Data Analytics in Software Engineering (Ciudad Real, Spain) (PROMISE 2016) . Association for Computing Machinery, New York, NY, USA, Article 5, 10 pages. https://doi.org/ 10.1145/2972958.2972963 - · DOI
  21. [28][28] Paul W. Oman and Curtis R. Cook. 1990. A taxonomy for programming style (CSC '90) . Association for Computing Machinery, New York, NY, USA, 244-250. https://doi.org/10.1145/100348.100385 - · DOI
  22. [30][30] Adam Lerer et al. OpenAI, Aaron Hurst. 2024. GPT-4o System Card. arXiv:2410.21276 [cs.CL] https://arxiv.org/abs/2410.21276 - · arXiv
  23. [31][31] Terence Parr and Jurgen Vinju. 2016. Towards a universal code formatter through machine learning. In Proceedings of the 2016 ACM SIGPLAN International Conference on Software Language Engineering (Amsterdam, Netherlands) (SLE 2016) . Association for Computing Machinery, New York, NY, USA, 137-151. https://doi.org/10.1145/2997364.2997383 - · DOI
  24. [32][32] Mengnan Qi, Yufan Huang, Yongqiang Yao, Maoquan Wang, Bin Gu, and Neel Sundaresan. 2024. Is Next Token Prediction Sufficient for GPT? Exploration on Code Logic Comprehension. arXiv:2404.08885 [cs.PL] https://arxiv.org/abs/2404. 08885 - · arXiv
  25. [33][33] Md Rafiqul Islam Rabin, Aftab Hussain, and Mohammad Amin Alipour. 2022. Syntax-guided program reduction for understanding neural code intelligence models. In Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming (San Diego, CA, USA) (MAPS 2022) . Association for Computing Machinery, New York, NY, USA, 70-79. https://doi.org/10.1145/3520312. 3534869 - · DOI
  26. [34][34] Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural Machine Translation of Rare Words with Subword Units. arXiv:1508.07909 [cs.CL] https: //arxiv.org/abs/1508.07909 - · arXiv
  27. [35][35] Zhensu Sun, Xiaoning Du, Fu Song, Shangwen Wang, and Li Li. 2024. When neural code completion models size up the situation: Attaining cheaper and faster completion through dynamic model inference. In Proceedings of the IEEE/ACM 46th International Conference on Software Engineering . 1-12. -
  28. [36][36] Zhensu Sun, Xiaoning Du, Fu Song, Shangwen Wang, Mingze Ni, Li Li, and David Lo. 2025. Don't complete it! Preventing unhelpful code completion for productive and sustainable neural code completion systems. ACM Transactions on Software Engineering and Methodology 34, 1 (2025), 1-22. -
  29. [37][37] Zhensu Sun, Xiaoning Du, Zhou Yang, Li Li, and David Lo. 2024. Ai coders are among us: Rethinking programming language grammar towards efficient code generation. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis . 1124-1136. -
  30. [38][38] Sahil Suneja, Yunhui Zheng, Yufan Zhuang, Jim A. Laredo, and Alessandro Morari. 2021. Probing model signal-awareness via prediction-preserving input minimization. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Athens, Greece) (ESEC/FSE 2021) . Association for Computing Machinery, New York, NY, USA, 945-955. https://doi.org/10.1145/3468264.3468545 - · DOI
  31. [40][40] Yue Wang, Weishi Wang, Shafiq Joty, and Steven C.H. Hoi. 2021. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing , Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih (Eds.). Association for Computational Linguistics, Online and Punta Cana, Dominican Republic, 8696-8708. https://doi.org/10.18653/v1/2021.emnlp-main.685 - · DOI · Paper page
  32. [41][41] Yuxiang Wei, Zhe Wang, Jiawei Liu, Yifeng Ding, and Lingming Zhang. 2024. Magicoder: Empowering Code Generation with OSS-Instruct. arXiv:2312.02120 [cs.CL] https://arxiv.org/abs/2312.02120 - · arXiv
  33. [42][42] Zhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li, Yuqun Zhang, and Lingming Zhang. 2022. An extensive study on pre-trained models for program understanding and generation. In Proceedings of the 31st ACM SIGSOFT international symposium on software testing and analysis . 39-51. -
  34. [43][43] Zhaowei Zhang, Hongyu Zhang, Beijun Shen, and Xiaodong Gu. 2022. Diet code is healthy: simplifying programs for pre-trained models of code. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE '22) . ACM, 1073-1084. https://doi.org/10.1145/3540250.3549094 · DOI · Paper page

Authors
Pan, D., Sun, Z., Zhang, C., Lo, D., & Du, X.
Affiliations
  • Monash University (AU)
  • Singapore Management University (SG)
Venue
Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering
Publisher
ACM
Published
2026-04-12
Pages
2888-2899
ISSN
0270-5257 (ISSN-L)
OpenAlex
W4415238217
Cited by
0
References
0
FWCI
0.00
Type
conference paper
Language
en
Open access
Locations
  • ACM/IEEE International Conference on Software Engineering: Companion Proceedings (ICSE-Companion) (publishedVersion, cc-by)
  • arXiv (Cornell University) (submittedVersion)
  • arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Computer Science Applications › Teaching and Learning Programming
Keywords
code formatting, code readability, large language models, token cost, token reduction, prompt optimization, fine-tuning, programming languages

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review