Analysis updated 2026-05-18
Answer complex questions that require combining facts from multiple documents.
Turn AI reasoning into inspectable, executable Python code instead of free-form text.
Automatically retry a retrieval step when an intermediate answer comes back unknown.
Train a reinforcement-learning variant of the framework for better multi-hop answering.
| gasolsun36/pyrag | alex72-py/aria-termux | anime0t4ku/gentleman | |
|---|---|---|---|
| Stars | 20 | 20 | 20 |
| Language | Python | Python | Python |
| Setup difficulty | hard | moderate | moderate |
| Complexity | 5/5 | 2/5 | 2/5 |
| Audience | researcher | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Requires separate vLLM and retrieval servers, and the RL variant needs multiple A100 GPUs.
PyRAG is a research framework for answering complex questions that require combining information from multiple sources, a task called multi-hop question answering. Rather than relying on an AI model to reason through these questions in free-form text (which is hard to inspect or debug), PyRAG converts the problem into executable Python code that a real Python interpreter runs step by step. Here is how it works in practice: given a question like "Who is older, Jed Hoyer or John William Henry II?", PyRAG first breaks it into simpler sub-questions, then generates a short Python program that calls two tools, retrieve() (which searches a document database for relevant passages) and answer() (which uses an AI model to answer a question given those passages). The program is executed, and each intermediate result becomes an explicit variable you can inspect. If the program crashes with a Python error, that error message is fed back to the planning AI as precise, structured feedback for repair, which is more reliable than asking the AI to guess what went wrong. If an intermediate answer comes back as "unknown", the system automatically re-runs that retrieval step with more documents. The framework comes in two variants: a training-free version using off-the-shelf models, and a fine-tuned version (PyRAG-RL) trained with reinforcement learning using a method called GRPO. It requires running separate servers for the AI models (using vLLM, a fast model-serving tool) and a document retrieval service. The authors recommend hardware like 8 A100 GPUs for the reinforcement learning variant. The framework targets AI researchers working on question-answering systems, not general developers. The full README is longer than what was provided.
A research framework that answers multi-step questions by generating executable Python code instead of free-form AI reasoning.
Mainly Python. The stack also includes Python, vLLM, GRPO.
Setup difficulty is rated hard, with roughly 1day+ to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Verify against the repo before relying on details.