Skip to content

Commit 089c06e

Browse files
authored
fix(skills): Update Agent Skills Based on Observed Failures Modes in Trials (#1945)
### What does this PR do? Type of change: documentation Updates the agent skills based on findings from the June 5 Day-0 trials: - Strengthens PTQ checkpoint handoff, serving-readiness, and representative calibration guidance. - Adds external baseline sanity checks while allowing comparisons when no credible external score exists. - Pins SciCode to task-level `parallelism: 8` and `num_repeats: 1`. - Adds positional BF16 layer exclusions as a quantization-recipe search axis. - Keeps day-0 release decisions autonomous and maps external baseline mismatches to an explicit failure class. Refs: 1. https://lab-e57330.gitlab-master-pages.nvidia.com/day0_jun5_analysis/ 2. https://docs.google.com/spreadsheets/d/1H-YvO5CDwKoG2IvvNWVdDI7rViW1Kc0ayVEJAP7RH_A/edit?gid=30281591#gid=30281591&range=A2 ### Usage N/A — agent skill guidance only. ### Testing - Ran structural validation for all five changed skill packages. - Ran targeted pre-commit hooks on all nine changed files; all passed. - Ran `git diff --check`. I'll test the skill changes by re-running day 0 trials after merging. ### Before your PR is "*Ready for review*" - Is this change backward compatible?: ✅ - If you copied code from any other sources or added a new PIP dependency, did you follow guidance in `CONTRIBUTING.md`: N/A - Did you write any new necessary tests?: N/A — documentation/skill guidance only - Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?: N/A - Did you get Claude approval on this PR?: ❌ — not run ### Additional Information The branch contains one signed commit and excludes WAAP state, test-fixture changes, and example changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Strengthened evaluation workflows with an “External Baseline Sanity Check” requirement and clearer success/failure handling when external verification fails or is inconclusive. * Updated day-0 and compare-results guidance to follow the new gate-driven sequence and to report external reference scores and sanity status. * Refined SciCode instructions to use fixed repeat settings and consistent scoring output. * Expanded PTQ checkpoint validation with downstream serving-readiness canary requirements. * Enhanced quantization recipe search with a layer-position axis, positional exclusion rules, and stricter promotion criteria. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Chad Voegele <cvoegele@nvidia.com>
1 parent 0593df0 commit 089c06e

9 files changed

Lines changed: 200 additions & 40 deletions

File tree

.agents/skills/compare-results/SKILL.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ change is being measured, typically a further quantized version of the baseline.
3232
5. For each task, use the canonical score field from the matching
3333
`.agents/skills/evaluation/recipes/tasks/<task>.md` Score Extraction
3434
section.
35-
6. Compute exact deltas outside the chat context when there are multiple tasks
35+
6. Read and perform `.agents/skills/evaluation/references/run-validation.md`
36+
**External Baseline Sanity Check**. Record each source URL, protocol
37+
difference, and task status before applying the candidate-delta gate. A
38+
failed baseline blocks a success verdict; correct and rerun it first. If no
39+
credible comparable reference exists, label the baseline externally
40+
unverified rather than claiming the check passed, then continue using the
41+
validated measured baseline.
42+
7. Compute exact deltas outside the chat context when there are multiple tasks
3643
or repeated runs.
37-
7. Report comparability and quantized-feasibility verdicts before interpreting
38-
the delta as model quality. If the user did not provide an acceptance
39-
threshold, report feasibility as inconclusive instead of inventing one.
44+
8. Report comparability, external baseline sanity, and quantized-feasibility
45+
verdicts before interpreting the delta as model quality. If the user did not
46+
provide an acceptance threshold, report feasibility as inconclusive instead
47+
of inventing one.
4048

4149
## Comparability Checklist
4250

@@ -64,17 +72,31 @@ the validated runs are comparable:
6472
precision the baseline is**, and apply the gate relative to that baseline
6573
rather than to an assumed BF16.
6674

75+
For SciCode, keep `num_repeats: 1` to limit sandbox workload. If variance is a
76+
concern, run multiple independent matched baseline/candidate pairs instead of
77+
increasing repeats within one run.
78+
6779
If any item differs, either rerun with matched settings or label the result as
6880
not an apples-to-apples quantization comparison.
6981

82+
These checks compare the baseline and candidate to each other. The external
83+
baseline check in `evaluation/references/run-validation.md` separately tests
84+
whether the baseline's absolute score is credible; both guards must be reported.
85+
7086
## Report Format
7187

7288
Include:
7389

7490
- Baseline and candidate identifiers.
7591
- Per-task metric path, baseline score, candidate score, delta, and stderr if
7692
available.
93+
- Per-task external reference score, source URL, known protocol differences,
94+
percentage-point difference, and sanity status (`verified`, `failed`, or
95+
`externally unverified`).
7796
- Comparability status for prompt/template, generation settings, sample counts,
7897
reasoning handling, judge/simulator setup, and score field.
7998
- Comparability verdict: comparable, not comparable, or inconclusive.
8099
- Quantization feasibility verdict: acceptable, not acceptable, or inconclusive.
100+
Never report `acceptable` when external baseline sanity failed. An externally
101+
unverified baseline does not block `acceptable`; apply the candidate-delta
102+
gate and report the missing external corroboration.

.agents/skills/day0-release/SKILL.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ progress:
5252
- [ ] Step 0: Resolve inputs; confirm threshold and eval set
5353
- [ ] Step 1: Setup gate — creds present, cluster reachable
5454
- [ ] Step 2: PTQ (ptq skill) → gate_ptq.py
55-
- [ ] Step 3: Baseline eval (evaluation skill, deploys source) → gate_run.py [skip if cached, see below]
55+
- [ ] Step 3: Baseline eval (evaluation skill, deploys source) → gate_run.py
5656
- [ ] Step 4: Quantized eval (evaluation skill, deploys candidate) → gate_run.py
57-
- [ ] Step 5: Compare (compare-results skill) → gate_compare.py → decision
57+
- [ ] Step 5: Compare (compare-results skill) → external sanity → gate_compare.py → decision
5858
- [ ] Step 6: Closeout — report + publish recommendation
5959
```
6060

@@ -83,10 +83,8 @@ unvalidated checkpoint.
8383
### Step 3 — Baseline eval
8484

8585
The baseline is the **source** (pre-quantization) model on the same task set and
86-
sampling params. **Look it up first** — if a matching baseline run already
87-
exists in MLflow (same model, task set, sampling params), reuse it and skip this
88-
stage. Otherwise run it via the **evaluation** skill (which deploys the source
89-
model itself). Gate with `gate_run.py`.
86+
sampling params. Always run a fresh baseline via the **evaluation** skill,
87+
which deploys the source model itself. Gate with `gate_run.py`.
9088

9189
### Step 4 — Quantized eval
9290

@@ -110,7 +108,14 @@ dropped samples) — do **not** compare scores from it.
110108

111109
### Step 5 — Compare
112110

113-
Invoke the **compare-results** skill to produce per-task deltas, then gate:
111+
Invoke the **compare-results** skill. It must perform the shared external
112+
baseline sanity check before the candidate-delta gate. A failed check is
113+
`ANOMALOUS` with failure class `EXTERNAL_BASELINE_MISMATCH`: investigate and
114+
rerun the baseline. If no credible comparable external score exists, record the
115+
baseline as externally unverified and continue using the validated measured
116+
baseline.
117+
118+
After recording the external status, produce per-task deltas and run:
114119

115120
```bash
116121
python .agents/skills/day0-release/scripts/gate_compare.py \
@@ -125,22 +130,25 @@ normalizes the drop accordingly, so `--threshold 0.01` means "≤1 pt on a 0-100
125130
task / ≤0.01 on a 0-1 task" uniformly. Pass `--scales '{"task": max}'` to
126131
override inference if a task's scores happen to fall in an ambiguous range.
127132

128-
Decision from `gate_compare.py`:
133+
`gate_compare.py` checks only the candidate delta; it cannot override a failed
134+
external baseline check. Combined decision:
129135

130-
- **ACCEPT** — every task within threshold → go to Step 6.
136+
- **ACCEPT** — no external check failed and every task is within the candidate
137+
threshold → go to Step 6. A missing comparable external score is not a
138+
failure; report it as externally unverified.
131139
- **REGRESSION** — one or more tasks exceed threshold. **v1 stops here and
132140
reports** which tasks regressed by how much. (Picking the next recipe and
133141
re-running is deferred — see Scope.)
134-
- **ANOMALOUS**scores present but implausible (e.g. baseline lower than
135-
candidate by a large margin, or a task score outside its valid range) →
136-
surface to the user.
142+
- **ANOMALOUS**external baseline sanity failed, or scores are otherwise
143+
implausible (e.g. baseline lower than candidate by a large margin, or a task
144+
score is outside its valid range) → correct the baseline or surface it.
137145

138146
### Step 6 — Closeout
139147

140148
Report the decision with: source vs output size + ratio, per-task baseline /
141-
candidate / delta / within-threshold, MLflow run IDs, and a publish
142-
recommendation (publish / do-not-publish / needs-human). Archive artifacts to
143-
the workspace.
149+
candidate / delta / within-threshold, external source and sanity status, MLflow
150+
run IDs, and a publish recommendation (publish / do-not-publish).
151+
Archive artifacts to the workspace.
144152

145153
## Triage (gate failure → decision)
146154

@@ -154,8 +162,9 @@ Map a gate's `failure_class` to the next action:
154162
| `DEPLOYMENT_HEALTH_FAILED` | Drop to the **deployment** skill: reproduce serving standalone (`/health` + one generation), debug flags / image / TP / env, then carry the working command into NEL's `deployment.command` and retry the eval. If it can't serve, `POINT_INFEASIBLE`. |
155163
| `EVAL_JUDGE_FAILED` | Usually transient (auth / rate limit) — wait and retry. |
156164
| `SAMPLE_ACCOUNTING_FAILED` | Investigate dropped/failed samples before trusting scores. |
157-
| `USER_CONFIG_ERROR` | Stop and ask the user. |
158-
| `UNKNOWN` | Stop and surface to the user (`NEEDS_HUMAN`). |
165+
| `EXTERNAL_BASELINE_MISMATCH` | Investigate baseline configuration, correct it, rerun the baseline, and repeat external sanity before comparison. |
166+
| `USER_CONFIG_ERROR` | Correct it from the request, workspace, or model/config metadata and retry; if irrecoverable, return `ANOMALOUS` with evidence. |
167+
| `UNKNOWN` | Investigate with the owning domain skill; if unresolved, return `ANOMALOUS` with the evidence and next automated retry or patch action. |
159168

160169
`SYSTEMIC` (cluster down, dataset unavailable) aborts the whole run.
161170
`POINT_INFEASIBLE` means this (model, recipe) can't work as configured.
@@ -166,7 +175,7 @@ Return a decision, not a raw artifact:
166175

167176
- `ACCEPT` + report + publish recommendation
168177
- `REGRESSION` + which tasks failed the threshold and by how much
169-
- `ANOMALOUS` / `INFEASIBLE` / `NEEDS_HUMAN` + reason
178+
- `ANOMALOUS` / `INFEASIBLE` + reason and next automated action
170179
- Always: workspace path + MLflow run IDs for traceability
171180

172181
## Scope (v1)

.agents/skills/evaluation/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ Remove `limit_samples` overrides; keep canary-validated parallelism. If the cana
409409

410410
### Step 9 — Verify completed run
411411

412-
Before pulling/reporting scores, validate the run. Read `references/run-validation.md` for NEL timeout/resume behavior, completed-run validation, diagnostics, score harvesting, and the handoff to `compare-results` for baseline-vs-candidate deltas.
412+
Before pulling/reporting scores, validate the run. Read `references/run-validation.md` for NEL timeout/resume behavior, completed-run validation, diagnostics, and score harvesting. For a baseline that will be compared with a candidate, also perform its **External Baseline Sanity Check** before a success verdict, then hand the validated runs to `compare-results` for baseline-vs-candidate deltas.
413413

414414
---
415415

.agents/skills/evaluation/recipes/tasks/aa/scicode.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ harvesting requirements beyond the task YAML fragment.
1717
multi-step prompts can exceed 32K). The example template's default of
1818
`--max-model-len 131072` satisfies this and is preferred — do not lower
1919
it unless you have a memory reason to.
20+
- **Parallelism:** set task-level `parallelism: 8` exactly. Use the same value
21+
for baseline and candidate.
2022

