Two-dimensional early exit optimisation of LLM inference

Jan Hůla, David Adamczyk, Tomáš Filip, Martin Pavlíček, Petr Sosík
3/27/2026
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

We introduce a two-dimensional (2D) early exit strategy that coordinates layer-wise and sentence-wise exiting for classification tasks in large language models. By processing input incrementally sentence-by-sentence while progressively activating deeper layers, our method achieves multiplicative computational savings that exceed those from optimizing either dimension independently.

Show full abstract

Experimental evaluation across four state-of-the-art LLMs (Llama 3.1, Llama 3.2, Gemma, Qwen; 3B-8B parameters) on three sentiment classification datasets demonstrates additional speed-ups of 1.4--2.3$\times$ over optimal layer-wise early exit for simpler tasks with vanilla models, with graceful degradation on complex multi-class problems. Fine-tuning reduces but does not eliminate this advantage. The approach is model-agnostic, requires only lightweight classification adapters, and is orthogonal to complementary efficiency methods such as quantization and pruning. Our findings indicate that 2D early exit strategies excel when semantic information accumulates predictably across input structure, suggesting possible applicability to sequence-processing tasks beyond sentiment classification.

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. Any repos shown below are weak matches — 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{hla2026twodimensional,
  title  = {Two-dimensional early exit optimisation of LLM inference},
  author = {Jan Hůla and David Adamczyk and Tomáš Filip and Martin Pavlíček and Petr Sosík},
  year   = {2026},
  eprint = {2604.18592},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.18592v1}
}

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/2604.18592.svg)](https://codeofpaper.com/paper/2604.18592)

Discussion