nielsr HF Staff commited on
Commit
263e8ba
·
verified ·
1 Parent(s): 4aea6d2

Add model card for PyRAG

Browse files

Hi! I'm Niels from the Hugging Face community science team. I noticed this model repository was missing a model card, so I've created one to document the framework and improve discoverability.

In this PR, I:
- Added metadata for `library_name: transformers` and `pipeline_tag: text-generation`.
- Linked the model to its research paper: [Retrieval is Cheap, Show Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation](https://arxiv.org/abs/2605.12975).
- Included links to the official GitHub repository and project page.
- Added a sample usage snippet based on the framework's documentation.
- Included the citation information.

Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: text-generation
4
+ ---
5
+
6
+ # PyRAG-7b
7
+
8
+ **PyRAG** is a framework that reformulates multi-hop Retrieval-Augmented Generation (RAG) as **program synthesis and execution**. Instead of representing reasoning as free-form natural language, PyRAG decomposes a question into atomic sub-queries, synthesizes an executable Python program over tool primitives — `retrieve(query)` and `answer(query, docs)` — and runs the program step-by-step in a Python interpreter.
9
+
10
+ This repository contains the 7B parameter model checkpoint presented in the paper [Retrieval is Cheap, Show Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation](https://arxiv.org/abs/2605.12975).
11
+
12
+ ## Resources
13
+ - **Paper:** [https://arxiv.org/abs/2605.12975](https://arxiv.org/abs/2605.12975)
14
+ - **GitHub Repository:** [https://github.com/GasolSun36/PyRAG](https://github.com/GasolSun36/PyRAG)
15
+ - **Project Page:** [https://gasolsun36.github.io/PyRAG/](https://gasolsun36.github.io/PyRAG/)
16
+
17
+ ## Sample Usage
18
+
19
+ You can use PyRAG as a library by following the installation instructions in the [official repository](https://github.com/GasolSun36/PyRAG). Below is the programmatic usage example:
20
+
21
+ ```python
22
+ from pyrag import (
23
+ HttpRetrievalAgent,
24
+ OpenAILLM,
25
+ RAGProgramRunner,
26
+ env_enable_thinking,
27
+ )
28
+
29
+ instruct_llm = OpenAILLM(
30
+ model="Qwen/Qwen2.5-7B-Instruct",
31
+ base_url="http://127.0.0.1:8337/v1",
32
+ enable_thinking=env_enable_thinking(),
33
+ )
34
+ plan_llm = OpenAILLM(
35
+ model="Qwen/Qwen2.5-Coder-7B-Instruct",
36
+ base_url="http://127.0.0.1:8336/v1",
37
+ enable_thinking=env_enable_thinking(),
38
+ )
39
+ retrieval_agent = HttpRetrievalAgent(host="127.0.0.1", port=8008)
40
+
41
+ runner = RAGProgramRunner(
42
+ llm=instruct_llm,
43
+ plan_llm=plan_llm,
44
+ retrieval_agent=retrieval_agent,
45
+ )
46
+
47
+ result = runner.run(
48
+ "How old was Virginia Bruce when she starred in Let Freedom Ring?",
49
+ topk=5,
50
+ )
51
+
52
+ print(result["final_answer"]) # → 29
53
+ print(result["sub_queries"]) # decomposed atomic queries
54
+ print(result["generated_code"]) # the synthesized Python program
55
+ print(result["execution_log"]) # full step-by-step trace
56
+ print(result["retried_with_topk10"]) # whether adaptive retrieval triggered
57
+ ```
58
+
59
+ ## Citation
60
+
61
+ ```bibtex
62
+ @misc{sun2026retrievalcheapcodeexecutable,
63
+ title={Retrieval is Cheap, Show Me the Code: Executable Multi-Hop Reasoning for Retrieval-Augmented Generation},
64
+ author={Jiashuo Sun and Jimeng Shi and Yixuan Xie and Saizhuo Wang and Jash Rajesh Parekh and Pengcheng Jiang and Zhiyi Shi and Jiajun Fan and Qinglong Zheng and Peiran Li and Shaowen Wang and Ge Liu and Jiawei Han},
65
+ year={2026},
66
+ eprint={2605.12975},
67
+ archivePrefix={arXiv},
68
+ primaryClass={cs.AI},
69
+ url={https://arxiv.org/abs/2605.12975},
70
+ }
71
+ ```