Instructions to use WaveCut/Qwen3.8-Flash-Next-REAM-288 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WaveCut/Qwen3.8-Flash-Next-REAM-288 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="WaveCut/Qwen3.8-Flash-Next-REAM-288") 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("WaveCut/Qwen3.8-Flash-Next-REAM-288") model = AutoModelForMultimodalLM.from_pretrained("WaveCut/Qwen3.8-Flash-Next-REAM-288", 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 WaveCut/Qwen3.8-Flash-Next-REAM-288 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WaveCut/Qwen3.8-Flash-Next-REAM-288" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WaveCut/Qwen3.8-Flash-Next-REAM-288", "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/WaveCut/Qwen3.8-Flash-Next-REAM-288
- SGLang
How to use WaveCut/Qwen3.8-Flash-Next-REAM-288 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 "WaveCut/Qwen3.8-Flash-Next-REAM-288" \ --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": "WaveCut/Qwen3.8-Flash-Next-REAM-288", "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 "WaveCut/Qwen3.8-Flash-Next-REAM-288" \ --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": "WaveCut/Qwen3.8-Flash-Next-REAM-288", "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 WaveCut/Qwen3.8-Flash-Next-REAM-288 with Docker Model Runner:
docker model run hf.co/WaveCut/Qwen3.8-Flash-Next-REAM-288
Qwen3.8-Flash-Next-REAM-288
Qwen3.8-Flash-Next with 288 of 512 experts per MoE layer, merged not
pruned (REAM), in native bf16 for transformers. 251GB vs 360GB stock.
MTP block included (its experts merged 512->288 as well) — vLLM-style
qwen4_exp speculative decoding keeps working.
Method
REAM (arXiv 2604.04356, Samsung SAIL Montréal: Merging Improves Pruning of Experts in LLMs), offline adaptation: instead of dropping the 224 non-kept experts per layer (REAP), each is merged into its most-similar kept expert with saliency-proportional coefficients.
- Kept set / slot order: exactly the per-layer REAP-288 manifest published by sh0wie (saliency calibrated on ~686K tokens of agentic-coding traffic) — full credit to that work; this build is a direct A/B against it.
- Similarity (offline, no calibration run): cosine of router gate rows.
- Merge coefficients: measured saliency from sh0wie's
saliency_full_505.npz(its argsort reproduces his pinned manifest bit-for-bit), tempered and shrunk:w_i = (S_i/S_c)^2 * router_cos * count_confidence, with the centroid keeping at least 90% of itself. Raw proportional weights are catastrophic here (KL 1.397) because the real kept/dropped saliency gap is only ~1.6x — the merge dissolves the expert REAP chose to keep. Hungarian permutation alignment of intermediate channels before averaging (fp32 accumulate, bf16 out). - Trajectory flat_tsg_tsD: flat one-shot groups (canonical REAM)
- Router: absorbed rows deleted; kept rows byte-identical to stock.
- MTP block: same machinery, k-center centroids on its own gate rows.
- A six-point ladder (see
campaign/reports/truesal_ladder.md) locates the optimum: KL is minimised when kept experts give away ~9% of their mass — both heavier blending and near-pruning are worse.
Evaluation (A/B vs REAP prune, same harness, same hardware)
| model | KL vs stock (mean) | rare-name probe (10 names) | HumanEval subset (25 tasks) |
|---|---|---|---|
| stock 512e | 0 | 0.97 | 90.0% (full 50) |
| REAP-288 recon (prune) | 1.3066 | 0.91 | 92.0% (stock on same 25: 92.0%) |
| REAM-288 flat_tsg_tsD (this) | 1.2564 | 0.94 | not re-run for tsD; flat_sim (previous main, same pipeline) scored 88.0% vs stock 88.0% on its slice |
KL: teacher-forced top-256 KL vs the stock model over a fixed mixed corpus (en/ru/code/rare-entities/agentic, ~10K positions). Probe: rare entities x 10 seeded sampled generations, pass = name reproduced intact; aggregates recomputed on the name subset common to all rows (a monitoring bug killed the winner's third probe batch mid-run). HumanEval: 25-task slices of a frozen 50-task subset, no-thinking, greedy; the two 288e models landed on different slices (2-task overlap), so each is paired with the stock score on its own slice. Single-run evals; ±1-2 point differences are noise. RU slice of the probe (3 Cyrillic names, 30 gens): stock 27, prune 21, merge 24.
Files
Standard HF sharding. experts-layerNN shards carry the merged expert stacks;
backbone tensors are byte-identical to stock (verified by streaming sha256).
Limitations
- Merge coefficients use the author's measured saliency, tempered (see Method).
- Calibration-free similarity (router-row cosine): no activation statistics.
- MTP merged without measured saliency (k-center on gate rows).
- Vision tower untouched but untested after merging.
Credits
- sh0wie / HamsterResearch — REAP-288 saliency calibration, kept-expert manifests, MLX conversion conventions.
- Samsung SAIL Montréal — the REAM method.
- Qwen team — the base model. License inherited (Qwen Community License 1.0).
- Downloads last month
- 60