qad

Runs ModelOpt Quantization-Aware Distillation on Slurm through Megatron Bridge to recover PTQ accuracy gaps.

3.7k|576|Updated Apr 23, 2024
One-click install
npx skills add https://github.com/NVIDIA/Model-Optimizer --skill qad
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: qad
Source: https://github.com/NVIDIA/Model-Optimizer/tree/main/plugins/modelopt/skills/qad
Command: npx skills add https://github.com/NVIDIA/Model-Optimizer --skill qad

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Post-training quantization (PTQ) can introduce accuracy regressions relative to BF16 baselines, and recovering that gap requires expensive, carefully orchestrated Quantization-Aware Distillation (QAD) training on multi-node Slurm clusters. This Skill governs the full QAD workflow so it is only launched when explicitly authorized and executed with validated baselines, correct topology, and disciplined stop conditions.

Core Features & Use Cases

  • Gap validation before training: Confirms comparable BF16/PTQ benchmark results and skips QAD when the PTQ gap is already below 1%.
  • Topology and data planning: Derives TP/PP/CP/EP parallelism from model architecture and GPU memory, and prepares a capped tokenized dataset (default Nemotron-Cascade-2 blend) at the target sequence length.
  • Slurm run management: Submits sequential dependent training jobs, monitors loss and checkpoints, evaluates recovery benchmarks at set iterations, and resumes from checkpoints after duration exits.
  • Use Case: After quantizing a model to NVFP4 and measuring a 3% accuracy drop on key benchmarks, use this Skill to run QAD on a Slurm cluster via Megatron Bridge, evaluate checkpoints every 100 iterations, and stop once the gap to BF16 falls below 1%.

Quick Start

Run QAD with ModelOpt on my Slurm cluster to recover the accuracy gap between my BF16 baseline and the PTQ checkpoint of my model.

Frequently Asked Questions about qad

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Quantization-Aware Distillation with NVIDIA Model Optimizer?

Run QAD through the Megatron Bridge examples using quantize.py for PTQ and distill.py for distillation training on Slurm. First confirm a measured BF16-to-PTQ accuracy gap of at least 1%, then prepare the dataset, choose topology, and submit sequential dependent training jobs.

When should I use QAD instead of PTQ for model quantization?

Use QAD only when PTQ leaves an accuracy gap of at least 1% relative to BF16 on your target benchmarks and you explicitly authorize the expensive training run. If the PTQ gap is already below 1%, QAD is not justified.

Does ModelOpt QAD support MoE models and expert parallelism?

Yes, but with constraints: DP and EDP must be integral, num_experts must be divisible by EP, and GBS must be divisible by MBS times DP. Expert tensor parallelism (ETP) must stay at 1 because the current distill.py workflow does not support it.

How do I resume a QAD training job after a Slurm time limit exit?

Resume from the latest QAD checkpoint in the same output directory with unchanged prepared data paths, seed, topology, optimizer, scheduler, iteration, and consumed-sample state. Do not restart from the PTQ checkpoint.

What are the default training settings for ModelOpt QAD?

Defaults include 32768 sequence length, 1e-5 peak and 1e-6 minimum learning rate with cosine schedule, 1000 training iterations, global batch size 512, checkpoints every 50 iterations, and recovery benchmarks at iteration 150 then every 100.

When should a QAD training run be cancelled?

Cancel on non-finite loss, repeated skipped iterations, or a sustained loss spike. Also cancel when the full-suite gap to BF16 drops below 1%, benchmark recovery regresses beyond run noise, or both recovery and loss plateau.