RAG 基准问题生成
benchmark-qed-autoq
使用 benchmark-qed 从输入数据生成基准问题和断言。适用于:为 RAG 基准测试生成局部、全局、链接或活动问题,为现有问题创建断言,计算断言统计,或运行 autoq 问题生成流水线。当用户想要创建基准问题集、从数据集构建评估问题,或生成真值断言时也适用——即使用户没有明确说“autoq”。
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 104
- Forks
- 24
01 前言 Front Matter
- name
- benchmark-qed-autoq
- description
- Generate benchmark questions and assertions from input data using benchmark-qed. Use when: generating local, global, linked, or activity questions for RAG benchmarking, creating assertions for existing questions, computing assertion statistics, or running the autoq question generation pipeline. Also use when the user wants to create a benchmark question set, build evaluation questions from a dataset, or generate ground-truth assertions — even if they don't say "autoq" explicitly.
02 资源文件 6
- 参考文档anthropic-best-practices.md45.1 KB
- 参考文档examples/CLAUDE_MD_TESTING.md5.3 KB
- 其他graphviz-conventions.dot5.8 KB
- 参考文档persuasion-principles.md5.8 KB
- 脚本render-graphs.js4.9 KB
- 参考文档testing-skills-with-subagents.md12.3 KB
03 SKILL.md 正文
Benchmark-QED Question Generation (autoq)
Generate benchmark questions and assertions from input data for RAG evaluation.
Prerequisites
- A configured workspace with valid
settings.yaml(use the/benchmark-qed-setupskill first) - A configured workspace with valid
settings.yaml(use thebenchmark-qed-setupskill to initialize and configure) - Input data (CSV or JSON) in the workspace
input/directory - Valid LLM API key in
.env
Run all commands with:
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed <command>
Commands
1. Generate Questions (autoq)
The main question generation pipeline. Generates benchmark questions from input data.
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq <settings.yaml> <output_dir> [OPTIONS]
Options:
| Option | Description |
|---|---|
--generation-types |
Specific types to generate (repeatable). CLI default: all except data_linked, but this skill always includes data_linked |
--print-model-usage |
Print LLM token usage stats |
--account-url |
Azure Blob Storage account URL (managed-identity auth). Use when the config path is a blob:// URI. Falls back to $AZURE_STORAGE_ACCOUNT_URL. |
--connection-string |
Azure Blob Storage connection string. Use when the config path is a blob:// URI. Falls back to $AZURE_STORAGE_CONNECTION_STRING. |
Generation types and dependencies:
data_local ← runs first (no dependencies)
├── data_global ← requires data_local candidates
└── data_linked ← requires data_local candidates (not in CLI default, but this skill always includes it)
activity_local ← auto-generates activity_context first
└── activity_global ← requires activity_local
Important:
data_linkedis NOT included in the CLI's default generation types, but this skill always generates it by passing all types explicitly. If running the CLI manually, you must add--generation-types data_linked.
Gotcha:
data_globalanddata_linkedsilently return empty results ifdata_localhasn't been run first. Always rundata_localbefore these types.
Examples:
# Run from the workspace directory (paths resolve relative to settings.yaml location)
cd ./workspace
# Generate all types including data_linked (skill default)
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq settings.yaml ./output \
--generation-types data_local --generation-types data_global --generation-types data_linked \
--generation-types activity_local --generation-types activity_global
# Generate only local questions
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq settings.yaml ./output --generation-types data_local
# Generate local + linked questions
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq settings.yaml ./output \
--generation-types data_local --generation-types data_linked
# Use a config stored in Azure Blob Storage
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq \
blob://my-container/configs/settings.yaml ./output \
--account-url https://myaccount.blob.core.windows.net \
--generation-types data_local
Output structure:
output_dir/
├── sample_texts.parquet # Intermediate: clustered text samples
├── data_local_questions/
│ ├── selected_questions.json # Final curated questions
│ ├── selected_questions_text.json # Human-readable version
│ └── candidate_questions.json # All generated candidates
├── data_global_questions/ # Same structure
├── data_linked_questions/ # Same structure + question_stats.json
├── activity_local_questions/ # Same structure
├── activity_global_questions/ # Same structure
├── context/
│ └── activity_context_full.json # Generated activity context
└── model_usage.json # LLM token/cost tracking
2. Generate Assertions (generate-assertions)
Generate ground-truth assertions for existing questions (decoupled from question generation). This is a top-level command, not a subcommand of autoq.
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed generate-assertions <settings.yaml> <questions.json> <output_dir> [OPTIONS]
Options:
| Option | Description |
|---|---|
--type / -t |
Assertion type: local, global, or linked (default: local) |
--print-model-usage |
Print LLM token usage stats |
--account-url |
Azure Blob Storage account URL (managed-identity auth). Use when the config path is a blob:// URI. |
--connection-string |
Azure Blob Storage connection string. Use when the config path is a blob:// URI. |
Examples:
# Run from the workspace directory (paths resolve relative to settings.yaml location)
cd ./workspace
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed generate-assertions \
settings.yaml \
./output/data_local_questions/candidate_questions.json \
./output/data_local_questions/ \
--type local
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed generate-assertions \
settings.yaml \
./output/data_global_questions/candidate_questions.json \
./output/data_global_questions/ \
--type global
3. Assertion Statistics (assertion-stats)
Compute quality statistics for assertion files. This is a top-level command, not a subcommand of autoq.
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed assertion-stats <assertions_path> [OPTIONS]
Options:
| Option | Description |
|---|---|
--output / -o |
Output path for stats JSON (auto-generated if omitted) |
--type / -t |
global, map, or local (auto-inferred if omitted) |
--quiet / -q |
Suppress console output |
Examples:
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed assertion-stats ./output/assertions.json
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed assertion-stats ./output/data_global_questions/ -q
Workflow
Standard Question Generation Flow
- [ ] Step 1: Initialize workspace if needed — use the
benchmark-qed-setupskill to create and configure the workspace. Verifysettings.yaml,.env, andinput/exist. - [ ] Step 2:
cd <workspace_dir>then run question generation —uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq settings.yaml ./output --generation-types data_local --generation-types data_global --generation-types data_linked --generation-types activity_local --generation-types activity_global - [ ] Step 3: Verify output artifacts — list
<output_dir>and confirm the per-typeselected_questions.jsonfiles (see "Output structure" above) plusmodel_usage.jsonexist. - [ ] Step 4: (Optional) Generate additional assertions — use
generate-assertions - [ ] Step 5: (Optional) Check assertion quality — use
assertion-stats
Azure Blob Storage
All autoq and generate-assertions commands support reading config files from Azure Blob Storage using blob:// URIs:
# Config file in blob storage — the CLI downloads the config (and sibling prompt files) to a temp directory
uvx --from "git+https://github.com/microsoft/benchmark-qed" benchmark-qed autoq \
blob://my-container/project/settings.yaml ./output \
--connection-string "$AZURE_STORAGE_CONNECTION_STRING"
In addition, settings.yaml supports input.storage and output_storage blocks to read/write data from Azure Blob Storage:
# Read input data from blob storage
input:
dataset_path: data/input.csv
storage:
type: blob
container_name: my-datasets
connection_string: ${AZURE_STORAGE_CONNECTION_STRING}
# Or use managed identity:
# account_url: https://myaccount.blob.core.windows.net
# Write output to blob storage
output_storage:
type: blob
container_name: my-output
connection_string: ${AZURE_STORAGE_CONNECTION_STRING}
See references/config-reference.md for full StorageConfig fields.
Gotchas
- Path resolution: The
autoqandgenerate-assertionscommands resolveoutput_dir(and other relative paths) relative to the settings.yaml file's directory, not the current working directory. Alwayscdinto the workspace directory first, or use absolute paths. For example, runningbenchmark-qed autoq workspace/settings.yaml workspace/outputfrom the repo root creates output atworkspace/workspace/output/(notworkspace/output/). - Stale outputs: The pipeline skips steps if output files already exist (
sample_texts.parquet,activity_context_full.json). Use a fresh output directory for clean runs, or delete specific files to re-run a step. - Long-running: Question generation with large datasets can take hours. Use background execution and monitor via
model_usage.jsonpresence. - Output is in files, not stdout: All results are written to JSON/CSV/Parquet files. Parse the output files, not CLI stdout.
- Generation ordering:
data_globalanddata_linkeddepend ondata_local.activity_globaldepends onactivity_local. Running dependent types without their prerequisites produces silent empty results. data_linkedCLI opt-in: The CLI excludesdata_linkedby default, but this skill always includes it. If running the CLI manually outside this skill, add--generation-types data_linked.- Blob URI format: Use
blob://<container>/<key>for config paths. The CLI downloads the config and all sibling files (prompt templates) to a temp directory so relative paths resolve correctly.
04 同仓库更多 Skills
benchmark-qed 工作区配置
benchmark-qed-setup
初始化并配置 benchmark-qed 工作区以进行 RAG 基准测试。使用场景:建立新的基准测试项目、初始化用于问题生成或评估的配置文件、下载示例数据集,或修改 benchmark-qed 的 settings.yaml 配置。当用户提到“benchmark-qed config”、工作区设置或需要准备基准测试环境时也使用——即使用户没有明确说出“setup”。
RAG 系统输出评估
benchmark-qed-autoe
使用 benchmark-qed 评分方法评估 RAG 系统输出。适用于:运行成对比较、基于参考的评分、基于断言的评估(扁平或分层)、检索指标,或对 RAG 输出进行统计显著性检验。当用户想要对 RAG 方法进行评分、比较或评估、衡量检索质量,或对基准结果进行显著性检验时也适用——即使用户没有明确说“autoe”。