Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changelog
**New Features**

- Extend Claude Code agent skills for PTQ, deployment, evaluation, monitoring, and baseline-vs-quantized result comparison. Adds evaluation task references for additional benchmarks, stronger PTQ checkpoint validation gates, and session-scoped workspace/job tracking.
- Add ``examples/alpamayo`` showing FP8, NVFP4, and AutoQuantize (mixed-precision) quantization of the Alpamayo (formerly Alpamayo-R1) ~10B vision-language-action model, with a joint VLM + diffusion calibration loop and both fake-quant and ``--real-quant`` packed-checkpoint export. See `examples/alpamayo/README.md <https://github.com/NVIDIA/Model-Optimizer/tree/main/examples/alpamayo>`_ for details.
- Add SLURM Quality of Service (QoS) support to the ModelOpt launcher. Users can set QoS via ``slurm_config.qos`` or ``SLURM_QOS`` and the value is forwarded to ``nemo_run.SlurmExecutor``.
- Add composable ``$import`` system for recipe YAML configs, enabling reusable config snippets referenced via ``{$import: name}`` markers. All built-in PTQ recipes converted to use imports with shared snippets under ``modelopt_recipes/configs/`` (numeric formats, quant_cfg building blocks, presets). See :ref:`composable-imports`.
- Add offline DFlash speculative decoding training. Train the draft module from pre-computed base-model hidden states dumped by ``examples/speculative_decoding/collect_hidden_states/compute_hidden_states_hf.py``; base-model transformer layers are deleted after conversion to save memory. Controlled by the auto-derived ``dflash_offline`` flag on ``DFlashConfig`` (derived from ``data_args.offline_data_path``). The dump scripts now share ``collect_hidden_states/common.py`` for aux-layer selection (``--aux-layers eagle|dflash|<list>``) and optional assistant-token ``loss_mask`` for answer-only-loss training.
Expand Down
Binary file not shown.
72 changes: 72 additions & 0 deletions examples/alpamayo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Quantizing Alpamayo 1

[Alpamayo 1](https://github.com/nvlabs/alpamayo) (formerly Alpamayo-R1) is a
~10B vision-language-action model trained by NVIDIA for autonomous vehicle
research. It takes multi-camera video and egomotion history as input and
produces a Chain-of-Causation reasoning trace plus a future driving trajectory.
See the paper, [*Alpamayo-R1: Bridging Reasoning and Action Prediction for
Generalizable Autonomous Driving in the Long
Tail*](https://arxiv.org/abs/2511.00088), and the
[nvlabs/alpamayo](https://github.com/nvlabs/alpamayo) repository for details.

This example produces FP8, NVFP4, and mixed-precision quantized checkpoints of
Alpamayo using ModelOpt. Quantization calibration runs on a small dataset of 16
AV clips (`0417_16rows_train_set_for_calibration_25.10.parquet`).
Comment on lines +13 to +14
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a public dataset? I would prefer not to keep this in our repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parquet file contains clip IDs (which can be publicly shared), the actual driving clips are on HF in the publicly available data nvidia/PhysicalAI-Autonomous-Vehicles


## Setup

Clone Alpamayo and install it into the current environment so `alpamayo_r1` is
importable:

```bash
git clone https://github.com/nvlabs/alpamayo # tested @ 4cda35d
pip install ./alpamayo
Comment thread
rohansjoshi marked this conversation as resolved.
```

Follow the Alpamayo README to request access to the gated model weights and the
Physical AI AV dataset, then authenticate with `hf auth login`.

## Usage

`quantize.py` loads an Alpamayo checkpoint, calibrates it on the 16 clips, and
exports an HF-style quantized checkpoint.

### FP8 / NVFP4

By default the script saves **fake-quantized** weights (fp16 weights plus
quantizer state) — useful for accuracy evaluation:

```bash
python quantize.py --ckpt nvidia/Alpamayo-R1-10B --output-dir ./alpamayo-fp8 --quantize fp8
```

Pass `--real-quant` to save **real-quantized** weights packed into the
low-precision storage format (NVFP4 = E2M1 nibbles + per-block FP8 scales),
which run on the hardware low-precision GEMM path:

```bash
python quantize.py --ckpt nvidia/Alpamayo-R1-10B --output-dir ./alpamayo-nvfp4 --quantize nvfp4 --real-quant
```

The vision tower is always kept in high precision, and small action-projection
heads whose dimensions are not multiples of 16 are left unquantized (they break
the real-quant GEMM backends).

### AutoQuantize (mixed precision)

`--quantize auto` runs ModelOpt's AutoQuantize, which searches per layer between
NVFP4 and FP8 under an effective-bits budget (`--auto_quantize_bits`, default
6.5):

```bash
python quantize.py --ckpt nvidia/Alpamayo-R1-10B --output-dir ./alpamayo-auto --quantize auto --auto_quantize_bits 6.5
```

AutoQuantize chooses a per-layer format using a **gradient-based sensitivity
score**: it backpropagates a loss through the model and estimates how much each
candidate format perturbs that loss, then picks the cheapest assignment that
stays within the bit budget. Here the loss is the flow-matching objective — an
MSE between the action expert's predicted velocity field `v_pred` and the
target `v_target = x_1 - x_0` from a teacher-forced forward pass on the
calibration clips. Layers the loss is sensitive to keep more bits (FP8); the
rest go to NVFP4.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any inference runtime available for the quantized checkpoint?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I'm aware of, there are just some PyTorch eval scripts lying around in different repos. I have validated accuracy of the FP8, NVFP4, and AutoQuant (6.5 bpe) checkpoints.

Loading
Loading