arXiv:2610.30664cs.CLOct 2026

Manuscript Offprint

arXiv:2610.30664

Compiling Autoregressive LLM Control into Policy-Exact Parallel Inference for Hierarchical RAG

Zehao Lin, Qianfeng Shen, Xixuan Hao, Shaobo Cui, Chunyu Li, Kai Chen, Bo Tang, Zhenjun Wang, Jin Yan, Zhiyu Li, Feiyu Xiong

ABSTRACT

Large language models increasingly act as controllers in structured decision pipelines, yet their decisions are still executed by autoregressive text decoding. Hierarchical RAG is one such setting: at each frontier of a document tree, an LLM commits to b of k sections under an input-dependent action grammar, executed as either failure-prone free-form JSON or reliable but strictly serial grammar-constrained generation. We show that this serialization is unnecessary for bounded-horizon control: the reachable future forms a shallow action-prefix tree, which we compile — one root prefill plus one tree-causal probe evaluate every prefix-conditioned action distribution with serial decoding's tokens, positions, and causal ancestry. A prefix-state lemma makes compiled control policy-exact in exact arithmetic: the same policy with a two-forward critical path and zero output tokens. One further probe pass certifies the exact order-marginalized MAP set. Across four document-disjoint splits and two scales on the primary MetaX device, compiled control matches the serial policy on 84–89% of questions — every instrumented divergence a floating-point near-tie — and cuts control latency by 35–47% versus token-wise serial decoding and 6–7% versus an idealized chunked engine; an H800 repetition preserves the ordering.

Index Terms— retrieval-augmented generation, constrained decoding, parallel inference, LLM control, tree attention

1. INTRODUCTION

Hierarchical retrieval [1, 2, 3, 4] turns evidence gathering into sequential control: an LLM repeatedly selects bb of k≤20k \leq 20 candidate sections and descends into the selected subtrees. The action space is finite and input-dependent, yet deployed systems execute this controller by decoding text. That choice imposes a three-way dilemma. Free-form JSON leaves a protocol surface that dominates the error budget (3–65% of questions fail on syntax, identifiers, or cardinality in our companion interface study). Scoring all kk verified single-token labels in one prefill — the unary shortcut — removes the protocol surface but also the controller's memory: selection can no longer condition on earlier selections. Grammar-constrained decoding [5, 6] keeps the history-dependent policy and syntactic validity, but pays a serial critical path of bb action tokens plus forced syntax tokens, one model forward each.

Our central observation is that this dilemma is an artifact of the execution model, not of the controller. A constrained controller with horizon b has a bounded reachable future: every state it can visit is a prefix over at most b distinct actions — for greedy control at our deployed horizon of three actions, at most k states remain once the first is fixed. We therefore compile the action grammar into its prefix tree and evaluate all reachable states at once: one root prefill resolves the first action; one tree-causal probe — a single forward pass over the concatenated prefix continuations, with a block-causal mask and serial position indices — returns every prefix-conditioned action distribution the controller can consult. Because each tree state sees exactly the tokens, positions, and causal ancestry it would see under serial decoding, its logits are the serial controller's logits, and the greedy chain is recovered arithmetically. We do not approximate or distill the serial controller; we recompute it on a shallower execution graph (finite precision can still flip near ties; Sec. 4.1). The critical path drops from b+msynb + m_{syn} dependent forwards to two, independent of b; no token is ever generated; the protocol surface is zero by construction.

Compilation also upgrades what the controller can decide. The probe exposes the controller's joint preferences, so unordered multi-action selection becomes exact posterior inference rather than a serialization artifact: we marginalize action order and certify the MAP set with a branch-and-bound certificate — no truncation heuristics. And the probe compares the two policies: the AR-vs-unary KL divergence bounds — via Pinsker — the expected-utility loss of the unary shortcut per input. The construction applies to any finite-action constrained LLM controller (tool choice, routing, agenda selection); hierarchical RAG is our case study.

Contributions. (1) Finite-action control compilation: constrained controllers executed as one root prefill plus one tree-causal probe, zero decoded tokens (Sec. 3.2). (2) Policy-exactness theory: prefix-state equivalence and policy equivalence under matched tokens, positions, masks, and tie-breaking, with serial depth exchanged for bounded parallel width (Sec. 3.3). (3) Certified set inference and interaction mass: an order-marginalized set posterior with a branch-and-bound MAP certificate, and a bound on the expected cost of unary execution (Sec. 3.4). (4) Evaluation: four document-disjoint splits, two scales, two accelerators, and a hierarchy-corruption stress test — policy fidelity, 100% certification in non-trivial rounds, and 35–47% lower control latency (Sec. 4).

References (25)