How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture")
model = AutoModelForCausalLM.from_pretrained("soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

GLM-5.3 Tiny NVFP4 MTP Test Fixture

This is a deterministic, random-weight architecture and serving fixture derived directly from the released zai-org/GLM-5.3 config and tokenizer. It uses the GlmMoeDsaForCausalLM architecture, four small backbone layers, eight experts, and one MTP layer in the released model.layers.4 tensor layout. Runtime-critical sparse MLA and DSA dimensions retain the released GLM-5.3 values.

The checkpoint does not inherit GLM-5.3 model weights and is not suitable for quality evaluation. Its purpose is to test end-to-end NVFP4 compression and vLLM MTP speculative decoding without downloading the full GLM-5.3 checkpoint.

Compression Recipe

The backbone is calibrated and quantized inside oneshot. The mtp_scheme argument asks the same call to compress the MTP weights during post-processing.

from datasets import Dataset
from transformers import AutoModelForCausalLM

from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import QuantizationModifier
from llmcompressor.utils import load_context

model_id = "/path/to/glm-5.3-tiny-mtp-source"
dataset = Dataset.from_dict(
    {
        "text": [
            "Explain why speculative decoding can reduce inference latency.",
            "Write a short Python function that adds two integers.",
            "Summarize the benefits of mixture-of-experts language models.",
            "What is the capital of France?",
            "List three considerations when deploying a language model.",
            "Describe the difference between weights and activations.",
            "Complete the sequence: one, two, three, four.",
            "Give a concise definition of quantization calibration.",
        ]
    }
)

recipe = QuantizationModifier(
    targets="Linear",
    scheme="NVFP4",
    ignore=[
        "lm_head",
        r"re:.*mlp\.gate$",
        r"re:.*self_attn\.indexer\.(?:weights_proj|wk)$",
    ],
)

with load_context(AutoModelForCausalLM):
    model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16")
model.generation_config.top_p = None

oneshot(
    model=model,
    recipe=recipe,
    dataset=dataset,
    output_dir="GLM-5.3-MTP-NVFP4-Test-Fixture",
    max_seq_length=128,
    num_calibration_samples=len(dataset),
    moe_calibrate_all_experts=True,
    mtp_scheme="NVFP4",
)

Transformers does not construct the MTP layer, so it cannot observe MTP activations during calibration. The MTP group is therefore weight-only NVFP4; the backbone remains calibrated W4A4 NVFP4.

Validation

  • All 562 indexed tensors are present, with no missing or unindexed tensors.
  • 105 backbone linears have NVFP4 packed weights, block scales, global scales, and calibrated input global scales.
  • 33 MTP projections have NVFP4 packed weights, block scales, and global scales in model_mtp.safetensors; no uncalibrated MTP activation scales are stored.
  • The NVFP4 checkpoint passed vLLM MTP speculative decoding on H100 with the Marlin FP4 fallback and one speculative token.
  • Native W4A4 NVFP4 execution on Blackwell remains the final hardware smoke test.

vLLM

vllm serve soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture \
  --speculative-config '{"method":"mtp","num_speculative_tokens":1}'
Downloads last month
63
Safetensors
Model size
0.3B params
Tensor type
F32
·
BF16
·
U8
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture

Base model

zai-org/GLM-5.3
Quantized
(125)
this model

Collection including soyrsoyr/GLM-5.3-MTP-NVFP4-Test-Fixture