High-Performance C++ Inference Engine for DeepSeek V4 Flash on AMD Ryzen AI NPU
C++
0
0 commits
updated Jul 14, 2026
FaStar runs DeepSeek V4 Flash — a 284-billion-parameter Mixture-of-Experts model — on a laptop. It executes the full inference path on the AMD Ryzen AI 9 365's integrated XDNA2 NPU, spilling the ~150 GB of expert weights across SSD → RAM → NPU scratch buffers using expert virtual memory: MoE experts are treated like virtual-memory pages — stored on an NVMe SSD, cached in RAM, and uploaded to NPU scratch buffers on demand.
The engine is mathematically faithful to the HuggingFace reference (coherent English output; greedy prefill argmax matches the HF ground truth) and fits the 150 GB model into a 64 GB RAM budget via a paged expert cache.
⚠️ This is a research/engineering showcase, not a production server. Decode runs at ~0.05 tokens/sec (see Known limitations). The project's value is the architecture — expert virtual memory + on-NPU MLA/FFN via IRON-generated kernels — and a working end-to-end 284B inference path on consumer NPU hardware.
--draft_model)..fst container; an LRU RAM cache with predictive prefetch feeds a persistent host-only BO
pool, so hot experts skip the SSD round-trip.--serve) streams tokens back to the
browser as Server-Sent Events, with a persistent multi-turn KV cache.third_party/ folder. Header-only dependencies
(cpp-httplib, nlohmann/json,
and the FastFlowLM NPU instruction-sequence headers)
are fetched automatically by CMake FetchContent on first configure.| Component | Requirement | Notes |
|---|---|---|
| APU | AMD Ryzen AI 9 365 (XDNA2 NPU) | The NPU is the compute target. |
| RAM | 64 GB minimum | The 150 GB model is paged; ~54 GB peak RSS observed. |
| Storage | NVMe SSD, ~200 GB free | Experts live on SSD; read latency dominates miss cost. |
| GPU | Not required | The iGPU is unused; all inference is CPU (router/KV) + NPU. |
Target platform: Ubuntu 24.04 (any modern Linux with the packages below works).
| Dependency | Purpose | Install |
|---|---|---|
| XRT (Xilinx Runtime) | NPU device + buffer API | apt install xrt (CMake config at /usr/share/cmake/XRT, libs in /usr/lib) |
| AIEBU | Assembles NPU instruction blobs → ELF | Ryzen AI SW stack (CMake config at /usr/share/cmake/AIEBU) |
| AMDXDNA driver | Kernel module for the NPU | lsmod | grep amdxdna (Ryzen AI driver package) |
| CMake ≥ 3.16 | Build | apt install cmake |
| g++ (C++17) | Compiler | apt install build-essential |
Python 3 + tokenizers | HF BPE tokenizer bridge | pip install tokenizers (used by scripts/fst_tokenize.py) |
| wget (or curl) | Model auto-download | apt install wget |
| Git | FetchContent clones the header deps | apt install git |
| IRON / MLIR-AIE (kernel rebuild only) | Regenerate .xclbin kernels | Only needed to recompile kernels; prebuilt kernels ship in kernels/. |
cpp-httplib, nlohmann/json, and the FastFlowLM headers are downloaded by CMake — no manual install of those is needed.
# 1. Clone
git clone https://github.com/<you>/FaStar.git
cd FaStar
# 2. Build (CMake fetches cpp-httplib + nlohmann/json + FastFlowLM headers on first configure)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# -> build/ds4_npu_engine
# 3. Run (XRT lives in /usr on Ubuntu, not /opt/xilinx)
export XILINX_XRT=/usr
# First run with no model present auto-downloads the ~163 GB model set from HuggingFace
# (resumable — re-run to continue a partial fetch):
./build/ds4_npu_engine --serve --port 8080
# then open http://localhost:8080/ in a browser.
If you already have the .fst model files, place them in the current directory (or pass
--model-dir <dir>) and the download step is skipped.
Model availability. FaStar downloads from
RaffaelloMolinari/Deepseek-V4-Flash-DSpark-FSTon first run. Ensure the.fstfiles, their.fst.hc/.fst.norm/.fst.tid2eidsidecars,tokenizer.json, and (for speculative decoding)dspark_draft.fstare present in that HuggingFace repo. The.fst.normand.fst.hcsidecars are required for coherent output (the bare.fstalone has 40×-too-small RMSNorm weights).
export XILINX_XRT=/usr
# One-shot generation (greedy, deterministic):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst \
--prompt "Explain quantum computing" --tokens 128 --temp 0.0
# With speculative decoding (loads the DSpark draft model):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --draft_model dspark_draft.fst \
--prompt "Hello world" --tokens 256
# Interactive multi-turn (persistent KV cache across turns):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --interactive --tokens 128
# Web UI / chat server:
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --serve --port 8080
| Flag | Env var | Purpose |
|---|---|---|
--model <path> | — | .fst model file (default: deepseek_v4_dspark.fst). |
--model-dir <path> | — | Directory holding the models + tokenizer (auto-download target; default: CWD). |
--draft_model <path> | — | DSpark draft .fst for speculative decoding. |
--prompt <text> | — | Prompt text (one-shot / interactive modes). |
--tokens <n> | — | Max tokens to generate (default 128). |
--temp <f> | — | Sampling temperature (default 0.7; ≤0 = greedy/argmax). |
--top_p <f> | — | Top-p nucleus (default 0.9). |
--tokenizer <path> | FST_TOKENIZER | tokenizer.json path. |
--tokenize_script <p> | FST_TOKENIZE_SCRIPT | fst_tokenize.py path. |
--kernel_dir <path> | FST_KERNEL_DIR | Directory holding .xclbin / _insts.bin (default ./kernels). |
--interactive | — | Multi-turn API with persistent KV cache. |
--serve | — | Start the HTTP web UI / chat server. |
--port <n> | — | Server port (default 8080). |
--web-dir <path> | — | Directory holding index.html (default ./web). |
--no-sd | — | Disable speculative decoding (plain autoregressive decode). |
--skip-prefill | — | Continue from current KV state (skip prefill). |
Start the built-in HTTP server + chat UI with --serve:
export XILINX_XRT=/usr
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --serve --port 8080
Then open http://localhost:8080/.
prefill_user (append-aware prefill) and streams reply tokens back as Server-Sent Events
(text/event-stream); tokens appear in real time.POST /reset clears the KV cache and starts a fresh session.| Method | Path | Body / purpose |
|---|---|---|
GET | / | Serves web/index.html. |
POST | /generate | JSON {prompt, tokens?, temp?, top_p?, reset?} → SSE stream of {id, text, done}. |
POST | /reset | Clear KV cache + compressor (start a new chat). |
Generation requests are serialized (the NPU is single-instance), so concurrent /generate
calls queue. The first token of a turn takes ~2 minutes (prefill of a 43-layer 284B model on
this NPU); subsequent tokens stream at ~0.05 tok/s.
FaStar splits execution across three tiers:
SSD (.fst) ──page→ RAM (ExpertPager LRU) ──upload→ NPU scratch (persistent host_only BOs)
ExpertPager)predict_and_prefetch() reuses layer L's experts at L+1;
predict_and_prefetch_from_draft() runs the draft router to predict exact experts.FSTEngine::get_expert_bo)
holding hot experts device-readable, checked before the pager on every dispatch.AiebuKernelCache)hw_context. The AMDXDNA driver caps simultaneous
hw_contexts at 9; unified xclbins keep the engine under this.NpuSequenceBuilder / run_blob path (ported from FastFlowLM's
npu_sequence) builds dynamic multi-op blobs at runtime — the foundation for future kernel
fusion (many DMA micro-ops in one host→NPU submission).max_seq and
written at seq_pos * KV_LORA.--draft_model dspark_draft.fst enables it; --no-sd forces plain autoregressive decode.FSTEngine exposes reset_session(), prefill_user(ids, temp, top_p) and
decode_step(prev_tid, temp, top_p). prefill_user appends at the current sequence
position (resetting the compressor only on the first turn), so a multi-turn chat reuses the KV
cache across turns. The CLI (--interactive) and the web server (--serve) both build on it.
FaStar/
├── src/ C++ engine sources
│ ├── fst_engine.cpp Inference orchestrator: layers, NPU dispatch, MLA/FFN/SD
│ ├── fst_main.cpp CLI + interactive loop + HTTP web server + HF auto-download
│ └── expert_pager.cpp Expert virtual memory: SSD→RAM LRU cache + prefetch
├── include/ Headers (fst_engine.h, expert_pager.h, fst_aiebu_cache.hpp)
├── kernels/ NPU kernels: IRON compile scripts + kernel .cc sources
│ + compiled .xclbin / _insts.bin (prebuilt, committed)
├── scripts/ Python: model converter, tokenizer bridge, verify/bench
├── tools/ Standalone C++ probes (insts decoder, packing probes, etc.)
├── web/ Chat UI (index.html, served by --serve)
├── CMakeLists.txt Build (finds XRT + AIEBU; FetchContent for the 3 header deps)
├── xrt.ini XRT runtime config (verbosity / debug flags)
└── README.md
No third_party/ folder is committed. Header-only dependencies are fetched at configure time
into build/_deps/ (gitignored).
Convert a HuggingFace DeepSeek checkpoint to the .fst container:
python3 scripts/fst_converter.py --model deepseek-ai/DeepSeek-V4-Flash-DSpark \
--output deepseek_v4_dspark.fst
The .fst format stores a page-aligned config header, shared tensors (attention, router,
norms) in Q8_0 / BF16, and expert blocks in dense DS4 MXFP4. Verify integrity:
python3 scripts/verify_fst.py deepseek_v4_dspark.fst
python3 scripts/check_fst.py deepseek_v4_dspark.fst
Prebuilt kernels ship in kernels/ (*.xclbin + *_insts.bin). You only need to recompile if
you change a kernel. Compilation uses AMD IRON (MLIR-AIE):
export PATH="$HOME/.local/bin:$PATH"
export PEANO_INSTALL_DIR="$HOME/.local/lib/python3.14/site-packages/llvm-aie"
# Example: rebuild the LM head kernel
python3 kernels/compile_lm_head.py
# -> kernels/fst_lm_head.xclbin + kernels/fst_lm_head_insts.bin
The "unified" pipeline is the current set the engine loads:
| Script | Kernel | Purpose |
|---|---|---|
compile_ew_unified.py | fst_ew_unified.xclbin | RMSNorm / SiLU / mul / softmax / RoPE / router |
compile_ffn_unified.py | fst_ffn_unified.xclbin | Expert FFN (fused dequant + GEMM) |
compile_mla_unified.py | fst_mla_unified.xclbin | Unified MLA attention |
compile_dequant_q4k.py | fst_dequant_q4k.xclbin | MXFP4→BF16 dequantization |
compile_lm_head.py | fst_lm_head.xclbin | LM head projection |
compile_router.py | fst_router.xclbin | MoE router (sqrtsoftmax + top-k) |
/tmp/fastar_npu.lock) prevents two processes from
fighting over NPU contexts._exit() on completion to avoid a known AMDXDMA hang when
tearing down many BOs/contexts in destructors.NPU DMA deadlock (syncobj timeout at Layer 0): mixing kernels from different xclbins on one
hw_context. Each xclbin gets its own hw_context (handled by AiebuKernelCache).
XRT device init failure: ensure XILINX_XRT=/usr, lsmod | grep amdxdna shows the driver,
and no other FaStar instance holds /tmp/fastar_npu.lock.
Expert cache thrash: monitor the hit rate in the run log; if <90%, raise the RAM cache or improve the prefetch strategy.
IRON compile failures: import aie.iron needs a specific LLVM-AIE install; re-run the
PEANO installer and check PEANO_INSTALL_DIR. (Only needed to recompile kernels.)
Model download fails / 404: the .fst files must be present in the HuggingFace repo
RaffaelloMolinari/Deepseek-V4-Flash-DSpark-FST. Downloads are resumable — re-run to continue a
partial fetch. To use a locally-converted model instead, place the .fst (+ sidecars) in the
working directory or pass --model-dir.
FaStar builds directly on the ideas and tooling of several open projects:
ds4) — the DeepSeek-V4
MXFP4 quantization format and the single-file reference architecture that FaStar's engine
structure and faithful numerics are measured against.compile_*.py).npu_sequence runtime that FaStar's in-process NpuSequenceBuilder/run_blob path is
ported from; its npu_utils headers are a build-time dependency.FaStar is provided as-is for research and educational use. Bundled header dependencies retain their respective licenses (see each upstream project).
C++
52.7%
Python
46.4%
High-Performance C++ Inference Engine for DeepSeek V4 Flash on AMD Ryzen AI NPU
C++
0
0 commits
updated Jul 14, 2026
FaStar runs DeepSeek V4 Flash — a 284-billion-parameter Mixture-of-Experts model — on a laptop. It executes the full inference path on the AMD Ryzen AI 9 365's integrated XDNA2 NPU, spilling the ~150 GB of expert weights across SSD → RAM → NPU scratch buffers using expert virtual memory: MoE experts are treated like virtual-memory pages — stored on an NVMe SSD, cached in RAM, and uploaded to NPU scratch buffers on demand.
The engine is mathematically faithful to the HuggingFace reference (coherent English output; greedy prefill argmax matches the HF ground truth) and fits the 150 GB model into a 64 GB RAM budget via a paged expert cache.
⚠️ This is a research/engineering showcase, not a production server. Decode runs at ~0.05 tokens/sec (see Known limitations). The project's value is the architecture — expert virtual memory + on-NPU MLA/FFN via IRON-generated kernels — and a working end-to-end 284B inference path on consumer NPU hardware.
--draft_model)..fst container; an LRU RAM cache with predictive prefetch feeds a persistent host-only BO
pool, so hot experts skip the SSD round-trip.--serve) streams tokens back to the
browser as Server-Sent Events, with a persistent multi-turn KV cache.third_party/ folder. Header-only dependencies
(cpp-httplib, nlohmann/json,
and the FastFlowLM NPU instruction-sequence headers)
are fetched automatically by CMake FetchContent on first configure.| Component | Requirement | Notes |
|---|---|---|
| APU | AMD Ryzen AI 9 365 (XDNA2 NPU) | The NPU is the compute target. |
| RAM | 64 GB minimum | The 150 GB model is paged; ~54 GB peak RSS observed. |
| Storage | NVMe SSD, ~200 GB free | Experts live on SSD; read latency dominates miss cost. |
| GPU | Not required | The iGPU is unused; all inference is CPU (router/KV) + NPU. |
Target platform: Ubuntu 24.04 (any modern Linux with the packages below works).
| Dependency | Purpose | Install |
|---|---|---|
| XRT (Xilinx Runtime) | NPU device + buffer API | apt install xrt (CMake config at /usr/share/cmake/XRT, libs in /usr/lib) |
| AIEBU | Assembles NPU instruction blobs → ELF | Ryzen AI SW stack (CMake config at /usr/share/cmake/AIEBU) |
| AMDXDNA driver | Kernel module for the NPU | lsmod | grep amdxdna (Ryzen AI driver package) |
| CMake ≥ 3.16 | Build | apt install cmake |
| g++ (C++17) | Compiler | apt install build-essential |
Python 3 + tokenizers | HF BPE tokenizer bridge | pip install tokenizers (used by scripts/fst_tokenize.py) |
| wget (or curl) | Model auto-download | apt install wget |
| Git | FetchContent clones the header deps | apt install git |
| IRON / MLIR-AIE (kernel rebuild only) | Regenerate .xclbin kernels | Only needed to recompile kernels; prebuilt kernels ship in kernels/. |
cpp-httplib, nlohmann/json, and the FastFlowLM headers are downloaded by CMake — no manual install of those is needed.
# 1. Clone
git clone https://github.com/<you>/FaStar.git
cd FaStar
# 2. Build (CMake fetches cpp-httplib + nlohmann/json + FastFlowLM headers on first configure)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# -> build/ds4_npu_engine
# 3. Run (XRT lives in /usr on Ubuntu, not /opt/xilinx)
export XILINX_XRT=/usr
# First run with no model present auto-downloads the ~163 GB model set from HuggingFace
# (resumable — re-run to continue a partial fetch):
./build/ds4_npu_engine --serve --port 8080
# then open http://localhost:8080/ in a browser.
If you already have the .fst model files, place them in the current directory (or pass
--model-dir <dir>) and the download step is skipped.
Model availability. FaStar downloads from
RaffaelloMolinari/Deepseek-V4-Flash-DSpark-FSTon first run. Ensure the.fstfiles, their.fst.hc/.fst.norm/.fst.tid2eidsidecars,tokenizer.json, and (for speculative decoding)dspark_draft.fstare present in that HuggingFace repo. The.fst.normand.fst.hcsidecars are required for coherent output (the bare.fstalone has 40×-too-small RMSNorm weights).
export XILINX_XRT=/usr
# One-shot generation (greedy, deterministic):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst \
--prompt "Explain quantum computing" --tokens 128 --temp 0.0
# With speculative decoding (loads the DSpark draft model):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --draft_model dspark_draft.fst \
--prompt "Hello world" --tokens 256
# Interactive multi-turn (persistent KV cache across turns):
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --interactive --tokens 128
# Web UI / chat server:
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --serve --port 8080
| Flag | Env var | Purpose |
|---|---|---|
--model <path> | — | .fst model file (default: deepseek_v4_dspark.fst). |
--model-dir <path> | — | Directory holding the models + tokenizer (auto-download target; default: CWD). |
--draft_model <path> | — | DSpark draft .fst for speculative decoding. |
--prompt <text> | — | Prompt text (one-shot / interactive modes). |
--tokens <n> | — | Max tokens to generate (default 128). |
--temp <f> | — | Sampling temperature (default 0.7; ≤0 = greedy/argmax). |
--top_p <f> | — | Top-p nucleus (default 0.9). |
--tokenizer <path> | FST_TOKENIZER | tokenizer.json path. |
--tokenize_script <p> | FST_TOKENIZE_SCRIPT | fst_tokenize.py path. |
--kernel_dir <path> | FST_KERNEL_DIR | Directory holding .xclbin / _insts.bin (default ./kernels). |
--interactive | — | Multi-turn API with persistent KV cache. |
--serve | — | Start the HTTP web UI / chat server. |
--port <n> | — | Server port (default 8080). |
--web-dir <path> | — | Directory holding index.html (default ./web). |
--no-sd | — | Disable speculative decoding (plain autoregressive decode). |
--skip-prefill | — | Continue from current KV state (skip prefill). |
Start the built-in HTTP server + chat UI with --serve:
export XILINX_XRT=/usr
./build/ds4_npu_engine --model deepseek_v4_dspark.fst --serve --port 8080
Then open http://localhost:8080/.
prefill_user (append-aware prefill) and streams reply tokens back as Server-Sent Events
(text/event-stream); tokens appear in real time.POST /reset clears the KV cache and starts a fresh session.| Method | Path | Body / purpose |
|---|---|---|
GET | / | Serves web/index.html. |
POST | /generate | JSON {prompt, tokens?, temp?, top_p?, reset?} → SSE stream of {id, text, done}. |
POST | /reset | Clear KV cache + compressor (start a new chat). |
Generation requests are serialized (the NPU is single-instance), so concurrent /generate
calls queue. The first token of a turn takes ~2 minutes (prefill of a 43-layer 284B model on
this NPU); subsequent tokens stream at ~0.05 tok/s.
FaStar splits execution across three tiers:
SSD (.fst) ──page→ RAM (ExpertPager LRU) ──upload→ NPU scratch (persistent host_only BOs)
ExpertPager)predict_and_prefetch() reuses layer L's experts at L+1;
predict_and_prefetch_from_draft() runs the draft router to predict exact experts.FSTEngine::get_expert_bo)
holding hot experts device-readable, checked before the pager on every dispatch.AiebuKernelCache)hw_context. The AMDXDNA driver caps simultaneous
hw_contexts at 9; unified xclbins keep the engine under this.NpuSequenceBuilder / run_blob path (ported from FastFlowLM's
npu_sequence) builds dynamic multi-op blobs at runtime — the foundation for future kernel
fusion (many DMA micro-ops in one host→NPU submission).max_seq and
written at seq_pos * KV_LORA.--draft_model dspark_draft.fst enables it; --no-sd forces plain autoregressive decode.FSTEngine exposes reset_session(), prefill_user(ids, temp, top_p) and
decode_step(prev_tid, temp, top_p). prefill_user appends at the current sequence
position (resetting the compressor only on the first turn), so a multi-turn chat reuses the KV
cache across turns. The CLI (--interactive) and the web server (--serve) both build on it.
FaStar/
├── src/ C++ engine sources
│ ├── fst_engine.cpp Inference orchestrator: layers, NPU dispatch, MLA/FFN/SD
│ ├── fst_main.cpp CLI + interactive loop + HTTP web server + HF auto-download
│ └── expert_pager.cpp Expert virtual memory: SSD→RAM LRU cache + prefetch
├── include/ Headers (fst_engine.h, expert_pager.h, fst_aiebu_cache.hpp)
├── kernels/ NPU kernels: IRON compile scripts + kernel .cc sources
│ + compiled .xclbin / _insts.bin (prebuilt, committed)
├── scripts/ Python: model converter, tokenizer bridge, verify/bench
├── tools/ Standalone C++ probes (insts decoder, packing probes, etc.)
├── web/ Chat UI (index.html, served by --serve)
├── CMakeLists.txt Build (finds XRT + AIEBU; FetchContent for the 3 header deps)
├── xrt.ini XRT runtime config (verbosity / debug flags)
└── README.md
No third_party/ folder is committed. Header-only dependencies are fetched at configure time
into build/_deps/ (gitignored).
Convert a HuggingFace DeepSeek checkpoint to the .fst container:
python3 scripts/fst_converter.py --model deepseek-ai/DeepSeek-V4-Flash-DSpark \
--output deepseek_v4_dspark.fst
The .fst format stores a page-aligned config header, shared tensors (attention, router,
norms) in Q8_0 / BF16, and expert blocks in dense DS4 MXFP4. Verify integrity:
python3 scripts/verify_fst.py deepseek_v4_dspark.fst
python3 scripts/check_fst.py deepseek_v4_dspark.fst
Prebuilt kernels ship in kernels/ (*.xclbin + *_insts.bin). You only need to recompile if
you change a kernel. Compilation uses AMD IRON (MLIR-AIE):
export PATH="$HOME/.local/bin:$PATH"
export PEANO_INSTALL_DIR="$HOME/.local/lib/python3.14/site-packages/llvm-aie"
# Example: rebuild the LM head kernel
python3 kernels/compile_lm_head.py
# -> kernels/fst_lm_head.xclbin + kernels/fst_lm_head_insts.bin
The "unified" pipeline is the current set the engine loads:
| Script | Kernel | Purpose |
|---|---|---|
compile_ew_unified.py | fst_ew_unified.xclbin | RMSNorm / SiLU / mul / softmax / RoPE / router |
compile_ffn_unified.py | fst_ffn_unified.xclbin | Expert FFN (fused dequant + GEMM) |
compile_mla_unified.py | fst_mla_unified.xclbin | Unified MLA attention |
compile_dequant_q4k.py | fst_dequant_q4k.xclbin | MXFP4→BF16 dequantization |
compile_lm_head.py | fst_lm_head.xclbin | LM head projection |
compile_router.py | fst_router.xclbin | MoE router (sqrtsoftmax + top-k) |
/tmp/fastar_npu.lock) prevents two processes from
fighting over NPU contexts._exit() on completion to avoid a known AMDXDMA hang when
tearing down many BOs/contexts in destructors.NPU DMA deadlock (syncobj timeout at Layer 0): mixing kernels from different xclbins on one
hw_context. Each xclbin gets its own hw_context (handled by AiebuKernelCache).
XRT device init failure: ensure XILINX_XRT=/usr, lsmod | grep amdxdna shows the driver,
and no other FaStar instance holds /tmp/fastar_npu.lock.
Expert cache thrash: monitor the hit rate in the run log; if <90%, raise the RAM cache or improve the prefetch strategy.
IRON compile failures: import aie.iron needs a specific LLVM-AIE install; re-run the
PEANO installer and check PEANO_INSTALL_DIR. (Only needed to recompile kernels.)
Model download fails / 404: the .fst files must be present in the HuggingFace repo
RaffaelloMolinari/Deepseek-V4-Flash-DSpark-FST. Downloads are resumable — re-run to continue a
partial fetch. To use a locally-converted model instead, place the .fst (+ sidecars) in the
working directory or pass --model-dir.
FaStar builds directly on the ideas and tooling of several open projects:
ds4) — the DeepSeek-V4
MXFP4 quantization format and the single-file reference architecture that FaStar's engine
structure and faithful numerics are measured against.compile_*.py).npu_sequence runtime that FaStar's in-process NpuSequenceBuilder/run_blob path is
ported from; its npu_utils headers are a build-time dependency.FaStar is provided as-is for research and educational use. Bundled header dependencies retain their respective licenses (see each upstream project).
C++
52.7%
Python
46.4%