Skip to content

Conversation

@e06084
Copy link
Collaborator

@e06084 e06084 commented Jul 17, 2025

Dingo 中使用集成的幻觉检测功能,支持两种检测方案:HHEM-2.1-Open 本地模型(推荐)和 GPT-based 云端检测。典型应用场景如下:

1. RAG 系统质量监控

# 实时基于RAG监控回答质量(使用本地HHEM)
def monitor_rag_response(question, generated_answer, retrieved_docs):
    data = Data(
        data_id=f"rag_{timestamp}",
        prompt=question,
        content=generated_answer,
        context=retrieved_docs
    )

    result = RuleHallucinationHHEM.eval(data)  # 本地、快速、免费

    if result.error_status:
        logger.warning(f"检测到幻觉: {result.reason[0]}")
        # 触发人工审核或回答重生成

2. SFT 数据集预处理

# 训练前检查SFT数据质量(批量处理使用HHEM)
input_data = {
    "input_path": "sft_training_data.jsonl",
    "custom_config": {
        "rule_config": {"RuleHallucinationHHEM": {"threshold": 0.4}}
    },
    "save_correct": True,  # 保存通过检测的数据用于训练
}

@shijinpjlab shijinpjlab merged commit c4407f3 into MigoXLab:dev Jul 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants