PatternBloom: Empowering Agentic RAG with Externalized RL-Distilled Graph Patterns
Organizations: Department of Computer Science, University of Maryland, College Park
Abstract
Reinforcement-learning-trained agents for retrieval-augmented generation retrieve content (passages, knowledge-graph fragments, or hyperedges) and supervise training with outcome rewards on the final answer. Across these paradigms the reasoning route through retrieved content never leaves the language model's hidden state, conflating declarative knowledge with the procedural knowledge that recurs across queries of the same logical type; content-only methods consequently plateau as reasoning depth grows. We introduce PatternBloom, an agentic RAG framework that shifts the unit of retrieval from content (what to read) to logic (how to reason). A first RL stage scores the agent's constructed evidence graph by a frozen oracle's information gain through the Information-Density Reward (IDR), a size-normalized mutual-information surrogate. High-reward trajectories are distilled into a Graph Pattern Memory (GPM) of type-abstracted reasoning skeletons, and a second RL stage uses the Pattern-Augmented Reward (PAR) to couple policy to memory, turning procedural reasoning into a learnable, externalized structural prior. A 7B PatternBloom outperforms baselines by Avg-OOD EM, with the gain compounding with reasoning depth precisely because procedural knowledge, once distilled, is reused rather than re-derived at every query. We release our code at https://github.com/EllenYiGe/PatternBloom.
Figures & tables
| Multi-Hop QA | Single-Hop QA | Avg-IID | Avg-OOD | |||||||||||||||||
| 2Wiki IID | HotpotQA IID | MuSiQue OOD | Bamboogle OOD | NQ OOD | TriviaQA OOD | PopQA OOD | ||||||||||||||
| Method | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | CA | EM | F1 | CA |
| Vanilla inference-only Baselines (w/ Qwen2.5-7B-Instruct) | ||||||||||||||||||||
| Direct (no retrieval) | 21.7 | 27.7 | 14.2 | 22.8 | 2.8 | 9.4 | 4.0 | 14.4 | 4.6 | 13.7 | 28.0 | 38.5 | 9.2 | 14.4 | 18.0 | 25.3 | 25.8 | 9.7 | 18.1 | 22.2 |
| Naive RAG (E5 chunk top-5) | 29.7 | 39.5 | 24.3 | 34.9 | 3.7 | 10.5 | 12.0 | 20.2 | 10.9 | 22.7 | 43.8 | 55.3 | 28.0 | 37.4 | 27.0 | 37.2 | 44.0 | 19.7 | 29.2 | 41.6 |
| Prompt-Engineered RAG | ||||||||||||||||||||
| Variant | IDR | PAR | GPM | HotpotQA | 2Wiki | MuSiQue | Bam. | Avg-F 1 | Avg-EM | Sch. |
| (a) Module on/off | ||||||||||
| PatternBloom | ✓ | ✓ | ✓ | 55.6 | 58.6 | 48.0 | 61.2 | 55.9 | 46.6 | 4.7 |
| Stage I | ✗ | ✓ | ✓ | 54.9 | 54.4 | 41.3 | 60.9 | 52.9 3.0 | 42.5 4.1 | 4.2 |
| Stage II | ✓ | ✗ | ✓ | 41.7 | 41.7 | 26.9 | 66.0 | 44.1 11.8 | 34.9 11.7 | 4.7 |
| GPM | ✓ | ✓ | ✗ | 44.8 | 44.6 | 28.2 | 68.8 | 46.6 9.3 | 37.0 9.6 | 5.9 1.2 |
| (b) Reward shaping weight in PAR | ||||||||||
| Method | RPF | P-Cov |
|---|---|---|
| PatternBloom | 0.886 | 0.051 |
| Stage I | 0.231 | 0.025 |
| Stage II | 0.414 | 0.044 |
| Method | Bridge | Comp. | 1-hop | Multi-3 |
|---|---|---|---|---|
| Graph-R1 | 5.4 | 5.3 | 4.9 | 5.8 |
| PatternBloom | 4.7 | 4.9 | 4.2 | 4.9 |
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Type | Detection rule | Example |
|---|---|---|
| EMPTY | empty or whitespace-only string | "" |
| YEAR | ^\d{4}$ | 1989 |
| DATE | ^\d{1,2}[/-]\d{1,2}[/-]\d{2,4}$ | 18-March-1965 |
| NUMBER | ^-?\d+(.\d+)?$ , not matching YEAR / DATE | 42.7 |
| BOOLEAN | case-folded match in {true, false, yes, no} | Yes |
| ENTITY | all other non-empty strings | Leslie H. Martinson |
| Metric (abbrev.) | What it measures | Better | Reported in |
| EM, F1, CA | Answer correctness (exact / token-overlap / lenient match) | Tab. 1 , 14 | |
| R@5, EvR | Top- recall, evidence recall on gold supporting facts | Tab. 15 , 8 | |
| RPF, P-Cov | Pattern-trajectory faithfulness (PB-novel) | Tab. 3 | |
| Index Tok | One-time corpus-indexing LLM tokens (M) | Tab. 8 | |
| #Turns | Average number of retrieval calls per query | Tab. 4 , 14 , 13 | |
| 6-axis LLM judge | Sonnet/Haiku/Gemini ensemble Likert ( – ) agreement | Tab. 17 |
| Offline (one-time, cached) | Online (per-query) |
|---|---|
| Chunking | Query embedding (BGE-large) |
| LLM entity/relation extraction ( gpt-4o-mini ) | FAISS top- hyperedge retrieval |
| Hyperedge construction | Signature extraction |
| BGE-large embedding of | FAISS top- pattern lookup in |
| FAISS index over | Multi-turn agent rollout |
| Stage I RL training (Oracle in the loop) | — |
| Method | Retrieval Paradigm | Index Tok (M) | R@5 | EvR |
|---|---|---|---|---|
| Knowledge-graph construction (LLM-extracted) | ||||
| GFM-RAG | KG triple + GNN reasoning | 4.0 | 81.3 | 68.0 |
| LightRAG | KG dual-level (low+high) | 86.7 | – | – |
| Adaptive structure (per-query) | ||||
| StructRAG | adaptive structure | 67.9 | 40.0 | |
| PatternBloom (ours) | ||||
| Method | LC | Comp. | Faith. | Reuse | Avg | |
|---|---|---|---|---|---|---|
| R1-Searcher | 3.95 | 3.80 | 3.90 | 3.75 | 3.85 | 0.66 |
| Graph-R1 | 3.85 | 3.70 | 3.95 | 3.20 | 3.68 | 0.63 |
| Structure-R1 | 4.10 | 3.95 | 4.05 | 3.85 | 3.99 | 0.67 |
| PatternBloom | 4.65 | 4.55 | 4.50 | 4.70 | 4.60 0.85 | 0.74 |
| Sample from 2WikiMultiHopQA |
| Question: Which film has the director who was born later, The Silver Treasure or Taxi To Paradise ? Ground Truth: Taxi To Paradise |
| PatternBloom (Q2.5-7B) |
| Retrieved pattern from via compare(by[birth_year])[FILM] : |
| Turn 1. <query>director of The Silver Treasure</query> Rowland V. Lee ; <graph>The Silver Treasure | directed_by | Rowland V. Lee</graph> Turn 2. <query>director of Taxi To Paradise</query> Adrian Brunel ; <graph>Taxi To Paradise | directed_by | Adrian Brunel</graph> Turn 3. <query>Rowland V. Lee born in year</query> 1891 ; <graph>Rowland V. Lee | born_in_year | 1891</graph> Turn 4. <query>Adrian Brunel born in year</query> 1892 ; <graph>Adrian Brunel | born_in_year | 1892</graph> Turn 5. <think>Brunel (1892) is later than Lee (1891), so Taxi To Paradise.</think> <answer>Taxi To Paradise</answer> |
| Sample from MuSiQue |
| Question: What country was the director of Black Gold (1962) from? Ground Truth: United States |
| PatternBloom (Q2.5-7B) |
| Retrieved pattern from via lookup_chain(person)[COUNTRY] : |
| Turn 1. <query>director of Black Gold 1962</query> Leslie H. Martinson ; <graph>Black Gold (1962) | directed_by | Leslie H. Martinson</graph> Turn 2. <query>Leslie H. Martinson nationality</query> American ; <graph>Leslie H. Martinson | nationality | United States</graph> Turn 3. <think>The director is American, so the country is the United States.</think> <answer>United States</answer> |
| R1-Searcher (Q2.5-7B) |
| Turn 1. <query>Black Gold 1962 country</query> retrieves chunks about a 2011 film of the same name. Turn 2. <query>Black Gold 1962 director origin</query> retrieves a Texas-oil-history chunk that does not mention the director. Turn 3. <think>The film is set in Texas, so probably the United States.</think> <answer>United States</answer> ( correct, but reached via a fragile keyword path; R1-Searcher fails when the same chain query is rephrased with a less common film ) Counter-example: For “What country was the director of Vesna na Zarechnoy Ulitse from?” , R1-Searcher’s keyword path returns a Soviet-cinema retrospective chunk that lists the city but not the director’s nationality, and the model confidently emits the wrong country. PatternBloom traverses the same chain skeleton and returns the correct Russia . |
| Sample from Bamboogle |
| Question: Who was the commander for the space mission that had the first spacewalk? Ground Truth: Pavel Belyayev |
| PatternBloom (Q2.5-7B) |
| Retrieved pattern from via compare(by[date])[ENTITY] (top-1 similarity , distilled from a HotpotQA training trajectory and re-used here on Bamboogle): |
| Turn 1. <query>space mission with the first spacewalk</query> retrieves several mission summaries, including Voskhod 2 , Apollo 17 , and Gemini 4 . Turn 2. <think>The first spacewalk was during the Voskhod 2 mission on 8 March 1965.</think> <query>Voskhod 2 mission</query> launched with Belyayev and Leonov on board on 18 March 1965 . Turn 3. <query>commander of the Voskhod 2 mission</query> Pavel Belyayev was the first commander of the cosmonaut corps . Turn 4. <think>The knowledge clearly states that Pavel Belyayev was the commander of the Voskhod 2 mission.</think> <graph>Pavel Belyayev | commander_of | Voskhod 2</graph> <answer>Pavel Belyayev</answer> ( ) |
| # gold facts | # queries | Search-R1 | R1-Searcher | Graph-R1 | Search-R1 (Q3) | PatternBloom | PatternBloom turns |
|---|---|---|---|---|---|---|---|
| 2 hops | 425 | 21.0 | 20.3 | 6.6 | 17.1 | 52.6 32.3 | 2.4 |
| 3 hops | 312 | 6.4 | 17.0 | 4.4 | 13.1 | 34.0 17.0 | 3.1 |
| 4 hops | 178 | 2.8 | 8.6 | 1.8 | 6.2 | 24.5 15.9 | 4.2 |
| 5 hops | 85 | 1.1 | 3.9 | 1.5 | 2.8 | 17.4 13.5 | 5.5 |
| MuSiQue (overall, ) | 1,000 | 11.5 | 15.8 | 4.6 | 12.7 | 38.8 23.0 | 3.2 |
| Bridge | Comparison | Single-hop | Multi-3 | Cat-Avg | DS-Avg | #Turns per category | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | EM | F1 | Bri. | Cmp. | Sng. | M3 |
| R1-Searcher | 39.5 | 49.4 | 44.8 | 50.2 | 41.0 | 49.4 | 22.9 | 31.5 | 37.1 | 45.1 | 34.1 | 42.3 | 3.9 | 4.6 | 4.5 | 4.6 |
| Graph-R1 | 15.6 | 22.7 | 36.5 | 40.7 | 24.6 | 31.6 | 10.1 | 17.3 | 21.7 | 28.1 | 21.7 | 29.2 | 5.4 | 5.3 | 4.9 | 5.8 |
| PatternBloom | 40.6 | 51.2 | 61.7 | 67.8 | 49.5 | 59.3 | 44.8 | 54.2 | 49.2 | 58.1 | 48.6 | 58.0 | 4.7 | 4.9 | 4.2 | 4.9 |
| HotpotQA | 2WikiMHQA | MuSiQue | Bamboogle | Avg | ||||||
| Method | R@5 | EvR | R@5 | EvR | R@5 | EvR | R@5 | EvR | R@5 | EvR |
| HippoRAG 2 | 80.5 | 67.2 | 78.4 | 65.8 | 73.2 | 60.5 | 80.0 | 67.0 | 78.0 | 65.1 |
| GFM-RAG | 83.6 | 70.5 | 82.0 | 68.7 | 76.4 | 63.8 | 83.2 | 69.2 | 81.3 | 68.0 |
| LinearRAG | 76.8 | 62.0 | 74.5 | 60.3 | 70.0 | 56.4 | 76.0 | 61.5 | 74.3 | 60.0 |
| Search-R1 | 73.2 | 58.4 | 71.6 | 56.7 | 65.0 | 51.0 | 70.5 | 56.0 | 70.1 | 55.5 |
| R1-Searcher | 78.0 | 63.5 | 76.4 | 61.8 | 70.2 | 55.6 | 75.5 | 60.5 | 75.0 | 60.4 |
| Quantity | Value |
|---|---|
| Pool size and uniqueness | |
| # patterns | 27 |
| # unique signatures | 27 |
| # unique relations | 369 |
| Avg. pattern length (# triples / pattern) | 2.48 |
| Distributional entropy | |
| Method | LC | Faith | Reason | Reuse | Concise | Comp | Avg | |
|---|---|---|---|---|---|---|---|---|
| Graph-R1 | 2.35 | 1.90 | 2.05 | 1.50 | 2.50 | 1.95 | 2.04 | 0.59 |
| R1-Searcher | 2.65 | 2.30 | 2.20 | 1.85 | 2.85 | 2.35 | 2.37 | 0.68 |
| Structure-R1 | 2.75 | 2.55 | 2.50 | 2.10 | 2.70 | 2.55 | 2.53 | 0.69 |
| PatternBloom | 2.85 | 2.95 | 2.75 | 3.10 | 2.95 | 2.85 | 2.91 | 0.71 |
| Category | Symptom | Addressing extension |
|---|---|---|
| R 1 : signature mismatch | similarity to every stored pattern ; no pattern hint is injected and the agent reasons from chunks alone. | Inference-time pattern admission (§ I ). |
| R 2 : entity disambiguation | Retrieved hyperedge surface form matches the query mention but disambiguates to the wrong real-world entity (e.g., two films sharing a title). | Coreference-aware reranking before <query> -block dispatch (generic graph-RAG extension). |
| R 3 : numerical reasoning | The retrieved skeleton and traversal are correct, but the arithmetic step (year subtraction, attribute ranking) is wrong. | External calculator tool invoked when the retrieved skeleton ends in a numerical comparison (generic LLM extension). |
| R 4 : predicate canonicalization | The retrieved hyperedge contains the right entities but the predicate string at <graph> does not match the gold annotation. | Predicate canonicalization layer between extraction and graph emission (generic graph-RAG extension). |
| Component | Stage I (IDR) | Stage II (PAR) |
|---|---|---|
| Backbone | Qwen2.5-7B-Instruct [ 33 ] | Stage-I best checkpoint |
| Optimizer | AdamW | AdamW |
| Learning rate | ||
| GRPO group size | ||
| Batch size | prompts | prompts |
| Mini-batch size |
| Method | Representation | Build-time | Retrieval unit | Reasoning path |
|---|---|---|---|---|
| GraphRAG [ 11 ] | entity-relation KG | static (LLM) | community summary | implicit |
| HippoRAG [ 12 , 13 ] | entity-relation KG | static (LLM) | PPR-traversed nodes | implicit |
| LightRAG [ 15 ] | entity-relation KG | static (LLM) | dual-level summary | implicit |
| LinearRAG [ 14 ] | hierarchical entity | static (NER) | relation-free chunks | implicit |
| GFM-RAG [ 16 ] | query-conditioned KG | static (foundation) | GFM-scored entities | implicit |
| HyperGraphRAG [ 24 ] | hypergraph | static (LLM) | hyperedge | implicit |
| Method | Reward signal | Retrieval target | Training scale |
|---|---|---|---|
| Search-R1 [ 5 ] | EM on answer | Wikipedia (E5 retriever) | k examples |
| R1-Searcher [ 7 ] | multi-stage curriculum, EM/F 1 | search engine | k |
| FrugalRAG [ 10 ] | EM + budget penalty | search engine | examples |
| Graph-R1 [ 6 ] | F 1 + entity-presence proxy | hypergraph index | k |
| Structure-R1 [ 18 ] | EM + format-validity proxy | format-conditional | k |
| PatternBloom (ours) | IDR (info-theoretic) + PAR (pattern coverage) | hypergraph + GPM | k (HotpotQA 2Wiki) |
Agentic RAG
Agentic retrieval-augmented generation lets language models plan searches, use tools, and refine evidence before producing grounded answers.
See all 257 papers