Executing as You Generate: Hiding Execution Latency in LLM Code Generation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Sun, Zhensu, Lin, Zhihao, Chen, Zhi, Yang, Chengran, Zhou, Mingyi, Li, Li, Lo, David
Format: Preprint
Publié: 2026
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866910093024428032
author Sun, Zhensu
Lin, Zhihao
Chen, Zhi
Yang, Chengran
Zhou, Mingyi
Li, Li
Lo, David
author_facet Sun, Zhensu
Lin, Zhihao
Chen, Zhi
Yang, Chengran
Zhou, Mingyi
Li, Li
Lo, David
contents Current LLM-based coding agents follow a serial execution paradigm: the model first generates the complete code, then invokes an interpreter to execute it. This sequential workflow leaves the executor idle during generation and the generator idle during execution, resulting in unnecessary end-to-end latency. We observe that, unlike human developers, LLMs produce code tokens sequentially without revision, making it possible to execute code as it is being generated. We formalize this parallel execution paradigm, modeling it as a three-stage pipeline of generation, detection, and execution, and derive closed-form latency bounds that characterize its speedup potential and operating regimes. We then present Eager, a concrete implementation featuring AST-based chunking, dynamic batching with gated execution, and early error interruption. We evaluate Eager across four benchmarks, seven LLMs, and three execution environments. Results show that Eager reduces the non-overlapped execution latency by up to 99.9% and the end-to-end latency by up to 55% across seven LLMs and four benchmarks.
format Preprint
id arxiv_https___arxiv_org_abs_2604_00491
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Executing as You Generate: Hiding Execution Latency in LLM Code Generation
Sun, Zhensu
Lin, Zhihao
Chen, Zhi
Yang, Chengran
Zhou, Mingyi
Li, Li
Lo, David
Programming Languages
Artificial Intelligence
Software Engineering
Current LLM-based coding agents follow a serial execution paradigm: the model first generates the complete code, then invokes an interpreter to execute it. This sequential workflow leaves the executor idle during generation and the generator idle during execution, resulting in unnecessary end-to-end latency. We observe that, unlike human developers, LLMs produce code tokens sequentially without revision, making it possible to execute code as it is being generated. We formalize this parallel execution paradigm, modeling it as a three-stage pipeline of generation, detection, and execution, and derive closed-form latency bounds that characterize its speedup potential and operating regimes. We then present Eager, a concrete implementation featuring AST-based chunking, dynamic batching with gated execution, and early error interruption. We evaluate Eager across four benchmarks, seven LLMs, and three execution environments. Results show that Eager reduces the non-overlapped execution latency by up to 99.9% and the end-to-end latency by up to 55% across seven LLMs and four benchmarks.
title Executing as You Generate: Hiding Execution Latency in LLM Code Generation
topic Programming Languages
Artificial Intelligence
Software Engineering
url https://arxiv.org/abs/2604.00491