Instructions to use Qwen/Qwen3.8-Flash-Next with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen3.8-Flash-Next with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Qwen/Qwen3.8-Flash-Next") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Qwen/Qwen3.8-Flash-Next") model = AutoModelForMultimodalLM.from_pretrained("Qwen/Qwen3.8-Flash-Next", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Qwen/Qwen3.8-Flash-Next with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen3.8-Flash-Next" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen3.8-Flash-Next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Qwen/Qwen3.8-Flash-Next
- SGLang
How to use Qwen/Qwen3.8-Flash-Next 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 "Qwen/Qwen3.8-Flash-Next" \ --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": "Qwen/Qwen3.8-Flash-Next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "Qwen/Qwen3.8-Flash-Next" \ --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": "Qwen/Qwen3.8-Flash-Next", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Qwen/Qwen3.8-Flash-Next with Docker Model Runner:
docker model run hf.co/Qwen/Qwen3.8-Flash-Next
Model cannot SPLIT TENSOR and will not work in consumer multi gpu
0.00.407.274 I print_info: file size = 157.54 GiB (7.65 BPW)
0.00.415.334 E llama_model_load: error loading model: LLAMA_SPLIT_MODE_TENSOR not implemented for architecture 'qwen4exp'
0.00.415.345 E llama_model_load_from_file_impl: failed to load model
0.00.415.351 E cmn common_init_: failed to load model 'c:\AI_Models\Qwen3.8-Flash-Next-UD-Q6_K_XL-00001-of-00006.gguf'
0.00.415.355 E srv load_model: failed to load model, 'c:\AI_Models\Qwen3.8-Flash-Next-UD-Q6_K_XL-00001-of-00006.gguf'
0.00.415.361 I srv operator(): operator(): cleaning up before exit...
0.00.416.547 E srv llama_server: exiting due to model loading error
Yes, this is happening to my also. I got two rtx 3080 with 20GB VRAM each. If I use "-fit on" and llama uses both gpus, the final speed is worse than if I were using just one GPU. My CPU is a ryzen 3700x with 128GB VRAM 3600mhz
llama version used: b11040
layer split doesn't work.
I have tried an unsloth version Q2_K_XL on my MacBook Pro M5 max (128gb). It uses about 80gb of ram. And it is VERY good (an understatement!). And it quite fast too. Very impressive. I have used this model for my meeting summaries and it is way better than any local model I have tried so far. I have not tried it for coding, but I will.
The error only concerns -sm tensor. The current server README lists it as tensor: split weights and KV across GPUs (parallelized, EXPERIMENTAL), and it hasn't been implemented for qwen4exp. -sm layer is the default and does load. On consumer cards, tensor split wouldn't be the win anyway: most of this model has to sit in system RAM, so the offload split matters much more than how the GPUs share the work.
@Nerdsking some estimates for 2×20 GB + 128 GB DDR4-3600, using unsloth's file sizes, 64K context at f16 KV and ~1.5 GiB of buffers:
- UD-IQ4_XS (93.7 GB): one GPU needs
-ncmoe 39→ ~18 GiB VRAM, ~45 GiB RAM. Two GPUs need only-ncmoe 21→ ~38.5 GiB VRAM, ~25 GiB RAM. - UD-Q4_K_XL (111 GB): one GPU
-ncmoe 41, two GPUs-ncmoe 27(~41 GiB RAM). - On top of that, the ~26.8 GiB n-gram table stays on the CPU side. It's read lazily from the mmapped file.
Decode is bound by what's read from RAM per token (10 of 512 experts active). Dual-channel DDR4-3600 is ~57.6 GB/s. For IQ4_XS that gives roughly 12–20 tok/s on one card vs 16–27 tok/s on two, so the second card should help, not hurt.
If two GPUs came out slower, I'd check two things:
- Is
--fit(on by default) actually moving fewer experts to the CPU when both GPUs are visible? If it keeps the same-ncmoe, you pay the pipeline hop and gain nothing. - With
-ncmoe Nset by hand, layers 0..N-1 are light on the GPU. Under layer split, GPU0 gets mostly light layers unless you adjust-ts.
Setting -ncmoe explicitly plus -ts and comparing llama-bench numbers against one GPU should show which one it is.
For the Q6_K_XL (157.5 GiB): 40 GiB VRAM + 128 GB RAM ≈ 159 GiB total, so it won't realistically fit next to the OS.
I got these per-file numbers from a calculator I built for -ncmoe: https://modelvram.com/moe-offload-calculator/ (I built this). They're bandwidth estimates, not measurements.