Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
docs: the README's welcome to the first discrete-GPU number, the credits kept, the setup's CUDA check
JustVugg736082b81560
diff --git a/README.it.md b/README.it.mdindex af4c1659..fec4ada5 100644--- a/README.it.md+++ b/README.it.md@@ -126,7 +126,7 @@ Cosa fa ogni passo, nel dettaglio: [docs/quickstart.md](docs/quickstart.md#the-o|---|---|| si è fermato durante il download | rilancia lo stesso comando: riprende dai byte già presenti sul disco || `to use the GPU through ..., first run: <command>` | esegui quel comando, poi di nuovo l'installazione: ricompila per la GPU e non riscarica nulla |-| `the ... build failed` durante la compilazione con CUDA, per esempio `Unsupported gpu architecture` quando il CUDA toolkit installato non supporta più la scheda | `./start-here.sh --backend vulkan` usa la scheda tramite Vulkan; `--no-gpu` resta sulla CPU |+| `the ... build failed`, per esempio `Unsupported gpu architecture` quando il CUDA toolkit installato non supporta più la scheda | l'installazione controlla prima il toolkit rispetto alla scheda e sceglie Vulkan da sé, spiegando perché; se una compilazione fallisce ancora, offre la prossima (Vulkan, poi la CPU). `./start-here.sh --backend vulkan` forza Vulkan; `--no-gpu` resta sulla CPU || `needs N GB free for the download` | `--dir` con una cartella su un disco più grande || su WSL, la cartella del modello è sotto `/mnt/c` | tienila sul disco Linux (il predefinito, `~/colibri-models`): `/mnt/c` è molte volte più lento || qualsiasi altra cosa | `c/coli logs -n 50` mostra il log del server e `c/coli logs --install` quello dell'installazione; apri una [issue](https://github.com/JustVugg/colibri/issues) con le ultime righe stampate dall'installazione |@@ -307,11 +307,12 @@ motore decide da sé se usare lì la catena densa (Qwen3.6 sì, Qwen3.8 no).Su una GPU dedicata l'installazione compila Vulkan per ogni motore (prima CUDA,dove il motore ce l'ha e il toolkit è installato), con i layer densi sulla-scheda. È il caso per cui il progetto è pensato, ed è **ancora da misurare:-nessuna GPU dedicata ha ancora eseguito il livello degli expert o la catena-densa.** (Prima di questi, il precedente percorso Vulkan di GLM-5.2 faceva-1.7-1.8 tok/s in decode su una RX 9070 dedicata.) I numeri della tua scheda sono-benvenuti.+scheda. È il caso per cui il progetto è pensato. **Non abbiamo ancora misurato+una GPU dedicata noi stessi.** Il primo numero viene da un utente: Qwen3.6 da+17 a 19 tok/s su una Tesla V100 16 GB, con il livello degli expert e la catena+densa ([#1852](https://github.com/JustVugg/colibri/issues/1852)). (Prima di+questi, il precedente percorso Vulkan di GLM-5.2 faceva 1.7-1.8 tok/s in decode+su una RX 9070 dedicata.) I numeri della tua scheda sono benvenuti.**Le schede senza Resizable BAR** ora funzionano. Una scheda così (tutte leTuring, le Ampere con il firmware di lancio, le AMD più vecchie con l'opzione@@ -352,8 +353,9 @@ motore CUDA è una DLL separata ([windows.md](docs/windows.md)).([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md#the-deltanet-layer-on-the-card-q36_dn_gpu1)).- **Schede più vecchie.** Se il CUDA toolkit non compila più per la tua scheda(CUDA 13 e una V100, in [#1852](https://github.com/JustVugg/colibri/issues/1852)),- la compilazione si ferma: `--backend vulkan` usa invece la scheda tramite- Vulkan. Il livello CUDA di DeepSeek V4 si compila anche per Pascal e Turing+ l'installazione lo vede prima di compilare e usa la scheda tramite Vulkan,+ spiegando perché; un CUDA toolkit 12.x riporta il percorso CUDA. Il livello+ CUDA di DeepSeek V4 si compila anche per Pascal e Turing(`CUDA_ARCH=portable-pre-ampere NO_TC=1`).Tutti i dettagli: [docs/cuda.md](docs/cuda.md).@@ -728,6 +730,55 @@ convertiti; e a ogni contributore che ha fatto benchmark, bisect, replicatoun'esecuzione dell'atlante o mandato una patch. Il codice di terze parti inquesto repository e le sue licenze: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).+Gli esperimenti del progetto su piazzamento, compressione e routing degli expert si+basano anche su idee ed evidenze dei seguenti lavori aperti di ricerca e di sistemi:++- [REAP](https://github.com/CerebrasResearch/reap) e+ [EASY-EP](https://github.com/RUCAIBox/EASYEP) per l'importanza degli expert+ consapevole dell'output e specifica del dominio.+- [SERE](https://github.com/JL-Cheng/SERE) per il re-routing degli expert basato+ sulla similarità, e [ReMoE](https://github.com/BUAA-OSCAR/ReMoE) per il+ fine-tuning del router consapevole della località della cache.+- [MC-SMoE](https://github.com/UNITES-Lab/MC-SMoE) per il merging e la compressione+ degli expert guidati dal routing.+- [MoBE](https://github.com/inclusionAI/MoBE) e+ [D²-MoE](https://github.com/lliai/D2MoE) per le basi di expert condivise e i+ delta di expert a basso rango.+- [HybriMoE](https://github.com/PKU-SEC-Lab/HybriMoE) per lo scheduling ibrido+ CPU/GPU degli expert, [ScMoE](https://arxiv.org/abs/2404.05019) per la+ sovrapposizione tra comunicazione degli expert e calcolo, e+ [OD-MoE](https://arxiv.org/abs/2512.03927) per il caricamento distribuito degli+ expert su richiesta.+- [vLLM](https://github.com/vllm-project/vllm),+ [llama.cpp](https://github.com/ggml-org/llama.cpp) e+ [kTransformers](https://github.com/kvcache-ai/ktransformers) per i sistemi di+ inferenza aperti e il lavoro sull'offload degli expert che rendono riproducibili i+ confronti.++Il motore poggia anche su lavoro di ingegneria concreto, non solo su idee. Ognuno+di questi è usato o reimplementato oggi nel repository:++- [safetensors](https://github.com/huggingface/safetensors): il container che ogni+ motore legge (`c/st.h`), compresi i suoi dtype fp8 e I64.+- [tiktoken](https://github.com/openai/tiktoken): `c/tok.h` reimplementa+ esattamente il suo `byte_pair_encode`, unendo la coppia adiacente la cui+ concatenazione ha l'id di vocabolario più basso, così un vocabolario derivato da+ tiktoken non ha bisogno di una lista di merge.+- [llama.cpp](https://github.com/ggml-org/llama.cpp): il sottoinsieme della+ grammatica GBNF in `c/grammar.h` segue la sua sintassi e il suo PDA a insieme di+ stack, e il percorso Metal prende in prestito il suo trucco di residenza+ `newBufferWithBytesNoCopy`.+- [vLLM](https://github.com/vllm-project/vllm): il riferimento per la semantica+ dell'output che il motore riproduce posizione per posizione (per esempio dove cade+ la norma finale rispetto alla LM head).+- [transformers](https://github.com/huggingface/transformers): l'oracle; la CI+ riproduce token per token contro di esso un modello inizializzato a caso.+- [DietGPU](https://github.com/facebookresearch/dietgpu): il codec ANS su GPU dietro+ il livello sperimentale di expert compressi (`COLI_ANS`).+- [rocWMMA](https://github.com/ROCm/rocWMMA): il backend HIP mappa su di esso l'API+ di frammenti e mma_sync `nvcuda::wmma` di CUDA (`c/backend_gpu_compat.h`), ed è+ ciò che permette a un unico sorgente .cu di compilare per entrambi i produttori.+## LicenzaApache 2.0, Copyright 2026 Vincenzo Fornaro. Vedi [LICENSE](LICENSE) e [NOTICE](NOTICE). Ogni modello mantiene la licenza che gli hanno dato i suoi autori (i pesi di GLM-5.2 sono rilasciati da Z.ai sotto licenza MIT; Qwen-Image-2.1 è solo per uso non commerciale).diff --git a/README.ja.md b/README.ja.mdindex 5eb4fe15..997f419f 100644--- a/README.ja.md+++ b/README.ja.md@@ -94,7 +94,7 @@ Starting colibri|---|---|| ダウンロード中に止まった | 同じコマンドをもう一度実行する:ディスクにすでにあるバイトから再開します || `to use the GPU through ..., first run: <command>` | そのコマンドを実行してから、もう一度セットアップを実行する:GPU 向けにビルドし直し、ダウンロードはやり直しません |-| CUDA でのビルド中に `the ... build failed`。たとえば、インストールされている CUDA ツールキットがそのカードをもうサポートしていないときの `Unsupported gpu architecture` | `./start-here.sh --backend vulkan` なら Vulkan 経由でカードを使います。`--no-gpu` なら CPU のままです |+| `the ... build failed`。たとえば、インストールされている CUDA ツールキットがそのカードをもうサポートしていないときの `Unsupported gpu architecture` | セットアップはまずツールキットをカードと照らし合わせてチェックし、自分で Vulkan を選びます(理由も表示します)。それでもビルドが失敗する場合は次の選択肢(Vulkan、その次に CPU)を提示します。`./start-here.sh --backend vulkan` は Vulkan を強制します。`--no-gpu` なら CPU のままです || `needs N GB free for the download` | `--dir` で、より大きなディスク上のフォルダーを指定する || WSL で、モデルのフォルダーが `/mnt/c` の下にある | Linux 側のディスク(デフォルトの `~/colibri-models`)に置く:`/mnt/c` は何倍も遅くなります || それ以外 | `c/coli logs -n 50` でサーバーのログを、`c/coli logs --install` でセットアップのログを表示できます。セットアップが最後に表示した数行を添えて [issue](https://github.com/JustVugg/colibri/issues) を作成してください |@@ -209,7 +209,7 @@ Mixture-of-Experts モデルは、ディスク上では巨大でも、1 トー内蔵 GPU は CPU と RAM を共有しています。内蔵 GPU が節約するのは、保持しているエキスパートの計算とディスク読み込みです。そのため Qwen3.6 のようなモデルでは効果がありますが、OLMoE のようにエキスパートがすでに RAM にある小さなモデルでは、かえって遅くなることがあります。だからセットアップは、内蔵 GPU では Qwen3.6、Qwen3-Coder、Qwen3.8-Flash-Next の場合にだけ Vulkan を有効にし、各エンジンもそこで密チェーンを動かすかどうかを自分で判断します(Qwen3.6 は動かし、Qwen3.8 は動かしません)。それでも Vulkan を使いたい場合は `--backend vulkan` を指定します。-ディスクリート GPU では、セットアップはすべてのエンジンを Vulkan 向けにビルドし(エンジンに CUDA の経路があり、ツールキットがインストールされている場合は CUDA が優先)、密レイヤーをカード上に置きます。これこそこの設計が想定しているケースですが、**まだ計測されていません:エキスパートティアも密チェーンも、ディスクリート GPU ではまだ一度も動かされていません。**(これらより前の、GLM-5.2 の以前の Vulkan 経路は、ディスクリートの RX 9070 で 1.7-1.8 tok/s でデコードしました。)あなたのカードでの数値を歓迎します。+ディスクリート GPU では、セットアップはすべてのエンジンを Vulkan 向けにビルドし(エンジンに CUDA の経路があり、ツールキットがインストールされている場合は CUDA が優先)、密レイヤーをカード上に置きます。これこそこの設計が想定しているケースです。**私たちはまだディスクリート GPU 自体を計測していません。** 最初の数値はあるユーザーから届いたもので、Tesla V100 16 GB 上の Qwen3.6 がエキスパートティアと密チェーンを使って 17 から 19 tok/s でした([#1852](https://github.com/JustVugg/colibri/issues/1852))。(これらより前の、GLM-5.2 の以前の Vulkan 経路は、ディスクリートの RX 9070 で 1.7-1.8 tok/s でデコードしました。)あなたのカードでの数値を歓迎します。**Resizable BAR のないカード** でも動くようになりました。そうしたカード(すべての Turing カード、発売時のファームウェアのままの Ampere カード、このオプションを無効にした古い AMD カード)では、CPU がカードのメモリに直接書き込めるのは約 256 MB だけです。colibri は現在、ステージングバッファを通して重みを自動でコピーします。この経路は、強制的に使わせる方法と、3 つのデバイスで小さなウィンドウをエミュレートする方法でテストされており、780M では計測できるほどのコストはありません。ただし、Resizable BAR のないカードではまだ計測されていません([vulkan.md](docs/vulkan.md#memory-placement-without-resizable-bar))。@@ -221,7 +221,7 @@ Linux で CUDA ツールキットがインストールされている場合、- **VRAM エキスパートティア** は、計測されたルーティングから選んだ最もホットなエキスパートをカード上に置きます。ミスしたエキスパートは同時に CPU で計算されます。8 GB のカード 2 枚(RTX 3070 と Quadro RTX 4000)での Qwen3.6 は、履歴が温まった状態で 11.3 tok/s でデコードしました([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md))。全エキスパートを常駐させた RTX 5090 6 枚での GLM-5.2 は 9.0-9.2 tok/s([benchmarks.md](docs/benchmarks.md))。RTX 5080 での DeepSeek V4 Flash は 1.5-1.6 tok/s で、3,324 トークンのプロンプトを 90 秒で処理しました([deepseek-v4.md](docs/deepseek-v4.md))。- **Qwen3.6 の新機能:DeltaNet レイヤーをカード上で実行**(`Q36_DN_GPU=1`、オプトイン)。これまで Qwen3.6 の 30 個の DeltaNet レイヤーはそれぞれ、1 トークンごとに 4 回、カードと CPU の間でデータをコピーしていました。現在はデコード時の 1 トークンがレイヤー全体をカード上で実行し、そのリカレント状態は VRAM に保持されます。密レイヤーを VRAM に置いた RTX 3070 で:25.4 から 30.0 tok/s に向上しました([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md#the-deltanet-layer-on-the-card-q36_dn_gpu1))。-- **古いカード。** CUDA ツールキットがもうあなたのカード向けにコンパイルできない場合([#1852](https://github.com/JustVugg/colibri/issues/1852) の CUDA 13 と V100 の例)、ビルドは止まります:その場合は `--backend vulkan` で、代わりに Vulkan 経由でカードを使います。DeepSeek V4 の CUDA ティアは Pascal と Turing 向けにもビルドできます(`CUDA_ARCH=portable-pre-ampere NO_TC=1`)。+- **古いカード。** CUDA ツールキットがもうあなたのカード向けにコンパイルできない場合([#1852](https://github.com/JustVugg/colibri/issues/1852) の CUDA 13 と V100 の例)、セットアップはビルドの前にそれを見抜き、理由を示してカードを Vulkan 経由で使います。CUDA 12.x ツールキットがあれば CUDA の経路が戻ります。DeepSeek V4 の CUDA ティアは Pascal と Turing 向けにもビルドできます(`CUDA_ARCH=portable-pre-ampere NO_TC=1`)。すべての詳細:[docs/cuda.md](docs/cuda.md)。@@ -462,6 +462,50 @@ colibri は、RAM 25 GB の 12 コアのラップトップ上で、1 人のプcolibri はエンジンにすぎず、それが動かす知性は贈り物です。重みをオープンに公開しているチーム、**Z.ai**(GLM)、**Moonshot AI**(Kimi)、**Alibaba Qwen**、**DeepSeek**、**Xiaomi**(MiMo)、**Thinking Machines**(Inkling)、**Allen AI**(OLMoE)、**Convai Innovations**(Laya)、**fastino**(GLiNER2.5-Decide)、**Cloudflare**(Clef)に、変換済みコンテナを公開してくれる人々に、そしてベンチマークを取り、バイセクトし、アトラスの実行を再現し、パッチを送ってくれたすべてのコントリビューターに感謝します。このリポジトリに含まれるサードパーティのコードとそのライセンス:[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。+このプロジェクトのエキスパート配置、圧縮、ルーティングの実験は、以下のオープンな研究と+システムのアイデアやエビデンスにも基づいています:++- 出力を考慮した、ドメイン固有のエキスパート重要度については+ [REAP](https://github.com/CerebrasResearch/reap) と+ [EASY-EP](https://github.com/RUCAIBox/EASYEP)。+- 類似度に基づくエキスパートの再ルーティングについては [SERE](https://github.com/JL-Cheng/SERE)、+ キャッシュ局所性を考慮したルーターのファインチューニングについては+ [ReMoE](https://github.com/BUAA-OSCAR/ReMoE)。+- ルーティングに導かれたエキスパートのマージと圧縮については+ [MC-SMoE](https://github.com/UNITES-Lab/MC-SMoE)。+- 共有エキスパート基底と低ランクのエキスパート差分については+ [MoBE](https://github.com/inclusionAI/MoBE) と+ [D²-MoE](https://github.com/lliai/D2MoE)。+- CPU/GPU ハイブリッドのエキスパートスケジューリングについては+ [HybriMoE](https://github.com/PKU-SEC-Lab/HybriMoE)、エキスパート通信と計算のオーバーラップについては+ [ScMoE](https://arxiv.org/abs/2404.05019)、分散オンデマンドのエキスパートロードについては+ [OD-MoE](https://arxiv.org/abs/2512.03927)。+- 比較を再現可能にしているオープンな推論システムとエキスパートオフロードの取り組みについては+ [vLLM](https://github.com/vllm-project/vllm)、+ [llama.cpp](https://github.com/ggml-org/llama.cpp)、+ [kTransformers](https://github.com/kvcache-ai/ktransformers)。++エンジンはアイデアだけでなく、具体的なエンジニアリングの成果の上にも成り立っています。以下はいずれも+現在ツリー内で使われているか、再実装されています:++- [safetensors](https://github.com/huggingface/safetensors):すべてのエンジンが読むコンテナ+ (`c/st.h`)。fp8 と I64 の dtype を含みます。+- [tiktoken](https://github.com/openai/tiktoken):`c/tok.h` はその `byte_pair_encode` を+ 正確に再実装しており、連結した結果の語彙 ID が最も小さい隣接ペアをマージするため、+ tiktoken 由来の語彙にはマージリストが不要です。+- [llama.cpp](https://github.com/ggml-org/llama.cpp):`c/grammar.h` の GBNF 文法サブセットは+ その構文とスタック集合による PDA に従っており、Metal の経路はその+ `newBufferWithBytesNoCopy` による常駐テクニックを借用しています。+- [vLLM](https://github.com/vllm-project/vllm):エンジンが位置ごとに一致させている出力+ セマンティクスのリファレンス(例: 最終ノルムが LM ヘッドに対してどこに入るか)。+- [transformers](https://github.com/huggingface/transformers):オラクル:+ CI はランダム初期化モデルをこれに対してトークン単位で再現します。+- [DietGPU](https://github.com/facebookresearch/dietgpu):実験的な圧縮エキスパートティア+ (`COLI_ANS`)の背後にある GPU ANS コーデック。+- [rocWMMA](https://github.com/ROCm/rocWMMA):HIP バックエンドは CUDA の+ `nvcuda::wmma` の fragment/mma_sync API をこれにマッピングしており(`c/backend_gpu_compat.h`)、+ それによって 1 つの .cu ソースを両ベンダー向けにコンパイルできます。+## ライセンスApache 2.0、Copyright 2026 Vincenzo Fornaro。[LICENSE](LICENSE) と [NOTICE](NOTICE) を参照してください。各モデルには、その作者が付けたライセンスがそのまま適用されます(GLM-5.2 の重みは Z.ai により MIT ライセンスで公開されています。Qwen-Image-2.1 は非商用利用に限られます)。diff --git a/README.md b/README.mdindex 18bd6efa..e0040f92 100644--- a/README.md+++ b/README.md@@ -123,7 +123,7 @@ What each step does, in detail: [docs/quickstart.md](docs/quickstart.md#the-one-|---|---|| it stopped during the download | run the same command again: it resumes from the bytes already on disk || `to use the GPU through ..., first run: <command>` | run that command, then the setup again: it rebuilds for the GPU and does not download again |-| `the ... build failed` while building with CUDA, for example `Unsupported gpu architecture` when the installed CUDA toolkit no longer supports the card | `./start-here.sh --backend vulkan` uses the card through Vulkan; `--no-gpu` stays on the CPU |+| `the ... build failed`, for example `Unsupported gpu architecture` when the installed CUDA toolkit no longer supports the card | the setup checks the toolkit against the card first and picks Vulkan by itself, saying why; if a build still fails it offers the next one (Vulkan, then the CPU). `./start-here.sh --backend vulkan` forces Vulkan; `--no-gpu` stays on the CPU || `needs N GB free for the download` | `--dir` with a folder on a bigger disk || on WSL, the model folder is under `/mnt/c` | keep it on the Linux disk (the default, `~/colibri-models`): `/mnt/c` is many times slower || anything else | `c/coli logs -n 50` shows the server log and `c/coli logs --install` the setup's; open an [issue](https://github.com/JustVugg/colibri/issues) with the last lines the setup printed |@@ -292,8 +292,10 @@ anyway.On a discrete GPU the setup builds Vulkan for every engine (CUDA first, wherethe engine has it and the toolkit is installed), with the dense layers on the-card. That is the case the design is for, and it is **not measured yet: no-discrete GPU has run the expert tier or the dense chain.** (Before them,+card. That is the case the design is for. **We have not measured a discrete+GPU ourselves yet.** The first number comes from a user: Qwen3.6 at 17 to 19+tok/s on a Tesla V100 16 GB, with the expert tier and the dense chain+([#1852](https://github.com/JustVugg/colibri/issues/1852)). (Before them,GLM-5.2's earlier Vulkan path decoded 1.7-1.8 tok/s on a discrete RX 9070.)Numbers from your card are welcome.@@ -333,7 +335,8 @@ Windows the CUDA engine is a separate DLL ([windows.md](docs/windows.md)).([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md#the-deltanet-layer-on-the-card-q36_dn_gpu1)).- **Older cards.** If the CUDA toolkit no longer compiles for your card (CUDA13 and a V100, in [#1852](https://github.com/JustVugg/colibri/issues/1852)),- the build stops: `--backend vulkan` uses the card through Vulkan instead.+ the setup sees it before building and uses the card through Vulkan, saying+ why; a CUDA 12.x toolkit brings the CUDA path back.DeepSeek V4's CUDA tier also builds for Pascal and Turing(`CUDA_ARCH=portable-pre-ampere NO_TC=1`).@@ -692,6 +695,52 @@ converted containers; and to every contributor who benchmarked, bisected,replicated an atlas run or sent a patch. Third-party code in this repositoryand its licences: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).+The project's expert placement, compression, and routing experiments also build+on ideas and evidence from the following open research and systems work:++- [REAP](https://github.com/CerebrasResearch/reap) and+ [EASY-EP](https://github.com/RUCAIBox/EASYEP) for output-aware and+ domain-specific expert importance.+- [SERE](https://github.com/JL-Cheng/SERE) for similarity-based expert+ re-routing, and [ReMoE](https://github.com/BUAA-OSCAR/ReMoE) for+ cache-locality-aware router fine-tuning.+- [MC-SMoE](https://github.com/UNITES-Lab/MC-SMoE) for routing-guided expert+ merging and compression.+- [MoBE](https://github.com/inclusionAI/MoBE) and+ [D²-MoE](https://github.com/lliai/D2MoE) for shared expert bases and+ low-rank expert deltas.+- [HybriMoE](https://github.com/PKU-SEC-Lab/HybriMoE) for hybrid CPU/GPU expert+ scheduling, [ScMoE](https://arxiv.org/abs/2404.05019) for overlapping expert+ communication with computation, and+ [OD-MoE](https://arxiv.org/abs/2512.03927) for distributed on-demand expert+ loading.+- [vLLM](https://github.com/vllm-project/vllm),+ [llama.cpp](https://github.com/ggml-org/llama.cpp), and+ [kTransformers](https://github.com/kvcache-ai/ktransformers) for the open+ inference systems and expert-offload work that make comparisons reproducible.++The engine also stands on concrete engineering work, not only ideas. Each of+these is used or reimplemented in the tree today:++- [safetensors](https://github.com/huggingface/safetensors): the container+ every engine reads (`c/st.h`), including its fp8 and I64 dtypes.+- [tiktoken](https://github.com/openai/tiktoken): `c/tok.h` reimplements its+ `byte_pair_encode` exactly, merging the adjacent pair whose concatenation has+ the lowest vocab id, so a tiktoken-derived vocabulary needs no merges list.+- [llama.cpp](https://github.com/ggml-org/llama.cpp): the GBNF grammar subset+ in `c/grammar.h` follows its syntax and its set-of-stacks PDA, and the Metal+ path borrows its `newBufferWithBytesNoCopy` residency trick.+- [vLLM](https://github.com/vllm-project/vllm): the reference for output+ semantics the engine matches position by position (e.g. where the final norm+ lands relative to the LM head).+- [transformers](https://github.com/huggingface/transformers): the oracle:+ CI reproduces a random-init model token for token against it.+- [DietGPU](https://github.com/facebookresearch/dietgpu): the GPU ANS codec+ behind the experimental compressed expert tier (`COLI_ANS`).+- [rocWMMA](https://github.com/ROCm/rocWMMA): the HIP backend maps CUDA's+ `nvcuda::wmma` fragment/mma_sync API onto it (`c/backend_gpu_compat.h`), which+ is what lets one .cu source compile for both vendors.+## LicenseApache 2.0, Copyright 2026 Vincenzo Fornaro. See [LICENSE](LICENSE) and [NOTICE](NOTICE). Each model keeps the licence its authors gave it (GLM-5.2 weights are released by Z.ai under MIT; Qwen-Image-2.1 is for non-commercial use only).diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 7b7837c1..c5bf00a4 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -94,7 +94,7 @@ Starting colibri|---|---|| 下载过程中停止了 | 再次运行同一条命令:它会从磁盘上已有的字节处继续 || `to use the GPU through ..., first run: <command>` | 运行这条命令,然后再运行一次安装程序:它会为 GPU 重新编译,不会重新下载 |-| 用 CUDA 编译时出现 `the ... build failed`,例如已安装的 CUDA toolkit 不再支持这张显卡时出现的 `Unsupported gpu architecture` | `./start-here.sh --backend vulkan` 通过 Vulkan 使用这张显卡;`--no-gpu` 则只使用 CPU |+| `the ... build failed`,例如已安装的 CUDA toolkit 不再支持这张显卡时出现的 `Unsupported gpu architecture` | 安装程序会先把 toolkit 和显卡对照检查,自行选择 Vulkan,并说明原因;如果编译仍然失败,它会提供下一个选项(先 Vulkan,再 CPU)。`./start-here.sh --backend vulkan` 强制使用 Vulkan;`--no-gpu` 则只使用 CPU || `needs N GB free for the download` | 用 `--dir` 指定一个更大磁盘上的文件夹 || 在 WSL 中,模型文件夹位于 `/mnt/c` 下 | 把它放在 Linux 磁盘上(即默认的 `~/colibri-models`):`/mnt/c` 要慢很多倍 || 其他情况 | `c/coli logs -n 50` 显示服务器日志,`c/coli logs --install` 显示安装程序的日志;提交一个 [issue](https://github.com/JustVugg/colibri/issues),附上安装程序最后打印的几行 |@@ -205,7 +205,7 @@ Starting colibri集成显卡与 CPU 共用内存。它节省的是它所持有的那些专家的计算量和磁盘读取,因此在 Qwen3.6 这样的模型上有收益,而像 OLMoE 这样专家本来就在内存中的小模型,反而可能变慢。正因如此,安装程序只为 Qwen3.6、Qwen3-Coder 和 Qwen3.8-Flash-Next 在集成显卡上开启 Vulkan,并且每个引擎自行决定是否在集成显卡上运行稠密链(Qwen3.6 会,Qwen3.8 不会)。`--backend vulkan` 则无论如何都会使用 Vulkan。-在独立显卡上,安装程序会为每个引擎编译 Vulkan 版本(如果引擎有 CUDA 路径且装有 toolkit,则优先使用 CUDA),并把稠密层放在显卡上。这正是该设计所针对的情形,但它**尚未实测:还没有任何独立显卡运行过专家层级或稠密链。**(在它们之前,GLM-5.2 较早的 Vulkan 路径在独立显卡 RX 9070 上的解码速度为 1.7-1.8 tok/s。)欢迎提供你的显卡上的数据。+在独立显卡上,安装程序会为每个引擎编译 Vulkan 版本(如果引擎有 CUDA 路径且装有 toolkit,则优先使用 CUDA),并把稠密层放在显卡上。这正是该设计所针对的情形。**我们自己还没有实测过独立显卡。**第一份数据来自一位用户:Qwen3.6 在 Tesla V100 16 GB 上,配合专家层级和稠密链,解码速度为 17 到 19 tok/s([#1852](https://github.com/JustVugg/colibri/issues/1852))。(在它们之前,GLM-5.2 较早的 Vulkan 路径在独立显卡 RX 9070 上的解码速度为 1.7-1.8 tok/s。)欢迎提供你的显卡上的数据。**没有 Resizable BAR 的显卡**现在也能用了。这类显卡(所有 Turing 显卡、使用首发固件的 Ampere 显卡、关闭了该选项的较旧 AMD 显卡)只允许 CPU 直接写入其显存中约 256 MB 的部分;colibri 现在会自动通过一个暂存缓冲区(staging buffer)把权重复制进去。这条路径已通过强制启用以及在三种设备上模拟小窗口进行了测试,在 780M 上没有可测量的开销;尚未在真正没有 Resizable BAR 的显卡上实测([vulkan.md](docs/vulkan.md#memory-placement-without-resizable-bar))。@@ -217,7 +217,7 @@ CI 在软件驱动上将每个引擎的 Vulkan 路径与 CPU 的 token 对照检- **显存专家层级**把最热的专家放在显卡上,这些专家根据实测路由选出;未命中的专家同时在 CPU 上计算。Qwen3.6 在两张 8 GB 显卡(RTX 3070 和 Quadro RTX 4000)上、有热的路由历史时,解码速度为 11.3 tok/s([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md));GLM-5.2 在六张 RTX 5090 上、全部专家常驻时为 9.0-9.2 tok/s([benchmarks.md](docs/benchmarks.md));DeepSeek V4 Flash 在一张 RTX 5080 上为 1.5-1.6 tok/s,3,324 个 token 的提示词用时 90 秒([deepseek-v4.md](docs/deepseek-v4.md))。- **Qwen3.6 新功能:DeltaNet 层放在显卡上**(`Q36_DN_GPU=1`,需手动开启)。以前,Qwen3.6 的 30 个 DeltaNet 层中,每一层对每个 token 都要在显卡和 CPU 之间复制四次数据;现在,解码一个 token 时整个层都在显卡上运行,其循环状态保留在显存中。在 RTX 3070 上、稠密层位于显存时:从 25.4 提升到 30.0 tok/s([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md#the-deltanet-layer-on-the-card-q36_dn_gpu1))。-- **较旧的显卡。** 如果 CUDA toolkit 已不再支持为你的显卡编译(例如 CUDA 13 与 V100,见 [#1852](https://github.com/JustVugg/colibri/issues/1852)),编译会停止:此时 `--backend vulkan` 会改为通过 Vulkan 使用这张显卡。DeepSeek V4 的 CUDA 层级也可以为 Pascal 和 Turing 编译(`CUDA_ARCH=portable-pre-ampere NO_TC=1`)。+- **较旧的显卡。** 如果 CUDA toolkit 已不再支持为你的显卡编译(例如 CUDA 13 与 V100,见 [#1852](https://github.com/JustVugg/colibri/issues/1852)),安装程序会在编译之前就发现这一点,并说明原因,转而通过 Vulkan 使用这张显卡;装上 CUDA 12.x toolkit 可以恢复 CUDA 路径。DeepSeek V4 的 CUDA 层级也可以为 Pascal 和 Turing 编译(`CUDA_ARCH=portable-pre-ampere NO_TC=1`)。全部内容:[docs/cuda.md](docs/cuda.md)。@@ -454,6 +454,41 @@ colibri 最初是一个人在一台 12 核心、25 GB 内存的笔记本上开colibri 只是一个引擎;它运行的智慧是一份馈赠。感谢以开放方式发布权重的团队:**Z.ai**(GLM)、**Moonshot AI**(Kimi)、**Alibaba Qwen**、**DeepSeek**、**Xiaomi**(MiMo)、**Thinking Machines**(Inkling)、**Allen AI**(OLMoE)、**Convai Innovations**(Laya)、**fastino**(GLiNER2.5-Decide)和 **Cloudflare**(Clef);感谢发布转换后容器的人;也感谢每一位做过基准测试、二分定位问题、复现图谱运行或提交补丁的贡献者。本仓库中的第三方代码及其许可证:[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。+本项目在专家放置、压缩与路由方面的实验,也建立在以下开放研究与系统工作的思路和证据之上:++- [REAP](https://github.com/CerebrasResearch/reap) 与+ [EASY-EP](https://github.com/RUCAIBox/EASYEP):输出感知的与特定领域的专家重要性。+- [SERE](https://github.com/JL-Cheng/SERE):基于相似度的专家重路由;+ [ReMoE](https://github.com/BUAA-OSCAR/ReMoE):感知缓存局部性的路由器微调。+- [MC-SMoE](https://github.com/UNITES-Lab/MC-SMoE):路由引导的专家合并与压缩。+- [MoBE](https://github.com/inclusionAI/MoBE) 与+ [D²-MoE](https://github.com/lliai/D2MoE):共享专家基与低秩专家增量。+- [HybriMoE](https://github.com/PKU-SEC-Lab/HybriMoE):CPU/GPU 混合专家调度;+ [ScMoE](https://arxiv.org/abs/2404.05019):专家通信与计算的重叠;+ [OD-MoE](https://arxiv.org/abs/2512.03927):分布式按需专家加载。+- [vLLM](https://github.com/vllm-project/vllm)、+ [llama.cpp](https://github.com/ggml-org/llama.cpp) 与+ [kTransformers](https://github.com/kvcache-ai/ktransformers):开放的推理系统与专家卸载工作,+ 使对比得以复现。++引擎也建立在具体的工程成果之上,而不只是思路。以下每一项如今都在代码树中被使用或重新实现:++- [safetensors](https://github.com/huggingface/safetensors):每个引擎读取的容器格式+ (`c/st.h`),包括其 fp8 与 I64 数据类型。+- [tiktoken](https://github.com/openai/tiktoken):`c/tok.h` 精确地重新实现了它的+ `byte_pair_encode`,合并拼接后词表 id 最小的相邻对,因此源自 tiktoken 的词表不需要 merges 列表。+- [llama.cpp](https://github.com/ggml-org/llama.cpp):`c/grammar.h` 中的 GBNF 语法子集遵循它的+ 语法与 set-of-stacks PDA,Metal 路径也借用了它的 `newBufferWithBytesNoCopy` 常驻技巧。+- [vLLM](https://github.com/vllm-project/vllm):引擎逐位置对齐的输出语义参考(例如最终 norm+ 相对于 LM head 的位置)。+- [transformers](https://github.com/huggingface/transformers):oracle;CI 以它为基准逐 token+ 复现一个随机初始化的模型。+- [DietGPU](https://github.com/facebookresearch/dietgpu):实验性压缩专家层级(`COLI_ANS`)背后的+ GPU ANS 编解码器。+- [rocWMMA](https://github.com/ROCm/rocWMMA):HIP 后端把 CUDA 的 `nvcuda::wmma`+ fragment/mma_sync API 映射到它之上(`c/backend_gpu_compat.h`),这让同一份 .cu 源码可以为+ 两家厂商编译。+## 许可证Apache 2.0,Copyright 2026 Vincenzo Fornaro。详见 [LICENSE](LICENSE) 与 [NOTICE](NOTICE)。每个模型保留其作者给出的许可证(GLM-5.2 权重由 Z.ai 以 MIT 许可发布;Qwen-Image-2.1 仅限非商业用途)。diff --git a/README.zh-TW.md b/README.zh-TW.mdindex 35e13c71..ad44f532 100644--- a/README.zh-TW.md+++ b/README.zh-TW.md@@ -120,7 +120,7 @@ Starting colibri|---|---|| 下載到一半停止了 | 再執行一次相同的指令:它會從硬碟上已有的位元組接著下載 || `to use the GPU through ..., first run: <command>` | 執行那條指令,然後再執行一次安裝程式:它會為 GPU 重新建置,不會重新下載 |-| 用 CUDA 建置時出現 `the ... build failed`,例如已安裝的 CUDA toolkit 不再支援這張顯示卡時出現的 `Unsupported gpu architecture` | `./start-here.sh --backend vulkan` 會透過 Vulkan 使用這張顯示卡;`--no-gpu` 則留在 CPU 上 |+| `the ... build failed`,例如已安裝的 CUDA toolkit 不再支援這張顯示卡時出現的 `Unsupported gpu architecture` | 安裝程式會先把 toolkit 和顯示卡對照檢查,自行選擇 Vulkan,並說明原因;如果建置仍然失敗,它會提供下一個選項(先 Vulkan,再 CPU)。`./start-here.sh --backend vulkan` 會強制使用 Vulkan;`--no-gpu` 則留在 CPU 上 || `needs N GB free for the download` | 用 `--dir` 指定一個位於較大硬碟上的資料夾 || 在 WSL 上,模型資料夾位於 `/mnt/c` 底下 | 把它放在 Linux 磁碟上(預設的 `~/colibri-models`):`/mnt/c` 慢上好幾倍 || 其他任何問題 | `c/coli logs -n 50` 會顯示伺服器日誌,`c/coli logs --install` 則顯示安裝程式的日誌;請附上安裝程式最後印出的幾行,開一個 [issue](https://github.com/JustVugg/colibri/issues) |@@ -287,8 +287,10 @@ Qwen3.8-Flash-Next 在內建顯示晶片上開啟 Vulkan,`--backend vulkan` 則無論如何都會要求使用 Vulkan。在獨立顯示卡上,安裝程式會為每個引擎建置 Vulkan(若引擎有 CUDA 路徑且已安裝 toolkit,-則優先使用 CUDA),並把稠密層放在顯示卡上。這正是此設計所針對的情況,-但它**尚未實測:還沒有任何獨立顯示卡跑過專家層級或稠密鏈。**+則優先使用 CUDA),並把稠密層放在顯示卡上。這正是此設計所針對的情況。+**我們自己還沒有實測過獨立顯示卡。** 第一份數據來自一位使用者:Qwen3.6 在+Tesla V100 16 GB 上,搭配專家層級與稠密鏈,解碼速度為 17 到 19 tok/s+([#1852](https://github.com/JustVugg/colibri/issues/1852))。(在它們出現之前,GLM-5.2 較早的 Vulkan 路徑在獨立的 RX 9070 上解碼速度為 1.7-1.8 tok/s。)歡迎提供你的顯示卡的數據。@@ -328,7 +330,8 @@ DeepSeek V4 Flash、Qwen3.8-Flash-Next,以及 Qwen3.6 與 Qwen3-Coder。([qwen36-cuda-tier.md](docs/qwen36-cuda-tier.md#the-deltanet-layer-on-the-card-q36_dn_gpu1))。- **較舊的顯示卡**。如果 CUDA toolkit 已不再支援為你的顯示卡編譯(例如[#1852](https://github.com/JustVugg/colibri/issues/1852) 中的 CUDA 13 與 V100),- 建置會停止:此時 `--backend vulkan` 會改為透過 Vulkan 使用這張顯示卡。+ 安裝程式會在建置之前就先發現,並說明原因,轉而透過 Vulkan 使用這張顯示卡;+ 安裝 CUDA 12.x toolkit 可以讓 CUDA 路徑恢復。DeepSeek V4 的 CUDA 層級也可以為 Pascal 與 Turing 建置(`CUDA_ARCH=portable-pre-ampere NO_TC=1`)。@@ -676,6 +679,41 @@ colibri 只是一個引擎;它所執行的智慧是一份饋贈。感謝以開也感謝每一位做過基準測試、二分定位問題、重現圖譜執行或提交修補的貢獻者。本儲存庫中的第三方程式碼及其授權條款:[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。+本專案在專家配置、壓縮與路由方面的實驗,也建立在以下開放研究與系統工作的構想和證據之上:++- [REAP](https://github.com/CerebrasResearch/reap) 與+ [EASY-EP](https://github.com/RUCAIBox/EASYEP):輸出感知的與特定領域的專家重要性。+- [SERE](https://github.com/JL-Cheng/SERE):基於相似度的專家重新路由;+ [ReMoE](https://github.com/BUAA-OSCAR/ReMoE):感知快取區域性的路由器微調。+- [MC-SMoE](https://github.com/UNITES-Lab/MC-SMoE):路由引導的專家合併與壓縮。+- [MoBE](https://github.com/inclusionAI/MoBE) 與+ [D²-MoE](https://github.com/lliai/D2MoE):共享專家基底與低秩專家增量。+- [HybriMoE](https://github.com/PKU-SEC-Lab/HybriMoE):CPU/GPU 混合專家排程;+ [ScMoE](https://arxiv.org/abs/2404.05019):專家通訊與運算的重疊;+ [OD-MoE](https://arxiv.org/abs/2512.03927):分散式隨需專家載入。+- [vLLM](https://github.com/vllm-project/vllm)、+ [llama.cpp](https://github.com/ggml-org/llama.cpp) 與+ [kTransformers](https://github.com/kvcache-ai/ktransformers):開放的推論系統與專家卸載工作,+ 讓比較得以重現。++引擎也建立在具體的工程成果之上,而不只是構想。以下每一項如今都在程式碼樹中被使用或重新實作:++- [safetensors](https://github.com/huggingface/safetensors):每個引擎讀取的容器格式+ (`c/st.h`),包括其 fp8 與 I64 資料型別。+- [tiktoken](https://github.com/openai/tiktoken):`c/tok.h` 精確地重新實作了它的+ `byte_pair_encode`,合併串接後詞彙 id 最小的相鄰對,因此源自 tiktoken 的詞彙表不需要 merges 清單。+- [llama.cpp](https://github.com/ggml-org/llama.cpp):`c/grammar.h` 中的 GBNF 文法子集遵循它的+ 語法與 set-of-stacks PDA,Metal 路徑也借用了它的 `newBufferWithBytesNoCopy` 常駐技巧。+- [vLLM](https://github.com/vllm-project/vllm):引擎逐位置對齊的輸出語意參考(例如最終 norm+ 相對於 LM head 的位置)。+- [transformers](https://github.com/huggingface/transformers):oracle;CI 以它為基準逐 token+ 重現一個隨機初始化的模型。+- [DietGPU](https://github.com/facebookresearch/dietgpu):實驗性壓縮專家層級(`COLI_ANS`)背後的+ GPU ANS 編解碼器。+- [rocWMMA](https://github.com/ROCm/rocWMMA):HIP 後端把 CUDA 的 `nvcuda::wmma`+ fragment/mma_sync API 對應到它之上(`c/backend_gpu_compat.h`),這讓同一份 .cu 原始碼可以為+ 兩家廠商編譯。+## 授權條款Apache 2.0,Copyright 2026 Vincenzo Fornaro。詳見 [LICENSE](LICENSE) 與 [NOTICE](NOTICE)。每個模型都保留其作者賦予的授權條款(GLM-5.2 權重由 Z.ai 以 MIT 授權發布;Qwen-Image-2.1 僅限非商業用途)。