ARTFEED — Contemporary Art Intelligence

PyRAG: Multi-Hop RAG as Executable Code

other · 2026-05-14

A new framework called PyRAG reformulates multi-hop retrieval-augmented generation (RAG) as program synthesis and execution. The approach addresses brittleness in existing RAG systems on multi-hop questions by representing reasoning steps as executable code rather than free-form natural language. This method leverages code-specialized language models to produce structured, verifiable reasoning trajectories, reducing query drift and improving error detection. The paper is published on arXiv under ID 2605.12975.

Key facts

  • PyRAG reformulates multi-hop RAG as program synthesis and execution.
  • Existing RAG systems are brittle on multi-hop questions.
  • Current methods use free-form natural language for reasoning.
  • Free-form reasoning leads to implicit intermediate states and query drift.
  • Self-reflection is unreliable when done by the same model.
  • Multi-hop QA is a form of step-by-step computation.
  • Code-specialized LMs are trained to operate on structured processes.
  • The paper is on arXiv with ID 2605.12975.

Entities

Institutions

  • arXiv

Sources