Instructions to use dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP") model = AutoModelForMultimodalLM.from_pretrained("dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP
- SGLang
How to use dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP with Docker Model Runner:
docker model run hf.co/dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP
Qwen3.8-27B-Text-NVFP4-MTP — an experiment
An NVFP4-quantized, text-only build of Qwen/Qwen3.8-27B: vision
tower removed, MTP head grafted back in bf16 so vLLM speculative decoding works, exported in modelopt
format for the native NVFP4 path on NVIDIA Blackwell / SM120.
TL;DR
This repo exists to answer one question: on a 32 GB Blackwell card (RTX 5090), does physically stripping the
vision tower give you more context or more speed? It doesn't — it only removes the 921 MB vision tower
from the download (nothing at runtime), because vLLM already skips that tower at load when you pass
--language-model-only. Note this build also grafts back an 849 MB bf16 MTP head, so the net file is only
~0.95 GB smaller than a build that carries both vision and MTP (e.g. the gittensor build below).
Recommendation: on 32 GB, run the full multimodal build instead and toggle MTP for what you need —
MTP off → bigger KV cache (~199K context, vision on), MTP on → less context (~123K) but ~1.6× the speed.
Pure-text on the multimodal build (--language-model-only) is identical to this stripped build, so there's
rarely a reason to prefer this one. It's published for reproducibility and for the ~1 GB smaller download.
The experiment
- Base / method:
Qwen/Qwen3.8-27B→nvidia-modelopt0.43.0 NVFP4 (NVFP4_DEFAULT_CFG, group_size 16), keepinglm_head,*linear_attn.conv1d*,mtp.*, andmodel.visual.*in bf16; then the vision tensors are physically deleted and the 15 bf16mtp.*tensors grafted back so speculative decoding engages. - Hardware / engine: one RTX 5090 (32 GB), vLLM 0.27.2 (needs the ≥0.27.2 gated-delta-net fix; older
builds crash MTP at long context),
--gpu-memory-utilization 0.93, fp8 KV cache,--max-num-seqs 1. - Important condition — this was a shared card, not a dedicated one. The desktop was live on the same 5090
(~2 GB of VRAM held by the OS compositor) during every run, and vLLM's cuda-graph profiler over-reserves
another ~0.4 GB unless disabled. So the numbers below are conservative, shared-card results, taken with
VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0set to reclaim that 0.4 GB. A card fully dedicated to inference (desktop moved to an integrated GPU, ~2 GB freed) does strictly better — more KV cache, higher context ceilings. - What we compared: this text-only build vs. a full multimodal NVFP4 build of the same model, across vision-on/off and MTP-on/off, measuring the KV-cache ceiling and steady-state decode tok/s.
Results
| Serve mode (multimodal build unless noted) | Vision | Max context¹ | Decode tok/s |
|---|---|---|---|
vision on, MTP off (drop --speculative-config) |
✅ | ~199K | ~77 |
| vision on, MTP on | ✅ | ~123K | ~125–135² |
--language-model-only, MTP on (text) |
— | ~200K | ~130–140 |
this text-only build, --language-model-only, MTP |
— | ~200K | ~130–140 |
¹ Every ~200K/199K figure is conditional on VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0 (see below);
without it you top out at ~185–188K.
² An image in the prompt does not slow decode — the vision encoder runs once during prefill (measured ~133
tok/s decoding with an image present). Time-to-first-token grows with image resolution; steady decode doesn't.
What each row taught us:
- Stripping vision ≠ more context or speed. Text-only build and multimodal build, both
--language-model-only- MTP, are identical: KV 201,428 tokens, ~130–140 tok/s each. Deleting the tower only shrinks the download.
- The 200K lever is a vLLM env var, not the model. vLLM 0.27.x's cuda-graph profiler over-reserves ~0.4 GB
(estimates 0.40 GB, actually uses 0.04 GB).
VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0hands it back (KV 6.95 → 7.35 GB) → full 200K fits at util 0.93. Applies to any NVFP4 27B on 32 GB. (Context: a normal desktop compositor already holds ~2 GB of the 5090; dedicate the card — desktop on an iGPU — and you can push past 200K.) - MTP, not vision, is what eats KV cache. The vision tower costs ~0.17 GB of weights (≈nothing). Enabling MTP is what roughly halves usable context (199K → 123K with vision on).
- Vision works and is nearly free. The multimodal build correctly read shapes + text from a test image.
- On 32 GB you can't have vision + MTP-speed + 200K at once — pick two. The scarce resource is KV cache.
Conclusion
Prefer the multimodal build on 32 GB: it's a strict superset (does everything this build does, plus vision) and you choose context-vs-speed by toggling MTP. Reach for this text-only build only if you never send images and want the ~0.95 GB smaller download or a guaranteed text-only artifact.
Two conditions behind every number here: they were measured on a shared card (the desktop held 2 GB of
the 5090) with 185–188K instead of 200K); dedicate the card
(desktop on an iGPU, ~2 GB freed) and every context ceiling above rises further.VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0 set to reclaim vLLM's ~0.4 GB profiler
over-reservation. Without that env var you lose ~12–15K of context (
Serving this build (vLLM ≥ 0.27.2, Blackwell / SM120)
# The env var is REQUIRED to reach 200K on a 32 GB card. Without it you get ~185–188K.
VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=0 \
vllm serve dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP \
--trust-remote-code \
--quantization modelopt \
--language-model-only \
--kv-cache-dtype fp8 \
--max-model-len 200000 \
--max-num-seqs 1 \
--speculative-config '{"method":"mtp","num_speculative_tokens":3}'
--language-model-onlyis required for this build. The vision tower and itspreprocessor_config.jsonwere removed, but the arch class is stillQwen3_5ForConditionalGeneration— without the flag vLLM tries to build an image processor that no longer exists and aborts withCan't load image processor for '…'.
Model details & credit
- Quant:
nvidia-modelopt0.43.0 NVFP4, group_size 16, KV-cache quant off; kept in bf16:lm_head,model.visual.*(then deleted),*linear_attn.conv1d*(Mamba-style SSM convs),mtp.*(grafted back). Calibration: 20 samples fromneuralmagic/calibration(LLM split), max_seq_len 8192. - Vision removal (how): after the ModelOpt NVFP4 export, the
model.visual.*tensors are dropped from every.safetensorsshard and frommodel.safetensors.index.json, andvision_config+ the image/video/vision-start token ids are removed fromconfig.json(andpreprocessor_config.jsondeleted), using thesafetensorslibrary. The approach follows lna-lab's GGUF-to-NVFP4-SM120 recipe (credited below). - Working MTP matters: naive
AutoModelForCausalLMexport drops the MTP head → 0% draft acceptance; the ignore pattern must bemtp*(notmodel.mtp.*, which never matches). With it, ~72% acceptance measured. - Size accounting (measured): core weights ~18.79 GB; the removed vision tower is 921 MB (333 bf16 tensors); the grafted MTP head is 849 MB (bf16). Because those two nearly cancel, this build is only ~0.07 GB smaller than a multimodal build without MTP, but ~0.95 GB smaller than one with both vision and MTP (the gittensor build: 20.59 GB vs this 19.64 GB). The download saving is entirely the vision tower.
This is a derivative work — all capability belongs to its authors; this repo only re-quantizes and strips:
- Qwen team (Alibaba) —
Qwen/Qwen3.8-27B(Apache-2.0). - osoleve — the original text-only NVFP4 + MTP-graft recipe this descends from,
osoleve/Qwen3.5-27B-Text-NVFP4-MTP. - lna-lab — the reproducible pipeline,
lna-lab/GGUF-to-NVFP4-SM120. - sakamakismile — the Qwen3.6 build this mirrors,
sakamakismile/Qwen3.6-27B-Text-NVFP4-MTP.
- Downloads last month
- 312
Model tree for dbrasdasilva/Qwen3.8-27B-Text-NVFP4-MTP
Base model
Qwen/Qwen3.8-27B