Module expert_backend

Module expert_backend 

Source
Expand description

Expert storage backend for K3 routed MXFP4 packs.

Official moonshotai/Kimi-K3 is ~1.56 TB / 96 shards. Two Sparks cannot hold that resident. Trunk + embed + lm_head + KDA/MLA + shared experts stay in RAM; routed experts come from per-id NVMe packs.

K3_EXPERT_BACKEND=resident | mmap | prefetch (default resident). Do not download the 96-shard repo in this module.

Structs§

MmapExpertStore
mmap’d per-expert packs. Missing id fails closed (no silent zero tensor).
PrefetchPlanner
Prefetch: remember last router top-k so the next token can hint NVMe.

Enums§

ExpertBackendKind

Constants§

ENV

Functions§

kind_from_env
pack_path
Dummy pack path: {dir}/e{id}.mxfp4.
read_pack_file
Read a pack without mmap (tests / tiny payloads).
write_dummy_pack