2123
## YAML Fragment
2224

@@ -28,13 +30,12 @@ Use this inside the top-level `evaluation.tasks` list:
2830
nemo_evaluator_config:
2931
config:
3032
params:
33+
parallelism: 8
3134
extra:
3235
args: ++prompt_config=eval/scicode/default ++with_background=true
33-
num_repeats: 8
36+
num_repeats: 1
3437
```
3538
3639
## Score Extraction from mlflow
3740
38-
Result (0-100): `scicode_pass_at_1_avg-of-N_subtask_accuracy`
39-
40-
N is the repeat count. If the repeat count is unknown, use the highest available `avg-of-N`.
41+
Result (0-100): `scicode_pass_at_1_avg-of-1_subtask_accuracy`

.agents/skills/evaluation/references/run-validation.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,55 @@ accounting, reasoning/answer parsing status, and any errors or warnings found.
3535
If any validation item fails, either rerun/fix it or label the result as
3636
incomplete or invalid.
3737

38+
## External Baseline Sanity Check
39+
40+
For a baseline-vs-candidate comparison, perform this check after run validation
41+
and before applying the candidate-delta gate or issuing a success verdict. This
42+
is additional to, not a replacement for, the apples-to-apples and baseline
43+
precision checks in `compare-results`.
44+
45+
For each baseline task:
46+
47+
1. Search for a published score for the exact model in its Hugging Face model
48+
card and on Artificial Analysis (<https://artificialanalysis.ai/>); use
49+
either credible source. A score for a sibling size, release, or precision is
50+
not an exact-model reference.
51+
2. Match model variant, benchmark and version, metric, reasoning/thinking mode,
52+
prompt and chat template, sampling and token budget, sample count, and
53+
evaluation protocol as closely as possible. Record the external score,
54+
source URL, and every known protocol difference. Do not treat a mismatched
55+
result as directly comparable; find a closer source or mark the task
56+
externally unverified.
57+
3. Put both scores on a 0-100 scale, then calculate, for higher-is-better
58+
metrics:
59+
60+
```text
61+
difference (pp) = abs(measured baseline - external)
62+
```
63+
64+
Treat a credible comparable result as verified only when the absolute
65+
difference is approximately 5 percentage points or less. A difference
66+
greater than approximately 5 points fails the check even if the candidate is
67+
within its normal delta gate (for example, `<1pp`). For an external score of
68+
60, the approximate range is 55-65; a baseline of 54 is 6 points away and
69+
fails.
70+
71+
Report each task as `verified`, `failed`, or `externally unverified`. A large
72+
upward difference also does not establish a clean match; investigate protocol
73+
differences before marking it verified. If no credible comparable score exists,
74+
state `externally unverified` and do not invent a reference or claim the sanity
75+
check passed. This status does not block comparison or publication: use the
76+
validated measured baseline, apply the candidate-delta gate, and report that no
77+
external corroboration was available. Only a `failed` external check blocks the
78+
comparison.
79+
80+
If any task fails, do not report the quantized evaluation as successful and do
81+
not apply the candidate-delta gate to that baseline. Investigate disabled
82+
reasoning/thinking, reasoning parser or adapter handling, prompt/chat-template
83+
differences, sampling or token-budget differences, benchmark version or metric,
84+
incomplete samples, and serving failures. Rerun a corrected baseline, validate
85+
it, and repeat this check before comparing the candidate.
86+
3887
For score harvesting, use the `Score Extraction` section from the matching task
3988
reference in `recipes/tasks/<task>.md`. Do not rely on ad hoc `results.yml`
4089
greps when a task reference defines the canonical score and stderr fields.

.agents/skills/ptq/SKILL.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
---
22
name: ptq
3-
description: This skill should be used when the user asks to "quantize a model", "run PTQ", "post-training quantization", "NVFP4 quantization", "FP8 quantization", "INT8 quantization", "INT4 AWQ", "quantize LLM", "quantize MoE", "quantize VLM", or needs to produce a quantized HuggingFace or TensorRT-LLM checkpoint from a pretrained model using ModelOpt.
3+
description: >-
4+
Use when the user asks to "quantize a model", "run PTQ", "post-training
5+
quantization", "NVFP4 quantization", "FP8 quantization", "INT8
6+
quantization", "INT4 AWQ", "quantize LLM", "quantize MoE", "quantize VLM",
7+
or needs to produce a quantized HuggingFace checkpoint from a pretrained
8+
model using ModelOpt. Do NOT use for multi-candidate recipe
9+
exploration or optimization (use quant-recipe-search).
410
---
511

612
# ModelOpt Post-Training Quantization
713

814
Produce a quantized checkpoint from a pretrained model. **Read `examples/hf_ptq/README.md` first** — it has the support matrix, CLI flags, and accuracy guidance.
915

16+
Use `quant-recipe-search` for multi-candidate recipe exploration or
17+
optimization. Use this skill for each selected recipe's PTQ run.
18+
1019
## Step 1 — Environment
1120

1221
Read `skills/common/environment-setup.md` and `skills/common/workspace-management.md`. After completing them you should know:
@@ -75,6 +84,24 @@ If the source checkpoint is already quantized and the requested recipe/config re
7584
For **listed models** (4A/4B): run full calibration directly (`--calib_size 512`).
7685
For **unlisted models** (4C): run a smoke test first (`--calib_size 4`), wait for success, then full calibration.
7786

87+
### Recommended calibration datasets
88+
89+
- **Text-only LLM PTQ:** Prefer the representative `nemotron-post-training-v3` blend. `modelopt/torch/utils/dataset_utils.py` expands it to seven registered Nemotron SFT domains. Configure Hugging Face credentials where required.
90+
91+
```bash
92+
python examples/hf_ptq/hf_ptq.py ... \
93+
--dataset nemotron-post-training-v3
94+
```
95+
96+
- **VLM PTQ:** Include image-text calibration with `--calib_with_images`. This path uses `nemotron_vlm_dataset_v2` with the current default subsets `sparsetables`, `plotqa_cot`, and `wiki_en`; `examples/hf_ptq/hf_ptq.py` and `modelopt/torch/utils/vlm_dataset_utils.py` are the source of truth.
97+
98+
```bash
99+
python examples/hf_ptq/hf_ptq.py ... \
100+
--calib_with_images
101+
```
102+
103+
`--dataset` selects text-only calibration and cannot substitute for multimodal examples. Use `--dataset cnn_dailymail` only as a fallback when representative data is unavailable, such as without gated-data access or with only a local public cache.
104+
78105
### Which path?
79106

80107
```text
@@ -138,17 +165,16 @@ Report the path and size to the user.
138165

