Nemotron-Labs-Diffusion-3B โ ONNX for Nsight experiments
An experimental, numerically checked export of NVIDIA's 3B checkpoint, intended for graph inspection and forward-pass experiments in Nsight Deep Learning Designer and ONNX Runtime. This is a community conversion, not an official NVIDIA ONNX release or a drop-in Transformers text-generation pipeline.
Source revision: 0d51902da1f8869f83413ce642fab402fa5641e0.
Actual parameter count: 3,831,659,520. Source weights are BF16; the baseline
here converts them to FP16. No fine-tuning or training was performed.
Which file to open
| Graph | Required external weights in the same folder | Weight bytes | Status |
|---|---|---|---|
model_fp16.onnx |
model.fp16.data |
7,663,319,040 | Recommended baseline |
model_int8_qdq.onnx |
model.int8.data |
4,638,726,144 | Experimental INT8 weights |
model_int4_qdq.onnx |
model.int4.data |
3,171,317,760 | Experimental INT4; appreciable logit changes |
FP16 uses standard ONNX opset 18, IR 10; quantized variants use opset 21,
IR 10. Keep each graph beside its matching data file. Do not rename just one.
Quantization uses standard DequantizeLinear nodes, not ORT-only MatMulNBits.
INT8 uses symmetric per-output-channel RTN; INT4 uses symmetric blockwise RTN
with 128-weight groups along the MatMul reduction dimension. 182 transformer
linear matrices are quantized. Embeddings, output head, normalization weights,
activations, and KV caches remain FP16 (normalization/softmax internals use FP32).
Quantized storage does not imply an equivalent VRAM reduction or speedup. An inference backend can expand constant weights or introduce CPU/GPU transfers. The tested ORT QDQ execution emitted memory-copy warnings; these graphs favor inspectability over optimized deployment. Treat INT4 as an experiment, not an accuracy-equivalent replacement. No broad quality benchmark has been run.
Validation
On an NVIDIA A100-SXM4-40GB, PyTorch 2.11.0+cu128, Transformers 5.0.0, ONNX 1.18.0, and ONNX Runtime GPU 1.23.2:
- FP16 passed six comparisons against the original model loaded in FP16, eager attention, plus a cached-vs-one-shot consistency check.
- All tested positions had the same top-1 token. Logit RMSE ranged from 0.000987 to 0.011174; relative L2 error was at most 0.004368.
- All three greedy generation smoke tests matched the reference token-for-token, including 64 tokens across two complete 32-token blocks with EOS stopping disabled for that test. This is not a task-quality benchmark.
- INT8 and INT4 execute and generate text. INT8 top-1 agreement in the six fixed-input tests ranged from 84.375% to 100%; INT4 ranged from 0% (the single-BOS-token fixture) to 100%. The fully masked 32-position fixture was 84.375% for INT8 and 34.375% for INT4. See the complete per-case reports.
Read validation_fp16.json, validation_int8.json, and validation_int4.json
for measurements and generated texts. Validation is against an FP16 reference,
not a proof of equality with NVIDIA's BF16/SDPA execution. Context tests are
short; a synthetic position-offset test crosses 16,384 to exercise query
scaling, but this does not validate a full 16K or 262K context.
All three graphs parsed successfully with TensorRT 10.13.3.9 (zero parser
errors). validation_tensorrt.json records these parser-only checks. This does
not establish successful engine building, numerical parity, or runtime
performance. The Designer GUI itself has not been exercised by this export run.
In Nsight Deep Learning Designer
- Download a graph and its matching external data file into the same directory.
- Open
model_fp16.onnxfirst. Operator names retain the original layer paths. - Configure concrete shapes for profiling.
example_inputs/prefill_prompt/,example_inputs/diffusion_32/, andexample_inputs/causal_commit/contain real example input tensors as.npyfiles, with shapes ininputs.json. - Supply the named inputs to your profiling workflow. If the installed
Designer version requires a different input container, convert the
.npyarrays without changing names, shapes, or dtypes. The included inputs are a data interchange package, not a claim of automatic GUI import.
The graph represents one forward pass. The attention pattern is an input, so both inference modes can be inspected using the same weights. Full text generation requires an external loop; Designer profiling a single graph does not implement that loop automatically. Graph editing does not require a GPU; GPU profiling requires a suitable target. Colab conversion is separate from configuring Designer's remote profiling connection.
Tensor contract
| Input | Type | Shape |
|---|---|---|
input_ids |
int64 | [B,Q] |
position_ids |
int64 | [B,Q], absolute positions |
attention_mask |
float16 | [B,1,Q,P+Q], additive |
past_key_i, past_value_i |
float16 | [B,8,P,128], i=0..25 |
Outputs are logits of shape [B,Q,131072] and present_key_i /
present_value_i of shape [B,8,P+Q,128]. Use zeros for allowed attention
entries and a sufficiently negative value (the driver uses -65504) for blocked
entries. Prefill uses P=0; empty cache inputs must still be supplied.
Only batch size 1 has been numerically validated. Variable lengths are supported
by the graph; padded batches and arbitrary user masks are not validated.
For denoising, current block queries attend to the committed prefix and all current block positions. Discard the returned denoising cache. After the block is finalized, run it again with a causal mask and retain that cache. The caller owns cache commitment. This is essential to preserve NVIDIA's decoding behavior. YaRN and the extra position-dependent query scale are preserved; do not remove the associated config fields to silence warnings.
Text demonstration
Install the dependencies in requirements.txt and a CUDA-enabled PyTorch build
if running on NVIDIA hardware. CPU execution may be slow and consume substantial
RAM; CUDA was the validated provider.
python generate.py --model model_fp16.onnx --prompt "What is 2 + 2? Answer briefly." --max-new-tokens 64
The provided driver uses greedy, confidence-threshold diffusion by default.
max-new-tokens must be a multiple of 32. The low-level driver also exposes
causal prefill, block commit, and raw forward calls. It does not implement
NVIDIA's LoRA-enhanced self-speculation loop, learned sampler, or thinking-budget
controls. No learned sampler weights are present in the source checkpoint.
Stochastic RNG streams and broader batching behavior have not been validated.
The NumPy driver transfers caches through host memory between calls. It is a correctness/experimentation driver, not an optimized generation runtime. Use device-resident buffers/I/O binding for performance work and validate changes.
Reproduction and provenance
build_onnx.py explicitly translates the inference arithmetic and streams one
weight at a time to external ONNX data. It bypasses the unsupported
AutoModelForCausalLM loading/export path. Load the pinned upstream model through
AutoModel for reference execution. quantize_qdq.py creates the quantized
variants; validation scripts and manifests record the tests. Default script
paths refer to /content/nemotron_export on Colab; build_onnx.py accepts
--source and --output overrides.
SHA256SUMS.json records artifact checksums. The original model card is retained
as NVIDIA_MODEL_CARD.md; the tokenizer and chat template are copied from the
pinned upstream revision. The source license and its use restrictions continue
to apply: NVIDIA Nemotron Open Model License.
- Downloads last month
- 10
Model tree for IntellAgents/Nemotron-Labs-Diffusion-3B-ONNX-Nsight
Base model
nvidia/Nemotron-Labs-Diffusion-3B