[Performance]: Qwen NVFP4 output-head fallback allocates vocabulary-sized temporaries during CPU loading

Open
#22,927 0 comments 0 reactions 2 assignees View on GitHub

Maintainers usually reply within 1 day

@kaiyux is already working on this.

Since Nov 26, 2026.

  • #22928 by @HaoyangPing0324 — open

Assessment

This issue has not been assessed yet.

Description

General perf Investigating Performance triaged
Proposal to improve performance

When a Qwen3.5-family checkpoint has a packed NVFP4 output head and the loader needs to expand it on CPU, the fallback creates a full FP32 weight matrix, integer lookup indices, and another full-size scaling result before casting. For the 248,320 × 2,048 head, the final BF16 output alone is 970 MiB. The temporary allocations add pressure during model loading.

To reproduce, pass a packed uint8 lm_head.weight, FP8 block scales, and an FP32 global scale to the Qwen HF mapper with native quantized-head execution disabled. Using deterministic synthetic values of the full checkpoint dimensions, baseline processing took 7.192 s and used a peak process RSS of 5,900,834 KiB (medians of four fresh processes). A bounded row-wise conversion can produce identical bytes with smaller temporary buffers.

Report of performance regression

No response

Misc discussion on performance

No response

Your current environment (if you think it is necessary)

H20 server, Intel Xeon Platinum 8469C, one pinned CPU core, Python 3.12.15, PyTorch 2.14.1+cu130, 8 GiB container, zero visible CUDA devices. Baseline 07f9fea. Inputs matched the physical shape and dtypes of nvidia/Qwen3.6-35B-A3B-NVFP4, revision 1355db6a052410cfd62085d94b58866fd0f2c3c5.

Before submitting a new issue...
  • Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
Dominant language
Python
Stars
15.2k
Forks
3k
Avg merge
2d 21h
Merged PRs (30d)
477

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/TensorRT-LLM

All issues in NVIDIA/TensorRT-LLM

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.