생성과 동시에 실행하기: LLM 코드 생성에서 실행 지연 시간 숨기기
Executing as You Generate: Hiding Execution Latency in LLM Code Generation
April 1, 2026
저자: Zhensu Sun, Zhihao Lin, Zhi Chen, Chengran Yang, Mingyi Zhou, Li Li, David Lo
cs.AI
초록
현재 LLM 기반 코딩 에이전트는 직렬 실행 패러다임을 따릅니다: 모델이 먼저 전체 코드를 생성한 후 인터프리터를 호출하여 실행합니다. 이러한 순차적 워크플로는 생성 중에는 실행기가 유휴 상태가 되고 실행 중에는 생성기가 유휴 상태가 되어 불필요한 종단 간 지연 시간을 초래합니다. 우리는 인간 개발자와 달리 LLM이 수정 없이 순차적으로 코드 토큰을 생성하므로 코드 생성 중에 실행이 가능하다는 점을 관찰했습니다. 우리는 이러한 병렬 실행 패러다임을 공식화하여 생성, 탐지, 실행의 3단계 파이프라인으로 모델링하고, 속도 향상 잠재력과 운영 영역을 규정하는 폐쇄형 지연 시간 한계를 도출합니다. 그런 다음 AST 기반 청킹, 게이트 실행을 통한 동적 배칭, 조기 오류 중단 기능을 갖춘 구체적인 구현체인 Eager를 제시합니다. 우리는 4개의 벤치마크, 7개의 LLM, 3개의 실행 환경에서 Eager를 평가합니다. 결과에 따르면 Eager는 7개의 LLM과 4개의 벤치마크 전반에서 비중첩 실행 지연 시간을 최대 99.9%, 종단 간 지연 시간을 최대 55%까지 감소시킵니다.
English
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.