Downloads · 30 days
73.1K
23% of all-time downloads
nvidia/Nemotron-Labs-Diffusion-3B
Nemotron-Labs-Diffusion-3B is a text generation model from nvidia. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
<div align="center" style="line-height: 1;" <a href="https://d1qx31qr3h6wln.cloudfront.net/publications/NemotronDiffusionTechReport.pdf?VersionId=1tm4XZATEzGV7cs51XAf.xmWupU20vYW" target="blank" style="margin: 2px;" <…
Downloads · 30 days
73.1K
23% of all-time downloads
All-time downloads
313K
Public
Parameters
3.8B
15.5 GB on disk
Likes
43
Public
Click a slice to open those files.
.safetensors7.8 GB · 100%
From the Hugging Face model README
Nemotron-Labs-Diffusion is a tri-mode language model that supports both AR decoding and diffusion-based parallel decoding by simply switching the attention pattern of the same model during inference. The synergy between these two modes enables a third mode, called self-speculation: the same model performs diffusion-based parallel drafting and AR verification with shared KV cache, achieving high acceptance lengths and decoding efficiency. The seamless mode switching by simply changing attention patterns enables high efficiency at different concurrency levels in varying deployment scenarios with one single model.
<div align="center"> <img src="./assets/teaser.png" alt="An illustration of Tri-Mode LMs" width="500"> </div>Use of this model is governed by the NVIDIA Nemotron Open Model License.
transformers>=5.0.0
from transformers import AutoModel, AutoTokenizer
import torch
repo_name = "nvidia/Nemotron-Labs-Diffusion-3B"
tokenizer = AutoTokenizer.from_pretrained(repo_name, trust_remote_code=True)
model = AutoModel.from_pretrained(repo_name, trust_remote_code=True)
model = model.cuda().to(torch.bfloat16)
history = []
user_input = input("User: ").strip()
history.append({"role": "user", "content": user_input})
prompt = tokenizer.apply_chat_template(history, tokenize=False, add_generation_prompt=True)
prompt_ids = tokenizer(prompt, return_tensors='pt').input_ids.to(device='cuda')
## Chat in AR Mode
out_ids, nfe = model.ar_generate(inputs.input_ids, max_new_tokens=512)
## Chat in dLM Mode
out_ids, nfe = model.generate(prompt_ids, max_new_tokens=512, block_length=32, threshold=0.9, eos_token_id=tokenizer.eos_token_id)
## Chat in Linear Self-Speculation Mode
out_ids, nfe = model.linear_spec_generate(prompt_ids, max_new_tokens=512, block_length=32, eos_token_id=tokenizer.eos_token_id)
tokenized_out = tokenizer.batch_decode(out_ids[:, prompt_ids.shape[1]:], skip_special_tokens=True)[0]
print(f"Model: {tokenized_out}")
print(f"[Num Function Eval (NFE)={nfe}]")
An optional LoRA adatper can be applied to the diffusion drafter in the linear self-speculation mode to further increase the acceptance length:
import torch
from transformers import AutoModel, AutoTokenizer
from peft import PeftModel
repo = "nvidia/Nemotron-Labs-Diffusion-3B"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True)
model = model.cuda().to(torch.bfloat16)
# Attach the linear_spec LoRA adapter.
model = PeftModel.from_pretrained(model, repo, subfolder="linear_spec_lora").eval()
# Unwrap so we can call linear_spec_generate directly (it toggles LoRA internally).
base = model.model
history = [{"role": "user", "content": "Solve: What is 15% of 240?"}]
prompt = tokenizer.apply_chat_template(history, tokenize=False, add_generation_prompt=True)
prompt_ids = tokenizer(prompt, return_tensors="pt").input_ids.cuda()
out_ids, nfe = base.linear_spec_generate(
prompt_ids, max_new_tokens=512, block_length=32,
eos_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(out_ids[0, prompt_ids.shape[1]:], skip_special_tokens=True))
print(f"[NFE={nfe}]")
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. For more detailed information on ethical considerations for this model, please see the bias, explainability, safety & security, and privacy subcards.
Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns here.
@techreport{fu2026nemotronlabsdiffusion,
title = {Nemotron-Labs-Diffusion: A Tri-Mode Language Model Unifying Autoregressive, Diffusion, and Self-Speculation Decoding},
author = {Yonggan Fu and Lexington Whalen and Abhinav Garg and Chengyue Wu and Maksim Khadkevich and Nicolai Oswald and Enze Xie and Daniel Egert and Sharath Turuvekere Sreenivas and Shizhe Diao and Chenhan Yu and Ye Yu and Weijia Chen and Sajad Norouzi and Jingyu Liu and Shiyi Lan and Ligeng Zhu and Jin Wang and Jindong Jiang and Morteza Mardani and Mehran Maghoumi and Song Han and Ante Jukic and Nima Tajbakhsh and Jan Kautz and Pavlo Molchanov},
institution = {NVIDIA},
year = {2026},
note = {Technical report}
}