139166
### Post-quantization validation
140167

141-
This is a required gate before any deployment or evaluation submission. Do not submit an eval, start a serving job, or hand off the checkpoint as ready until the gate has passed.
168+
This is a required gate before any deployment or evaluation submission. Do not submit an eval, start a production serving job, or hand off the checkpoint as ready until the gate, including its serving canary, has passed.
142169

143-
Read `references/checkpoint-validation.md` and perform all three validation groups on the exact checkpoint path that will be deployed/evaluated:
170+
Read `references/checkpoint-validation.md` and perform all four validation groups on the exact checkpoint path that will be deployed/evaluated:
144171

145172
1. Check output size and estimated bits per weight against the baseline/source checkpoint.
146173
2. Check quantized-weight coverage against the requested qformat/recipe/config.
147174
3. Check metadata consistency against the baseline/source model.
175+
4. Complete the required downstream handoff and serving-readiness validation.
148176

149-
Report the gate result before moving on. The report must include source size, output size, output/source size ratio, layer precision counts (for example NVFP4, FP8, INT4, BF16/unquantized excluded, unexpected unquantized, declaration mismatches), and metadata diffs. If the output/source ratio is >= 1.0 for a compression recipe, if any intended layer group is missing quantization, or if metadata changed unexpectedly, stop and fix the checkpoint or ask the user before proceeding.
150-
151-
**Next steps**: If the user wants to deploy or evaluate the quantized checkpoint, use the **deployment** or **evaluation** skill. The checkpoint workspace carries over. If the model required patches during PTQ (e.g., transformers upgrade), the same fixes will likely be needed at deployment and evaluation time.
177+
Report the gate result before moving on. Follow the canonical report format and all blocking conditions in `references/checkpoint-validation.md`; do not hand off a checkpoint unless every required check passes.
152178

153179
## Key API Rules
154180

@@ -163,7 +189,7 @@ Report the gate result before moving on. The report must include source size, ou
163189

164190
- **Model-specific dependencies**: Models with `trust_remote_code` may import packages not in the container (e.g., `mamba-ssm` for hybrid Mamba models). See Step 2.5. Use `EXTRA_PIP_DEPS` env var with the launcher, or install manually before running `hf_ptq.py`
165191
- **Transformers version**: New models may need a newer version of transformers than what's installed. Check `config.json` for `transformers_version`. In containers, beware of `PIP_CONSTRAINT` blocking upgrades — see `references/slurm-setup-ptq.md` for workarounds
166-
- **Gated datasets**: Some calibration datasets require HF authentication. Ensure `HF_TOKEN` is set in the job environment, or use `--dataset cnn_dailymail` as a non-gated alternative
192+
- **Gated datasets**: Some calibration datasets require HF authentication. Set `HF_TOKEN` in the job environment. Use `--dataset cnn_dailymail` only as the constrained-environment fallback described in Step 4, not as the preferred calibration set
167193
- **NFS root_squash + Docker**: See `skills/common/slurm-setup.md` section 5
168194

169195
## References

0 commit comments

Comments
 (0)