Instructions to use lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound
- SGLang
How to use lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound 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 "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound with Docker Model Runner:
docker model run hf.co/lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound
DeepSeek-V4.1-Flash — W4A16 (experts INT4 GPTQ + Engram INT4) — AutoRound
Post-training quantization of DeepSeek-V4.1-Flash
produced with auto-round --model_free (RTN, iters=0):
| Component | Official | This checkpoint |
|---|---|---|
Routed experts (ffn.experts.*, incl. MTP) |
MXFP4 (packed E2M1 + E8M0/32) | INT4 W4A16 g32 sym, auto_gptq packing (qweight/qzeros/scales) |
Engram embedding tables (layers.1/14.engram.embed) |
FP8 (E4M3 + E8M0/32) | INT4 g32 sym (packed uint8 [R,128] + fp16 scale [R,8]) |
| Attention / shared_experts / engram.wkv | FP8 / MXFP8 | BF16 (dequantized) |
| Vision tower / aligner / embed / head / norms | BF16 | BF16 (unchanged) |
Checkpoint size: 451.7 GB (vs 510.3 GB official). gsm8k (raw 5-shot, thinking off, n=1319): 93.93 / 94.01 vs baseline 92.87 — lossless within noise.
Inference (vLLM)
Requires: vLLM main (≥ PR #56201) +
the out-of-tree plugin dsv41-quant-plugin (registers the auto-round auto_gptq
dispatch for deepseek_v41 and the INT4 engram lookup).
DSV41_ENGRAM_DTYPE=int4 NCCL_NVLS_ENABLE=0 \
vllm serve <this-model-dir> \
--tensor-parallel-size 4 --max-model-len 8192 --language-model-only \
--gpu-memory-utilization 0.90 --port 8100
Verified on 4×H200 (TP4). The INT4 expert GEMM runs through vLLM's built-in GPTQ-MoE path (MoeWNA16/Marlin) — no custom kernels; dense layers run as plain BF16.
Quantization recipe
# experts only -> auto_gptq INT4 g32 (everything else ignored / dequantized to bf16)
auto-round --model_name deepseek-ai/DeepSeek-V4.1-Flash --model_free \
--scheme W4A16 --group_size 32 \
--ignore_layers attn,shared_experts,engram,vision,aligner,main_proj,gate,norm,embed,head \
--output_dir <A>
# engram tables -> int4 g32 sym + fp16 scale (custom RTN script), then splice into A
# (see producer notes: quant_engram_int4.py + build_b_view_experts.py)
Limitations
- Serving today requires the
dsv41-quant-plugin(not yet upstreamed to vLLM) andDSV41_ENGRAM_DTYPE=int4for the engram lookup. - Not compatible with the official reference implementation's FP8 kernels (dense is BF16 here).
Provenance
- auto-round 0.15.0 (editable copy with DeepSeek-V4.1 source-format patch), vLLM main nightly
(
0.1.1.dev39+g46d2b23ac), transformers-side loading not used (model_free). - Full production log & design docs: see producer's journal (aqa pipeline).
- Downloads last month
- 124
Model tree for lvkaokao/DeepSeek-V4.1-Flash-W4A16-Engram-AutoRound
Base model
deepseek-ai/DeepSeek-V4.1-Flash