We provide the experiment code package used to reproduce the main empirical analyses in Grounded-R1. The package contains scripts, retained logs, figures, and intermediate artifacts for episode-level answer evaluation, sentence-level retrieval triggering evaluation, sentence-level hallucination evaluation, and RHRD threshold calibration.
Download the full experiment code package here: [Download Grounded-R1 Experiments Code]
Directory structure
The code package is organized into four experiment folders:
- Episode-level answer evaluation/
Final-answer evaluation scripts for exact match, F1, LLM-as-a-judge semantic score, HaluEval answer-level non-hallucination rate, and ASQA long-form metrics.
- RHRD_threshold_calibration/
Validation calibration scripts and artifacts for the RHRD sentence-level risk threshold, including score distributions, sentence-level positive and negative samples, threshold metrics, figures, and logs.
- Sentence_level_retrieval_triggering_evaluation/
Sentence-end retrieval triggering evaluation scripts, including trajectory generation, retrieval decision metrics, confusion-matrix visualization, and evaluation logs.
- Sentence_level_hallucination_evaluation/
Sentence-level hallucination annotation and analysis scripts, including factuality hallucination, faithfulness hallucination, overall non-hallucination rate statistics, human sanity-check artifacts, and logs.
Reproduction notes
To reproduce the experiments, unzip the package and enter the corresponding experiment folder. Each subfolder contains a README with experiment-specific instructions.
A typical workflow is:
1. Prepare the benchmark JSONL files following the filenames and sample counts described in the appendix.
2. Provide local model checkpoints, retrieval service endpoints, and OpenAI-compatible judge endpoints through command-line arguments or environment variables.
3. Run the generation or evaluation scripts inside the corresponding experiment folder.
4. Compare the generated reports, logs, and figures with the retained artifacts in the package.
Large benchmark files, model checkpoints, API keys, private service URLs, and local machine paths are intentionally not included in the repository. Users should provide these resources locally.
This experiment evaluates final-answer quality at the episode level. Given the full reasoning-retrieval trajectory, we extract the final answer and compare it with benchmark annotations using dataset-specific metrics, including exact match (EM), token-level F1, LLM-as-a-judge semantic score, and HaluEval answer-level non-hallucination rate (NHR).
The goal of this evaluation is to test whether risk-aligned sentence-end retrieval decisions also improve final task performance, not only local retrieval behavior.
Table 1. Main benchmark results
This table compares Grounded-R1 with direct generation, static RAG, training-free dynamic RAG methods, and learning-based dynamic RAG baselines across eight ground-truth benchmarks.
Key takeaways:
- Grounded-R1 (episode) improves over Search-R1 on most benchmarks, showing that the episode-level quality-cost reward already learns a stronger base policy.
- Grounded-R1 (full) further improves final-answer quality after Phase II, indicating that sentence-level risk-aligned retrieval optimization preserves and strengthens episode-level answer performance.
- The gains appear in both EM and LLM-as-a-judge scores, suggesting that the improvement is not limited to surface-form answer matching.
- On HaluEval, higher EM and answer-level NHR indicate better correctness with fewer hallucinated final answers.
- On ASQA, joint EM and F1 improvements suggest that timely evidence intervention is also useful for long-form answer generation.
Table 2. Reward-design ablation
This table isolates the contribution of each reward component under a unified 7B PPO setting.
How to read the variants:
- Grounded-R1 (episode-EM) uses sparse terminal EM, format reward, and retrieval-cost penalties.
- Grounded-R1 (episode-semantic) replaces sparse EM with a continuous semantic answer-quality reward.
- Grounded-R1 (full) further adds the Phase II sentence-level reward aligned with RHRD.
Key takeaways:
- The progression from episode-EM to episode-semantic shows that continuous semantic feedback provides a stronger episode-level learning signal than lexical matching alone.
- The further gain from episode-semantic to Grounded-R1 (full) shows that sentence-level risk-aligned optimization improves downstream answer quality.
- These results support the two-phase design: Phase I builds a high-quality, low-cost base policy, while Phase II improves retrieval trigger timing without degrading final-answer capability.
This experiment evaluates retrieval trigger timing at sentence-end decision points. We treat retrieval as a binary decision: SEARCH is a retrieval decision, while CONTINUE_THINK and ANSWER are non-retrieval decisions.
Because true retrieval necessity is difficult to observe directly, we use frozen RHRD-derived proxy labels for evaluation. A sentence-end position is labeled as should-retrieve when its RHRD score reaches or exceeds the fixed threshold τ = 0.56. F2 is used as the main aggregate metric because preemptive hallucination intervention should prioritize recall of risk-critical positions while still controlling unnecessary retrieval.
Table 3. Retrieval triggering decision quality
This table evaluates whether each model retrieves at the right sentence-end positions across six benchmarks.
Key takeaways:
- Grounded-R1 (full) achieves the best macro Precision, Recall, and F2 among compared models.
- Its macro F2 improves from 0.195 for Search-R1 to 0.384, while using a comparable number of retrieval calls.
- Grounded-R1 (full) also achieves the lowest macro false positive rate, showing that the improvement does not come from indiscriminate retrieval.
- Compared with Grounded-R1 (episode), the full model improves F2 and sharply reduces false positives with nearly unchanged retrieval cost.
- These results support the central claim that Phase II improves retrieval trigger timing rather than simply increasing retrieval frequency.
Figure 2. Confusion matrices on HaluEval and PopQA
The confusion matrices make retrieval-decision behavior more interpretable.
How to read the matrix:
- True positive (TP): the model retrieves at a high-risk sentence-end position.
- False negative (FN): the model misses retrieval when the RHRD proxy label indicates high risk.
- False positive (FP): the model retrieves at a low-risk position.
- True negative (TN): the model correctly continues or answers without retrieval.
Key takeaways:
- Search-R1 tends to under-retrieve, leaving many high-risk sentence-end positions unresolved.
- R1-Searcher often over-triggers retrieval, producing a high false-positive rate.
- Grounded-R1 (full) reduces missed retrievals on PopQA and, on HaluEval, increases correct retrievals while lowering false positives.
- This behavior indicates stronger alignment between sentence-level hallucination risk and retrieval actions, rather than a simple increase in search frequency.
Figure 3. Phase II training dynamics
This figure visualizes how retrieval triggering improves during Phase II training.
How to read the curves:
- The F2 curve tracks retrieval decision quality under the frozen RHRD threshold τ = 0.56.
- The stacked confusion-matrix plot shows how TP, FP, FN, and TN proportions change over training.
Key takeaways:
- F2 rises steadily under both PPO and GRPO before reaching a plateau, showing that the sentence-level reward provides a learnable signal.
- False negatives decrease and true positives increase during training, indicating fewer missed should-retrieve positions and more correct retrieval triggers.
- False positives remain controlled rather than growing together with true positives.
- These dynamics show that Phase II learns better retrieval timing, not merely a more aggressive retrieval policy.
This experiment evaluates whether better retrieval trigger timing leads to more grounded generated text. Instead of only checking the final answer, we split model outputs into sentences and annotate each sentence for factuality hallucination and faithfulness hallucination.
Definitions:
- Factuality hallucination: the sentence is contradicted by, or insufficiently supported under, external evidence for a verifiable claim.
- Faithfulness hallucination: the sentence is inconsistent with the input instruction, retrieved evidence, source context, local generation context, or task constraints.
- Overall NHR: a sentence is counted as non-hallucinated only if it contains neither factuality hallucination nor faithfulness hallucination.
This makes overall NHR a strict local groundedness metric: a model must keep both factual correctness and contextual faithfulness at the sentence level.
Table 21&22. Sentence-level overall NHR
These tables report overall non-hallucination rate on five representative open-ended benchmarks.
Key takeaways:
- Grounded-R1 (full) achieves the highest overall NHR on all five benchmarks.
- Its macro overall NHR reaches 69.31%, improving over the strongest external baseline, Search-o1, by 12.73 percentage points.
- The largest gains appear on ASQA and PopQA, suggesting that risk-aligned retrieval is especially helpful for long-form generation and long-tail factual questions.
- The improvement indicates that Grounded-R1 reduces local hallucination during generation, not only final-answer errors.
Table 23&24. Human sanity check for automatic sentence-level annotation
We further validate the automatic annotation protocol with a human sanity check on 100 sampled claim-bearing sentences. The check covers both factuality hallucination and faithfulness hallucination.
Key takeaways:
- Human-human agreement reaches 96.0% for factuality and 95.0% for faithfulness, indicating that the two annotation dimensions are operationally clear and consistently judgeable.
- Tool-human agreement reaches 88.0% for factuality and 91.0% for faithfulness, showing that the automatic tool is reasonably aligned with adjudicated human labels.
- For factuality hallucination, the tool achieves 1.000 recall and 0.0% false negative rate, meaning that all human-confirmed factuality hallucinations in the sampled set are captured.
- The factuality tool is conservative, with some false positives. This may slightly underestimate NHR, but it reduces the risk of overlooking unsupported factual claims.
- Faithfulness hallucination is more context-dependent because it requires checking consistency with the instruction, retrieved evidence, local context, and full generation. Even under this harder setting, the tool reaches 0.867 recall and only 2 false negatives.
- Overall, the sanity check supports using the automatic annotation protocol for relative model comparison under the same evaluation pipeline.
This experiment calibrates the sentence-end RHRD threshold used in Phase II reward assignment and in the frozen proxy labels for retrieval triggering evaluation. RHRD is not intended to be a hallucination oracle. Instead, it is an operational proxy for boundary-crossing risk: it identifies sentence-end positions where the model is likely to need external evidence before continuing.
Figure 7. RHRD score distribution and threshold selection
This figure shows the validation calibration of the sentence-level RHRD score.
How to read the figure:
- The score distribution plot compares RHRD scores for hallucinated and non-hallucinated sentences.
- The recall curve shows how hallucinated-sentence recall changes as the threshold increases.
- The selected threshold is τ = 0.56.
Key takeaways:
- Hallucinated and non-hallucinated sentences are not perfectly separable, which supports using RHRD as an operational risk signal rather than a direct hallucination label.
- We choose τ = 0.56 under a recall-oriented objective because missing a necessary retrieval under high hallucination risk is usually more costly than triggering one unnecessary retrieval under low risk.
- This threshold retains about 0.9 recall for hallucinated sentences while avoiding excessive low-threshold retrieval triggers.
- The threshold is fixed before test-time evaluation and is used consistently for Phase II reward assignment and frozen proxy labels in retrieval-triggering evaluation.
- Grounded-R1 does not deploy RHRD as a hard threshold-only retrieval rule. The learned policy still decides among CONTINUE_THINK, SEARCH, and ANSWER based on the evolving dynamic context.