关于 nemo-evaluator-sdk
NeMo Evaluator SDK 是用于 LLM 基准测试的评估工具,面向需要可复现评测的研究与工程团队。它通过容器化执行支持多种评测基准,并可在本地 Docker、Slurm 和 Lepton 云端运行。
主要功能
- 01覆盖多种基准与评测框架
- 02容器化、可复现评测
- 03支持本地、Slurm 与云端执行
- 04导出评测结果
- 05提供命令行与 Python API
适用场景
- 01在 OpenAI 兼容端点评估模型
- 02在 Slurm 集群运行大规模评测
- 03比较多个模型的基准结果
- 04执行安全与视觉语言评测
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ orchestra-research/ ai-research-skills --skill nemo-evaluator-sdk安装后在 Claude Code 中输入/nemo-evaluator-sdk确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/adapter-system.mdconfiguration.mdcustom-benchmarks.mdexecution-backends.md详细介绍
NeMo Evaluator SDK - 企业级大模型基准测试
快速开始
NeMo Evaluator SDK 使用容器化、可复现的评估方式,通过多后端执行(本地 Docker、Slurm HPC、Lepton 云)在 18+ 个评测框架提供的 100+ 个基准测试上评估大模型。
安装:
pip install nemo-evaluator-launcher
设置 API 密钥并运行评估:
export NGC_API_KEY=nvapi-your-key-here
# Create minimal config
cat > config.yaml << 'EOF'
defaults:
- execution: local
- deployment: none
- _self_
execution:
output_dir: ./results
target:
api_endpoint:
model_id: meta/llama-3.1-8b-instruct
url: https://integrate.api.nvidia.com/v1/chat/completions
api_key_name: NGC_API_KEY
evaluation:
tasks:
- name: ifeval
EOF
# Run evaluation
nemo-evaluator-launcher run --config-dir . --config-name config
查看可用任务:
nemo-evaluator-launcher ls tasks
常见工作流
工作流 1:在标准基准测试上评估模型
在任何兼容 OpenAI 的端点上运行核心学术基准测试(MMLU、GSM8K、IFEval)。
检查清单:
Standard Evaluation:
- [ ] Step 1: Configure API endpoint
- [ ] Step 2: Select benchmarks
- [ ] Step 3: Run evaluation
- [ ] Step 4: Check results
步骤 1:配置 API 端点
# config.yaml
defaults:
- execution: local
- deployment: none
- _self_
execution:
output_dir: ./results
target:
api_endpoint:
model_id: meta/llama-3.1-8b-instruct
url: https://integrate.api.nvidia.com/v1/chat/completions
api_key_name: NGC_API_KEY
对于自托管端点(vLLM、TRT-LLM):
target:
api_endpoint:
model_id: my-model
url: http://localhost:8000/v1/chat/completions
api_key_name: "" # No key needed for local
步骤 2:选择基准测试
将任务添加到配置中:
evaluation:
tasks:
- name: ifeval # Instruction following
- name: gpqa_diamond # Graduate-level QA
env_vars:
HF_TOKEN: HF_TOKEN # Some tasks need HF token
- name: gsm8k_cot_instruct # Math reasoning
- name: humaneval # Code generation
步骤 3:运行评估
# Run with config file
nemo-evaluator-launcher run \
--config-dir . \
--config-name config
# Override output directory
nemo-evaluator-launcher run \
--config-dir . \
--config-name config \
-o execution.output_dir=./my_results
# Limit samples for quick testing
nemo-evaluator-launcher run \
--config-dir . \
--config-name config \
-o +evaluation.nemo_evaluator_config.config.params.limit_samples=10
步骤 4:检查结果
# Check job status
nemo-evaluator-launcher status <invocation_id>
# List all runs
nemo-evaluator-launcher ls runs
# View results
cat results/<invocation_id>/<task>/artifacts/results.yml
工作流 2:在 Slurm HPC 集群上运行评估
在 HPC 基础设施上执行大规模评估。
检查清单:
Slurm Evaluation:
- [ ] Step 1: Configure Slurm settings
- [ ] Step 2: Set up model deployment
- [ ] Step 3: Launch evaluation
- [ ] Step 4: Monitor job status
步骤 1:配置 Slurm 设置
# slurm_config.yaml
defaults:
- execution: slurm
- deployment: vllm
- _self_
execution:
hostname: cluster.example.com
account: my_slurm_account
partition: gpu
output_dir: /shared/results
walltime: "04:00:00"
nodes: 1
gpus_per_node: 8
步骤 2:设置模型部署
deployment:
checkpoint_path: /shared/models/llama-3.1-8b
tensor_parallel_size: 2
data_parallel_size: 4
max_model_len: 4096
target:
api_endpoint:
model_id: llama-3.1-8b
# URL auto-generated by deployment
步骤 3:启动评估
nemo-evaluator-launcher run \
--config-dir . \
--config-name slurm_config
步骤 4:监控作业状态
# Check status (queries sacct)
nemo-evaluator-launcher status <invocation_id>
# View detailed info
nemo-evaluator-launcher info <invocation_id>
# Kill if needed
nemo-evaluator-launcher kill <invocation_id>
工作流 3:比较多个模型
在相同任务上对多个模型进行基准测试并比较。
检查清单:
Model Comparison:
- [ ] Step 1: Create base config
- [ ] Step 2: Run evaluations with overrides
- [ ] Step 3: Export and compare results
步骤 1:创建基础配置
# base_eval.yaml
defaults:
- execution: local
- deployment: none
- _self_
execution:
output_dir: ./comparison_results
evaluation:
nemo_evaluator_config:
config:
params:
temperature: 0.01
parallelism: 4
tasks:
- name: mmlu_pro
- name: gsm8k_cot_instruct
- name: ifeval
步骤 2:使用模型覆盖项运行评估
# Evaluate Llama 3.1 8B
nemo-evaluator-launcher run \
--config-dir . \
--config-name base_eval \
-o target.api_endpoint.model_id=meta/llama-3.1-8b-instruct \
-o target.api_endpoint.url=https://integrate.api.nvidia.com/v1/chat/completions
# Evaluate Mistral 7B
nemo-evaluator-launcher run \
--config-dir . \
--config-name base_eval \
-o target.api_endpoint.model_id=mistralai/mistral-7b-instruct-v0.3 \
-o target.api_endpoint.url=https://integrate.api.nvidia.com/v1/chat/completions
步骤 3:导出并比较
# Export to MLflow
nemo-evaluator-launcher export <invocation_id_1> --dest mlflow
nemo-evaluator-launcher export <invocation_id_2> --dest mlflow
# Export to local JSON
nemo-evaluator-launcher export <invocation_id> --dest local --format json
# Export to Weights & Biases
nemo-evaluator-launcher export <invocation_id> --dest wandb
工作流 4:安全与视觉语言评估
在安全基准测试和 VLM 任务上评估模型。
检查清单:
Safety/VLM Evaluation:
- [ ] Step 1: Configure safety tasks
- [ ] Step 2: Set up VLM tasks (if applicable)
- [ ] Step 3: Run evaluation
步骤 1:配置安全任务
evaluation:
tasks:
- name: aegis # Safety harness
- name: wildguard # Safety classification
- name: garak # Security probing
步骤 2:配置 VLM 任务
# For vision-language models
target:
api_endpoint:
type: vlm # Vision-language endpoint
model_id: nvidia/llama-3.2-90b-vision-instruct
url: https://integrate.api.nvidia.com/v1/chat/completions
evaluation:
tasks:
- name: ocrbench # OCR evaluation
- name: chartqa # Chart understanding
- name: mmmu # Multimodal understanding
何时使用 NeMo Evaluator,以及何时选择替代方案
在以下情况下使用 NeMo Evaluator:
- 需要在一个平台上使用 18+ 个评测框架提供的 100+ 个基准测试
- 在 Slurm HPC 集群或云端运行评估
- 需要进行可复现的容器化评估
- 针对兼容 OpenAI 的 API(vLLM、TRT-LLM、NIMs)进行评估
- 需要具备结果导出功能(MLflow、W&B)的企业级评估
在以下情况下改用其他方案:
- lm-evaluation-harness:设置更简单,适合快速本地评估
- bigcode-evaluation-harness:仅专注于代码基准测试
- HELM:Stanford 提供的范围更广的评估(公平性、效率)
- 自定义脚本:适用于高度专业化的领域评估
支持的评测框架和任务
| 评测框架 | 任务数量 | 类别 |
|---|---|---|
lm-evaluation-harness | 60+ | MMLU、GSM8K、HellaSwag、ARC |
simple-evals | 20+ | GPQA、MATH、AIME |
bigcode-evaluation-harness | 25+ | HumanEval、MBPP、MultiPL-E |
safety-harness | 3 | Aegis、WildGuard |
garak | 1 | 安全探测 |
vlmevalkit | 6+ | OCRBench、ChartQA、MMMU |
bfcl | 6 | 函数调用 v2/v3 |
mtbench | 2 | 多轮对话 |
livecodebench | 10+ | 实时代码评估 |
helm | 15 | 医疗领域 |
nemo-skills | 8 | 数学、科学、智能体 |
常见问题
问题:容器拉取失败
请确保已配置 NGC 凭据:
docker login nvcr.io -u '$oauthtoken' -p $NGC_API_KEY
问题:任务需要环境变量
有些任务需要 HF_TOKEN 或 JUDGE_API_KEY:
evaluation:
tasks:
- name: gpqa_diamond
env_vars:
HF_TOKEN: HF_TOKEN # Maps env var name to env var
问题:评估超时
提高并行度或减少样本数:
-o +evaluation.nemo_evaluator_config.config.params.parallelism=8
-o +evaluation.nemo_evaluator_config.config.params.limit_samples=100
问题:Slurm 作业未启动
检查 Slurm 账户和分区:
execution:
account: correct_account
partition: gpu
qos: normal # May need specific QOS
问题:结果与预期不同
请确认配置与报告的设置一致:
evaluation:
nemo_evaluator_config:
config:
params:
temperature: 0.0 # Deterministic
num_fewshot: 5 # Check paper's fewshot count
CLI 参考
| 命令 | 描述 |
|---|---|
run | 使用配置执行评估 |
status <id> | 检查作业状态 |
info <id> | 查看详细作业信息 |
ls tasks | 列出可用基准测试 |
ls runs | 列出所有调用 |
export <id> | 导出结果(mlflow/wandb/local) |
kill <id> | 终止正在运行的作业 |
配置覆盖示例
# Override model endpoint
-o target.api_endpoint.model_id=my-model
-o target.api_endpoint.url=http://localhost:8000/v1/chat/completions
# Add evaluation parameters
-o +evaluation.nemo_evaluator_config.config.params.temperature=0.5
-o +evaluation.nemo_evaluator_config.config.params.parallelism=8
-o +evaluation.nemo_evaluator_config.config.params.limit_samples=50
# Change execution settings
-o execution.output_dir=/custom/path
-o execution.mode=parallel
# Dynamically set tasks
-o 'evaluation.tasks=[{name: ifeval}, {name: gsm8k}]'
Python API 用法
无需使用 CLI 即可通过编程方式进行评估:
from nemo_evaluator.core.evaluate import evaluate
from nemo_evaluator.api.api_dataclasses import (
EvaluationConfig,
EvaluationTarget,
ApiEndpoint,
EndpointType,
ConfigParams
)
# Configure evaluation
eval_config = EvaluationConfig(
type="mmlu_pro",
output_dir="./results",
params=ConfigParams(
limit_samples=10,
temperature=0.0,
max_new_tokens=1024,
parallelism=4
)
)
# Configure target endpoint
target_config = EvaluationTarget(
api_endpoint=ApiEndpoint(
model_id="meta/llama-3.1-8b-instruct",
url="https://integrate.api.nvidia.com/v1/chat/completions",
type=EndpointType.CHAT,
api_key="nvapi-your-key-here"
)
)
# Run evaluation
result = evaluate(eval_cfg=eval_config, target_cfg=target_config)
高级主题
多后端执行:请参阅 references/execution-backends.md 配置深入解析:请参阅 references/configuration.md 适配器和拦截器系统:请参阅 references/adapter-system.md 自定义基准测试集成:请参阅 references/custom-benchmarks.md
要求
- Python:3.10-3.13
- Docker:本地执行所必需
- NGC API Key:用于拉取容器和使用 NVIDIA Build
- HF_TOKEN:某些基准测试(GPQA、MMLU)所必需
资源
- GitHub:https://github.com/NVIDIA-NeMo/Evaluator
- NGC Containers:nvcr.io/nvidia/eval-factory/
- NVIDIA Build:https://build.nvidia.com(免费托管模型)
- 文档:https://github.com/NVIDIA-NeMo/Evaluator/tree/main/docs