Use AIUnderstand AIBuild with AI
Build with AI·Model deep dive·· 5 min read

Run Clover-35B-A3B-Preview, a Block-Diffusion Language Model

DiffuSpace's Clover-35B-A3B-Preview is a 35B MoE that writes text in diffusion blocks. Install it, run the card's example, and tune block size and threshold.

The code in this post comes from the model's docs and hasn't been run in our CI yet. If something breaks, let us know.

Clover-35B-A3B-Preview is the first model released by DiffuSpace. It is a text-only language model that generates with block diffusion instead of strictly one token at a time. It uses a 35B-parameter mixture-of-experts backbone with about 3B active parameters per token and a 128K-token context window. The card says it delivers state-of-the-art performance among open-source diffusion language models at release, on the benchmarks reported in DiffuSpace’s launch blog. The card itself does not list the scores, so check the blog for the numbers and settings before relying on that claim.

Key specs

Total / active parameters 35B total, about 3B active per token
Base model Qwen/Qwen3.6-35B-A3B
Backbone Hybrid Gated DeltaNet (GDN) / full-attention MoE, 40 layers
Experts 256 routed experts, top-8 token routing, one shared expert per layer
Context Up to 131,072 tokens for prompt and response together
Modality Text only
Library Transformers 5.19.0 and PyTorch 2.10 or later (the card’s example)
Weights in BF16 About 69 GB, plus inference state
License Apache 2.0

How it generates

The card describes block diffusion with LowConfidence decoding in this Hugging Face implementation:

  1. Each block starts as masked tokens.
  2. Positions whose confidence is above a threshold are filled in parallel.
  3. If no position qualifies, the single most confident position is filled so decoding always makes progress.
  4. Once a block is fully resolved, it becomes part of the prefix for the next block.

The defaults are block_size=32 and threshold=0.95. Clover adds learned GDN parameters so tokens can attend to each other inside a noisy block, while the prefix before the block stays causal.

Install

Terminal window
pip install "transformers==5.19.0" accelerate safetensors

Install PyTorch with CUDA support first. The card’s example uses PyTorch 2.10 or later.

Run it

This is the card’s own quick-start example. The model uses custom code, so it loads with trust_remote_code=True. Read that code before you run it.

clover.py
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Diffuspace/Clover-35B-A3B-Preview"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="cuda:0",
).eval()
messages = [{"role": "user", "content": "What is diffusion?"}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True,
)
inputs = tokenizer(prompt, add_special_tokens=False, return_tensors="pt").to("cuda:0")
output = model.generate(
**inputs,
max_new_tokens=24576,
block_size=32,
threshold=0.95,
do_sample=False,
)
completion = output[0, inputs["input_ids"].shape[1]:]
print(tokenizer.decode(completion, skip_special_tokens=True))

You can also point model_id at a local model directory. Generation defaults load automatically from generation_config.json, and keyword arguments to generate() override them. Requests that exceed the 128K context limit are rejected, and the limit includes the space needed to resolve the final full block.

Adjust the decoding

block_size and threshold are the two keyword arguments the card’s example passes to generate(). The card gives their defaults (32 and 0.95) but does not publish a tuning guide, so measure on your own prompts if you change them. Per the description above, threshold is the confidence cutoff for filling positions in parallel, so a stricter value means fewer positions qualify at each step.

Repetition and length controls are already configured, and the card says no extra arguments are needed for normal use. They also apply during greedy decoding:

Parameter Default
presence_penalty 0.9
frequency_penalty 0.0 (disabled)
repetition_penalty 1.05 (1.0 disables it)
dllm_length_penalty 10.0
dllm_think_end_bias 10.0

Length control starts at 8,192 response tokens (dllm_length_penalty_start) and reaches full strength over 8,192 more (dllm_length_penalty_window). Thinking control starts at 4,096 (dllm_think_end_start) with a 4,096-token window (dllm_think_end_window). These are soft controls. max_new_tokens sets the hard output limit.

Expert selection

During block denoising, Clover can restrict routing to a shared subset of experts per block, so fewer distinct experts are used across the block. Two model configuration settings control it:

  • moe_block_coreset_enabled (default true)
  • moe_block_coreset_top_p (default 0.9)

The selector aggregates the routing scores of each token’s top-8 candidate experts across the block, ranks the experts, and keeps enough to cover the requested fraction of the total. A value of 0.9 means 90% of the aggregated routing mass, not 90% of the experts. Lower values generally select fewer experts, with a possible quality tradeoff. This is separate from the top_p used for token sampling, and it does not shrink the stored or loaded weights, so it will not reduce the memory you need to load the model.

Gotchas

  • Memory. About 69 GB for the BF16 weights alone, plus inference state. The card does not describe a smaller configuration.
  • Custom code. trust_remote_code=True is required. Review the repository files first.
  • Pinned versions. The example uses transformers==5.19.0 and PyTorch 2.10 or later.
  • Repetition in very long outputs. The card says very long generations can sometimes become repetitive, which is why the repetition penalties and end-of-response biases are on by default.
  • Results can differ between backends. The Hugging Face path is a standalone PyTorch implementation. Small numerical differences from SGLang’s kernels can change the generated text even with the same decoding settings.
  • Text only. There is no image or audio input.
  • Preview release. The model name marks it as a preview.

For serving and evaluation

The card recommends DiffuSpace’s official SGLang implementation for serving and evaluation, and points to the official code repository for setup and the supported decoding modes. That repository also has the SGLang and llama.cpp implementations of self-speculative decoding. The card does not show those commands, so follow the repository’s instructions instead of guessing at them.

When to pick it

Pick Clover if you want to experiment with a diffusion language model that has a long context window and a modest active-parameter count, and you have a GPU that fits roughly 69 GB of weights plus working memory. It is a reasonable model to try if block-level parallel decoding is the thing you want to study.

Don’t pick it if you need a model that handles images, audio or video, if you can’t spare about 69 GB of GPU memory, or if you need a stable production release. For production serving, use the SGLang route the card recommends. Run your own evaluation before relying on the benchmark claim, since the scores are in the launch blog rather than on the card.

Related