dvc-arc-eval / samples_schema.json
MinhTriet's picture
Upload samples_schema.json with huggingface_hub
32adff5 verified
Raw
History Blame Contribute Delete
7.73 kB
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/dvc-rag/eval/samples_schema.json",
"title": "DVC-RAG Evaluation Sample",
"description": "Schema chung cho toàn bộ sample đánh giá trong data/eval. Gồm 2 loại: (1) retrieval_qa — câu hỏi đơn lẻ có gold ma_thu_tuc, dùng cho exp01 (retrieval) và exp02 (generation/citation, subset); (2) memory_case — kịch bản hội thoại nhiều lượt cho exp03 (memory ablation). Mỗi dòng JSONL = một sample hợp lệ theo schema này.",
"oneOf": [
{ "$ref": "#/$defs/retrieval_qa" },
{ "$ref": "#/$defs/memory_case" }
],
"$defs": {
"retrieval_qa": {
"type": "object",
"title": "Câu hỏi QA (exp01/exp02)",
"description": "Một câu hỏi known-item: gold là mã thủ tục (ma_thu_tuc) trong corpus 5.208 thủ tục. Câu out_of_scope có gold rỗng.",
"required": ["id", "sample_type", "q_type", "question", "gold_ma_thu_tuc"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Định danh duy nhất: '<q_type>-<số thứ tự 3 chữ số>' (câu tự sinh), 'manual-NNN' (viết tay), 'oos-NNN' (ngoài phạm vi).",
"pattern": "^(factual_lookup|paraphrase|scenario|aspect_hoso|aspect_phi_dk|keyword_short|manual|oos)-\\d{3}$",
"examples": ["factual_lookup-000", "manual-001", "oos-000"]
},
"sample_type": {
"const": "retrieval_qa",
"description": "Bộ phân biệt loại sample."
},
"q_type": {
"type": "string",
"description": "Nhóm câu hỏi — mỗi nhóm kiểm một năng lực retrieval/generation khác nhau.",
"enum": [
"factual_lookup",
"paraphrase",
"scenario",
"aspect_hoso",
"aspect_phi_dk",
"keyword_short",
"manual_inscope",
"out_of_scope"
]
},
"question": {
"type": "string",
"description": "Câu hỏi tiếng Việt của người dùng.",
"minLength": 5
},
"gold_ma_thu_tuc": {
"type": "array",
"description": "Tập mã thủ tục được chấp nhận là đúng (các thủ tục trùng tên khác cấp được gộp). RỖNG khi q_type=out_of_scope.",
"items": {
"type": "string",
"pattern": "^\\d+\\.\\d+(-\\w+)?$",
"examples": ["1.002090", "1.014955-Xoa"]
},
"uniqueItems": true
},
"primary_ma_thu_tuc": {
"type": ["string", "null"],
"description": "Mã thủ tục nguồn dùng để sinh câu hỏi (null với out_of_scope).",
"pattern": "^\\d+\\.\\d+(-\\w+)?$"
},
"procedure_id": {
"type": "string",
"description": "UUID nội bộ của thủ tục nguồn trong corpus (chỉ có ở câu tự sinh).",
"format": "uuid"
},
"ten": {
"type": ["string", "null"],
"description": "Tên đầy đủ của thủ tục gold (null với out_of_scope)."
},
"linh_vuc": {
"type": "string",
"description": "Lĩnh vực hành chính của thủ tục gold; '(ngoài phạm vi)' với out_of_scope."
},
"generated_by": {
"type": "string",
"description": "Model/pipeline sinh câu hỏi (chỉ có ở lô GT mở rộng; lô gốc gpt-4o không ghi trường này).",
"examples": ["claude-sonnet-5", "claude-code-agents"]
},
"source_section": {
"type": "string",
"description": "Section corpus dùng để sinh câu hỏi (vd 'Trình tự thực hiện', 'Thành phần hồ sơ'); '(viết tay)' với câu manual/oos. Quyết định độ tin cậy checklist gold ở eval_completeness.",
"examples": ["Trình tự thực hiện", "Thành phần hồ sơ", "Phí, lệ phí", "(viết tay)"]
}
},
"allOf": [
{
"if": { "properties": { "q_type": { "const": "out_of_scope" } } },
"then": {
"properties": {
"gold_ma_thu_tuc": { "maxItems": 0 },
"primary_ma_thu_tuc": { "const": null },
"ten": { "const": null }
}
},
"else": {
"properties": {
"gold_ma_thu_tuc": { "minItems": 1 }
},
"required": ["primary_ma_thu_tuc", "ten", "linh_vuc", "source_section"]
}
}
]
},
"memory_case": {
"type": "object",
"title": "Kịch bản memory (exp03)",
"description": "Hội thoại nhiều lượt + câu follow-up chứa tham chiếu ngầm ('thủ tục này', 'việc đó'). Đo coreference accuracy: câu viết lại sau contextualize phải chứa ≥1 từ khóa trong 'expected'. B1 kiểm Lớp A (summary-buffer, thực thể nằm ngoài cửa sổ WINDOW=2 của CÙNG hội thoại); B2 kiểm Lớp B (episodic, thực thể nằm ở HỘI THOẠI TRƯỚC, history hiện tại rỗng).",
"required": ["id", "sample_type", "layer", "follow_up", "expected"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Định danh duy nhất: 'mem-b1-NNN' hoặc 'mem-b2-NNN'.",
"pattern": "^mem-b[12]-\\d{3}$",
"examples": ["mem-b1-000", "mem-b2-002"]
},
"sample_type": {
"const": "memory_case",
"description": "Bộ phân biệt loại sample."
},
"layer": {
"type": "string",
"description": "Lớp memory được kiểm: B1_summary (Lớp A — tóm tắt trong hội thoại) hoặc B2_episodic (Lớp B — ký ức liên hội thoại).",
"enum": ["B1_summary", "B2_episodic"]
},
"history": {
"type": "array",
"description": "Các lượt (user, assistant) của HỘI THOẠI HIỆN TẠI — bắt buộc với B1 (thực thể chính ở lượt đầu, ngoài cửa sổ keep_recent); rỗng/vắng với B2.",
"items": { "$ref": "#/$defs/turn" }
},
"past": {
"type": "array",
"description": "Các lượt (user, assistant) của HỘI THOẠI TRƯỚC đã lưu vào episodic memory — bắt buộc với B2; vắng với B1.",
"items": { "$ref": "#/$defs/turn" }
},
"follow_up": {
"type": "string",
"description": "Câu hỏi tiếp theo chứa tham chiếu ngầm cần giải.",
"minLength": 5
},
"expected": {
"type": "array",
"description": "Các biến thể từ khóa (so khớp không dấu, lowercase) mà câu viết lại ĐÚNG phải chứa ít nhất một.",
"items": { "type": "string" },
"minItems": 1
}
},
"allOf": [
{
"if": { "properties": { "layer": { "const": "B1_summary" } } },
"then": { "required": ["history"], "properties": { "history": { "minItems": 1 } } },
"else": { "required": ["past"], "properties": { "past": { "minItems": 1 } } }
}
]
},
"turn": {
"type": "array",
"description": "Một lượt hội thoại: [câu người dùng, câu trả lời của bot].",
"prefixItems": [
{ "type": "string", "description": "user" },
{ "type": "string", "description": "assistant" }
],
"minItems": 2,
"maxItems": 2,
"items": { "type": "string" }
}
}
}