mlsanityData to 14 Oct 2026

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

arXiv 2508.13666 ↗First posted 19 Aug 2025cs.SE cs.AIcited by 12

On the map: Efficient LLM inference and serving → Efficient reasoning and agent inference

Abstract (arXiv)

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.

Key facts. Cited by 12 papers in the map (data through 14 Oct 2026). Placed in Efficient reasoning and agent inference, one of 12 directions in Efficient LLM inference and serving. Builds on 18 of its 38 references that are in the map. First posted on arXiv 19 Aug 2025.

Builds on

18 of 38 references.

References · 18

  1. 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,418
  2. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
  3. 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
  4. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  5. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  6. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  7. 2023Think before you speak: Training Language Models With Pause Tokenscited by 264
  8. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
  9. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  10. 2022Diet Code Is Healthy: Simplifying Programs for Pre-trained Models of Codecited by 24
  11. 2020Probing Model Signal-Awareness via Prediction-Preserving Input Minimizationcited by 14
  12. 2022Don't Complete It! Preventing Unhelpful Code Completion for Productive and Sustainable Neural Code Completion Systemscited by 13
6 more
  1. 2024When Neural Code Completion Models Size up the Situation: Attaining Cheaper and Faster Completion through Dynamic Model Inferencecited by 10
  2. 2024AI Coders Are Among Us: Rethinking Programming Language Grammar Towards Efficient Code Generationcited by 10
  3. 2024Comparing large language models and human programmers for generating programming codecited by 9
  4. 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Modelscited by 7
  5. 2019STYLE-ANALYZER: fixing code style inconsistencies with interpretable unsupervised algorithmscited by 6
  6. 2024Is Next Token Prediction Sufficient for GPT? Exploration on Code Logic Comprehensioncited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 2; 2026: 10.

12 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025code_transformed: The Influence of Large Language Models on Code
  2. 2025Measuring how changes in code readability attributes affect code quality evaluation by Large Language Models
  3. 2024Does Prompt Formatting Have Any Impact on LLM Performance?
  4. 2025A Study of LLMs' Preferences for Libraries and Programming Languages
  5. 2026Compressed code: the hidden effects of quantization and distillation on programming tokens
  6. 2026PromptResponse: Optimizing Prompts for LLM Coding Tasks
  7. 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation
  8. 2025Human-Aligned Code Readability Assessment with Large Language Models ↗