Table of Contents
Fetching ...

Compressed code: the hidden effects of quantization and distillation on programming tokens

Viacheslav Siniaev, Iaroslav Chelombitko, Aleksey Komissarov

TL;DR

This study addresses how programming languages are represented in LLM tokenizers and how compression techniques—quantization, distillation, and model scaling—alter token-level coding behavior. It introduces a cold-start probability framework (PKP, STP, KAP, NLP) to evaluate coding abilities without prompts and analyzes keyword coverage, token ranking, and language-marker representation across multiple tokenizers. The findings reveal that code-specialized models do not exhibit fundamentally different token distributions from general models, yet compression can produce non-linear shifts in keyword and special-token probabilities, with distillation tending to reduce semantic tokens while increasing structural tokens. The work provides empirical guidelines for maintaining code-generation quality under resource constraints and offers a practical framework for assessing token-level impacts of model optimization in production environments.

Abstract

Large Language Models (LLMs) have demonstrated exceptional code generation capabilities, yet their token-level mechanisms remain underexplored, particularly in compressed models. Through systematic analysis of programming language token representations, we characterize how programming languages are encoded in LLM tokenizers by analyzing their vocabulary distribution and keyword coverage patterns. We introduce a novel cold-start probability analysis method that provides insights into model behavior without requiring explicit prompts. Additionally, we present a comprehensive evaluation of how different model optimization techniques - including quantization, distillation, model scaling, and task-specific fine-tuning - affect token-level representations and code generation quality. Our experiments, supported by comprehensive probability distribution analysis and evaluation metrics, reveal critical insights into token-level behavior and provide empirically-validated guidelines for maintaining code generation quality under various optimization constraints. These findings advance both theoretical understanding of LLM code generation and practical implementation of optimized models in production environments.

Compressed code: the hidden effects of quantization and distillation on programming tokens

TL;DR

This study addresses how programming languages are represented in LLM tokenizers and how compression techniques—quantization, distillation, and model scaling—alter token-level coding behavior. It introduces a cold-start probability framework (PKP, STP, KAP, NLP) to evaluate coding abilities without prompts and analyzes keyword coverage, token ranking, and language-marker representation across multiple tokenizers. The findings reveal that code-specialized models do not exhibit fundamentally different token distributions from general models, yet compression can produce non-linear shifts in keyword and special-token probabilities, with distillation tending to reduce semantic tokens while increasing structural tokens. The work provides empirical guidelines for maintaining code-generation quality under resource constraints and offers a practical framework for assessing token-level impacts of model optimization in production environments.

Abstract

Large Language Models (LLMs) have demonstrated exceptional code generation capabilities, yet their token-level mechanisms remain underexplored, particularly in compressed models. Through systematic analysis of programming language token representations, we characterize how programming languages are encoded in LLM tokenizers by analyzing their vocabulary distribution and keyword coverage patterns. We introduce a novel cold-start probability analysis method that provides insights into model behavior without requiring explicit prompts. Additionally, we present a comprehensive evaluation of how different model optimization techniques - including quantization, distillation, model scaling, and task-specific fine-tuning - affect token-level representations and code generation quality. Our experiments, supported by comprehensive probability distribution analysis and evaluation metrics, reveal critical insights into token-level behavior and provide empirically-validated guidelines for maintaining code generation quality under various optimization constraints. These findings advance both theoretical understanding of LLM code generation and practical implementation of optimized models in production environments.
Paper Structure (24 sections, 1 figure, 5 tables)

This paper contains 24 sections, 1 figure, 5 tables.

Figures (1)

  • Figure 1: Pipeline for analyzing programming language tokens in LLM tokenizers across three major models (DeepSeek-R1/V3, Qwen2.5, and Llama 3.1). The process analyzes vocabulary composition (128K-151K tokens), examines keyword representation across 12 programming languages (276 unique keywords), and categorizes tokens by frequency to assess language coverage.