Retrieval is Cheap, Show Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation
Published in arXiv preprint, 2026
Recommended citation: Jiashuo Sun*, Jimeng Shi*, Yixuan Xie, Saizhuo Wang, Jash Rajesh Parekh, Pengcheng Jiang, Zhiyi Shi, Jiajun Fan, Qinglong Zheng, Peiran Li, Shaowen Wang, Ge Liu, Jiawei Han. "Retrieval is Cheap, Show Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation." arXiv preprint arXiv:2605.12975, 2026. https://arxiv.org/abs/2605.12975
PyRAG recasts multi-hop retrieval-augmented generation as program synthesis and execution. Rather than a free-form reasoning trace, the model emits an executable Python program over retrieval and QA tools: intermediate states become named variables, the interpreter supplies deterministic feedback instead of ungrounded self-reflection, and the whole chain stays inspectable. That formulation buys compiler-grounded self-repair and execution-driven adaptive retrieval with no extra training. Across PopQA, HotpotQA, 2WikiMultihopQA, MuSiQue and Bamboogle it beats strong baselines in both training-free and RL-trained settings, with the widest margins on compositional multi-hop questions.
