feat(open_rag): align OpenRAG inference pipeline with XRAG conventions and add compile-verified config support#31
Open
DanTargaryen wants to merge 2 commits intomainfrom
Open
feat(open_rag): align OpenRAG inference pipeline with XRAG conventions and add compile-verified config support#31DanTargaryen wants to merge 2 commits intomainfrom
DanTargaryen wants to merge 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
本 PR 将 open_rag 在 XRAG 中的接入从“可跑通”提升为“可维护、可评估、可配置”的规范化实现,并对齐 openrag 官方单跳推理核心逻辑(推理/重排/检索决策部分)。
主要改动
配置项补齐与统一
更新 config.toml
更新 src/xrag/default_config.toml
更新 src/xrag/config.py
新增 open_rag 配置字段:
closed: bool
use_stopping_criteria: bool
以上字段在默认配置、项目配置、运行时读取路径均已打通。
Open-RAG 推理管线对齐(核心)
更新 src/xrag/open_rag/pipeline.py
关键点:
支持 closed 路径(候选答案聚合选择)。
增加 StoppingCriteria 支持(可配置开关)。
保留并规范化 adaptive retrieval 决策流程。
no-retrieval 分支改为显式走 [No Retrieval] 二次生成路径并返回对应结果。
候选评分结构补齐,输出更完整的 debug metadata。
修正 logproba_retrieval_thresh 的计算逻辑,避免异常数值风险。
代码规范化
按 XRAG 风格整理类型标注与结果结构。
清理不必要格式问题,保证变更文件可直接通过编译。
影响范围
Open-RAG 推理与评测相关路径。
Open-RAG 配置解析与默认配置生成。
不影响 default/self/adaptive/sim 的主分支逻辑。
验证
定向编译检查(通过)
python3 -m py_compile
src/xrag/open_rag/pipeline.py
src/xrag/open_rag/utils.py
src/xrag/config.py
src/xrag/launcher/launch.py
src/xrag/api/server.py
src/xrag/webui/app.py
全量源码编译检查(通过)
find src/xrag -type f -name '*.py' -print0 | xargs -0 -r python3 -m py_compile
备注:存在一个历史 warning(非本 PR 引入):
src/xrag/process/postprocessor.py:81 invalid escape sequence warning。
风险与兼容性说明
本 PR 主要增强 open_rag 分支;默认 orchestrator 行为不变。
open_rag 的模型加载/在线推理未在本 PR 做重模型回归(仅做编译级验证)。
与 openrag 官方相比,当前对齐范围聚焦在 XRAG 使用到的单跳推理核心路径,训练/多跳脚本不在本次范围内。
后续可选(非本 PR 必须)
增加 Open-RAG 的最小 e2e 冒烟测试(可 mock/reduced model)。
将 open_rag 评分细节输出统一接入 XRAG 评估日志格式。