mcpField
N
nemo-evaluator-sdk

nemo-evaluator-sdk

github.com/kalarislabs其他7344 次安装4 天前更新
代码仓库

关于 nemo-evaluator-sdk

NeMo Evaluator SDK 是用于基准评测 LLM 的命令行工具包,支持容器化运行。它可在本地 Docker、Slurm HPC 和 Lepton 云端执行,并导出结果以比较模型。

主要功能

  1. 01涵盖多种评测框架的 100 多项基准
  2. 02容器化且可复现的评测
  3. 03本地、Slurm 和 Lepton 执行
  4. 04查看任务与运行状态
  5. 05导出至 MLflow、W&B 或 JSON

适用场景

  1. 01评测兼容 OpenAI API 的模型端点
  2. 02在 Slurm 集群运行评测
  3. 03用相同任务比较多个模型
  4. 04测试安全性与视觉语言模型

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/kalarislabs/research-agent-skills --skill nemo-evaluator-sdk

安装后在 Claude Code 中输入/nemo-evaluator-sdk确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
adapter-system.md
configuration.md
custom-benchmarks.md
execution-backends.md
python-api-usage.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-harness60+MMLU、GSM8K、HellaSwag、ARC
simple-evals20+GPQA、MATH、AIME
bigcode-evaluation-harness25+HumanEval、MBPP、MultiPL-E
safety-harness3Aegis、WildGuard
garak1安全探测
vlmevalkit6+OCRBench、ChartQA、MMMU
bfcl6函数调用 v2/v3
mtbench2多轮对话
livecodebench10+实时编码评估
helm15医疗领域
nemo-skills8数学、科学、Agent

常见问题

问题:容器拉取失败

确保已配置 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 用法

详细说明、代码示例和参数表:references/python-api-usage.md。此步骤适用时请阅读。

高级主题

多后端执行:参见 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)所必需

资源

Agent 操作流程

  1. 检查环境。 确认模型、检查点、基准版本和评测框架版本。
  2. 明确输入。 根据数据或用户提供的信息确认格式、标识符和参数。对于任何会影响结果的值,不要猜测,应先询问。
  3. 先运行小规模版本。 在小型子集上进行评测,以验证提示词、解析和评分。
  4. 使用上述说明和参考资料执行完整任务。
  5. 验证结果。 使用基准的官方划分和指标;检查数据污染;报告不同随机种子或提示词下的方差。
  6. 报告结果。 说明运行内容(版本、命令、参数)、检查内容以及仍不确定之处。
如果发生这种情况请这样做
分数与已发布的数字不同在下结论之前,先检查提示词格式、少样本设置和评测框架版本。
这些说明中提到的函数、标志或端点在已安装版本中不存在查阅已安装版本自身的文档(help()、--help、官方文档),进行调整并告知用户。切勿杜撰 API。
必需的输入、标识符或参数含糊不清询问用户,或在运行前明确说明所作假设。

诚信准则

  • 切勿伪造结果、参数、标识符、引文或统计数据。如果某项内容无法运行或验证,请如实说明。
  • 完整报告评测设置;切勿挑选提示词、随机种子或子集。
  • 将此处与版本相关的细节视为可能已过时:请对照已安装版本的官方文档进行确认。
  • 对于会产生费用、占用共享 GPU 或云配额、涉及个人或患者数据,或无法撤销的操作,须先征求同意。

相关技能

  • evaluating-llms-harness:使用 60 多个学术基准(MMLU、HumanEval、GSM8K、TruthfulQA、HellaSwag)评测 LLM。
  • evaluating-code-models:使用 HumanEval、MBPP、MultiPL-E 以及 15 多个基准和 pass@k 指标评测代码生成模型。
  • nextflow:端到端构建、运行和调试 Nextflow 数据管道及 nf-core 工作流。

评论

支持 Markdown