Instructions to use HelloSun/flint_cpu_opt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use HelloSun/flint_cpu_opt with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama cli -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Use Docker
docker model run hf.co/HelloSun/flint_cpu_opt:UD-Q4_K_XL
- Llama new
- LM Studio
- Jan
- vLLM
How to use HelloSun/flint_cpu_opt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HelloSun/flint_cpu_opt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HelloSun/flint_cpu_opt", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/HelloSun/flint_cpu_opt:UD-Q4_K_XL
- Ollama
How to use HelloSun/flint_cpu_opt with Ollama:
ollama run hf.co/HelloSun/flint_cpu_opt:UD-Q4_K_XL
- Unsloth Desktop
- Pi
How to use HelloSun/flint_cpu_opt with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "HelloSun/flint_cpu_opt:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use HelloSun/flint_cpu_opt with Docker Model Runner:
docker model run hf.co/HelloSun/flint_cpu_opt:UD-Q4_K_XL
- Lemonade
How to use HelloSun/flint_cpu_opt with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull HelloSun/flint_cpu_opt:UD-Q4_K_XL
Run and chat with the model
lemonade run user.flint_cpu_opt-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use HelloSun/flint_cpu_opt with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default HelloSun/flint_cpu_opt:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use HelloSun/flint_cpu_opt with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf HelloSun/flint_cpu_opt:UD-Q4_K_XL
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "HelloSun/flint_cpu_opt:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Model card: file comparison, results, accuracy, limitations
Browse files
README.md
CHANGED
|
@@ -1,19 +1,110 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
[HelloSun/Qwen3.6-35B-A3B-GGUF_CPU_OPT](https://huggingface.co/HelloSun/Qwen3.6-35B-A3B-GGUF_CPU_OPT).
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
taskset -c 0-15 llama.cpp/build/bin/llama-cli -m flint-UD-Q4_K_XL.gguf -t 16 -fa on -lm mlock
|
| 10 |
```
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
(54 t/s decode, faster than the Q4_K_XL file's 43 t/s, but prefill is 209 vs 307 t/s). See `benchmarks/q41-summary.md`.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
base_model:
|
| 5 |
+
- RecursiveSI/flint
|
| 6 |
+
base_model_relation: quantized
|
| 7 |
+
tags:
|
| 8 |
+
- gguf
|
| 9 |
+
- llama.cpp
|
| 10 |
+
- cpu
|
| 11 |
+
- avx512-vnni
|
| 12 |
+
- amx
|
| 13 |
+
- moe
|
| 14 |
+
- flint
|
| 15 |
+
---
|
| 16 |
|
| 17 |
+
# flint CPU optimization (llama.cpp patch + two GGUF files)
|
| 18 |
+
|
| 19 |
+
[Recursive Flint](https://huggingface.co/RecursiveSI/flint) is a 39.8B-parameter mixture-of-experts coding model with about 2.5B
|
| 20 |
+
active parameters per token (256 experts, top-6, 49 layers). This repo holds a **llama.cpp CPU patch** that speeds it up on
|
| 21 |
+
Intel Xeon (AVX512-VNNI / AMX) and the two GGUF files it was tuned and measured on. **The GGUF files are unmodified**; every gain
|
| 22 |
+
comes from code (`patches/flint-cpu-opt.patch`, base commit `de5122d87`). It is in the style of
|
| 23 |
[HelloSun/Qwen3.6-35B-A3B-GGUF_CPU_OPT](https://huggingface.co/HelloSun/Qwen3.6-35B-A3B-GGUF_CPU_OPT).
|
| 24 |
|
| 25 |
+
| file | source | quant | size |
|
| 26 |
+
|---|---|---|---|
|
| 27 |
+
| `flint-UD-Q4_K_XL.gguf` | [unsloth/flint-GGUF](https://huggingface.co/unsloth/flint-GGUF) | Q5_K 11.6 GiB + IQ4_XS 9.0 GiB + Q8_0 2.0 GiB (+ small Q4_K/Q6_K/IQ3_S) | 23.3 GiB |
|
| 28 |
+
| `flint-int4-q4_1.gguf` | [RecursiveSI/flint-int4-gguf](https://huggingface.co/RecursiveSI/flint-int4-gguf) | Q4_1 for every weight (token_embd and router F32) | 24.2 GiB |
|
| 29 |
+
|
| 30 |
+
## Which file to use
|
| 31 |
+
|
| 32 |
+
Measured on Intel Xeon Platinum 8559C, 16 threads, with the patch (median of 3 interleaved rounds, tokens/s):
|
| 33 |
+
|
| 34 |
+
| file | prefill pp256 | prefill pp2048 | decode tg128 | PPL (wikitext-2, 32x512) |
|
| 35 |
+
|---|---|---|---|---|
|
| 36 |
+
| Q4_K_XL, stock llama.cpp | 231 | 274 | 38.2 | 18.363 +- 0.795 |
|
| 37 |
+
| **Q4_K_XL, patched** | **296** | **307** | 42.8 | 18.277 +- 0.787 |
|
| 38 |
+
| Q4_1, stock llama.cpp | 183 | 189 | 48.3 | 18.260 +- 0.780 |
|
| 39 |
+
| **Q4_1, patched** | 199 | 209 | **54.0** | 18.240 +- 0.779 |
|
| 40 |
+
|
| 41 |
+
- **Long prompts / large contexts (prefill-heavy): Q4_K_XL**. Its K-quant weights use the tiled VNNI matmul; patched prefill is ~47 % faster than Q4_1.
|
| 42 |
+
- **Chat and agent loops with a cached prefix (decode-heavy): Q4_1**. It reads fewer bytes per weight (0.625) and decodes ~26 % faster.
|
| 43 |
+
- Quality is equivalent within measurement error: the PPL differences above are smaller than the +-0.8 standard error of a 32-chunk test.
|
| 44 |
+
- Single runs on this shared host vary by about +-8 %; the numbers are medians, raw data in `benchmarks/`.
|
| 45 |
+
|
| 46 |
+
## Gain of the patch (vs stock llama.cpp, same file)
|
| 47 |
+
|
| 48 |
+
| file | pp256 | pp2048 | tg128 |
|
| 49 |
+
|---|---|---|---|
|
| 50 |
+
| Q4_K_XL | 1.28x | 1.12x | 1.12x |
|
| 51 |
+
| Q4_1 | 1.09x | 1.10x | 1.12x |
|
| 52 |
+
|
| 53 |
+
For Q4_K_XL most of this comes from the Qwen3.6 patch kernels (Q4_K/Q5_K/Q6_K VNNI, AMX tweaks, MoE tile grouping) also
|
| 54 |
+
applying to flint; against the Qwen3.6 patch alone the flint-specific part is small (pp256 +12 %, decode +2 %, pp2048 equal).
|
| 55 |
+
The flint-specific changes:
|
| 56 |
+
|
| 57 |
+
1. **IQ4_XS x Q8_K `vec_dot` in AVX512-VNNI** (x86 had AVX2 only). Unsigned LUT (+128) with `vpdpbusd`, bias removed through `bsums`, L2 prefetch.
|
| 58 |
+
2. **Q4_1 x Q8_1 `vec_dot` in AVX-512VL VNNI**. Two blocks per iteration, packed into one ymm with memory-source `vinserti128`, low/high nibbles each through one `vpdpbusd`, fp16 headers converted together. A 512-bit version using cross-lane shuffles was slower than stock and dropped.
|
| 59 |
+
3. Q5_K 5th-bit merge with `vptestmb` + masked add (bit-identical to the previous version, no speed change).
|
| 60 |
+
|
| 61 |
+
## Accuracy
|
| 62 |
+
|
| 63 |
+
Wikitext-2 test, 32 chunks x 512, KL divergence against stock llama.cpp logits of the same file:
|
| 64 |
+
|
| 65 |
+
| file | KLD patched vs stock | same top-1 | noise floor: stock vs stock with `-fa off` |
|
| 66 |
+
|---|---|---|---|
|
| 67 |
+
| Q4_K_XL | 0.0666 +- 0.0049 | ~92 % | 0.0762 (also `-ub 128`: 0.0700) |
|
| 68 |
+
| Q4_1 | 0.0364 +- 0.0029 | 93.8 % | 0.0385 |
|
| 69 |
+
|
| 70 |
+
The KLD is **inside the noise floor of stock itself**: flint is very sensitive to tiny numeric differences (changing only the
|
| 71 |
+
attention path of stock gives the same KLD), so it does not indicate a defect. Supporting checks: a graph-level `mul_mat` /
|
| 72 |
+
`mul_mat_id` test gives the same relative L2 error versus a float reference as stock (Q4_K/Q5_K/Q6_K/IQ4_XS ~7e-3, Q4_1 ~5.4e-3, Q8_0
|
| 73 |
+
~5.4e-3). Integer dot products are exact; only float accumulation order changes. Why small differences get amplified was not
|
| 74 |
+
verified (top-6-of-256 expert routing ties is a guess). The earlier version of this repo reported KLD 0.2058 for a different patch.
|
| 75 |
+
|
| 76 |
+
## Where the time goes (why further kernel work is limited)
|
| 77 |
+
|
| 78 |
+
Measured DRAM read bandwidth on this host is 125-175 GB/s with 16 threads (single thread 15 GB/s). Decode reads about 2 GB of
|
| 79 |
+
weights per token (~1.6 GB dense Q8_0 attention/shared-expert/lm_head, ~0.5 GB for the 6 selected experts), i.e. ~90 GB/s effective:
|
| 80 |
+
mostly memory-bound. Per-type effective bandwidth during decode (Q4_K_XL): Q8_0 dense ~100-170 GB/s (lm_head ~170), IQ4_XS experts ~100,
|
| 81 |
+
Q5_K experts ~50. The Q5_K gap is not kernel throughput (cache-resident Q5_K and IQ4_XS run the same, 232 vs 218 GB/s); a
|
| 82 |
+
prefetch-all-experts experiment did not help and was dropped; the cause was not found. Prefill is compute-bound; FlashAttention
|
| 83 |
+
(24 %) and MoE matmul are the largest items. Q4_1 prefill still uses the per-row `vec_dot` path (60 % of prefill time is
|
| 84 |
+
`MUL_MAT_ID q4_1`); adding it to the tiled GEMM would need per-32-block float scales in the tiled kernel and was not done.
|
| 85 |
+
|
| 86 |
+
## Build and run
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
./build.sh # clones llama.cpp at patches/BASE_COMMIT, applies patches/flint-cpu-opt.patch, builds with -DGGML_NATIVE=ON
|
| 90 |
taskset -c 0-15 llama.cpp/build/bin/llama-cli -m flint-UD-Q4_K_XL.gguf -t 16 -fa on -lm mlock
|
| 91 |
```
|
| 92 |
|
| 93 |
+
`GGML_IQ4XS_PF`, `GGML_Q41_PF`, `GGML_K4_PF`, `GGML_K5_PF`, `GGML_Q6_PF` tune the prefetch distances (defaults are the tuned
|
| 94 |
+
values). `patches/optional-profiler.patch` adds `GGML_PROF=1` per-op timing.
|
| 95 |
+
|
| 96 |
+
## Limitations
|
| 97 |
+
|
| 98 |
+
- Validated only on Intel Xeon Platinum 8559C (AVX512-VNNI + AMX), 16 threads, on a shared host. Other CPUs are untested; the new kernels need AVX512-VNNI (the Q4_1 one also AVX512VL/F16C).
|
| 99 |
+
- The Q4_K_XL numbers were measured before the Q4_1 kernel was added; the K-quant code path is unchanged except for removing unused constants, and was not re-benchmarked.
|
| 100 |
+
- PPL and KLD use a short test (32 x 512 tokens); no downstream task evaluation was run.
|
| 101 |
+
|
| 102 |
+
## Files
|
| 103 |
+
|
| 104 |
+
- `patches/flint-cpu-opt.patch` (base `patches/BASE_COMMIT`), `patches/optional-profiler.patch`, `build.sh`, `machine.txt`
|
| 105 |
+
- `benchmarks/summary.md` (Q4_K_XL), `benchmarks/q41-summary.md` (Q4_1), raw A/B CSVs, KLD logs, op profiles, KLD bisect, `graph_accuracy_test.cpp`
|
| 106 |
+
|
| 107 |
+
## Credits and license
|
| 108 |
|
| 109 |
+
Model: Recursive Flint (Apache-2.0), GGUF quantizations by Unsloth and RecursiveSI, unmodified. Patch builds on llama.cpp (MIT)
|
| 110 |
+
and reuses ideas from the Qwen3.6 CPU-OPT patch. This repo is Apache-2.0 for the model files; the patch follows llama.cpp's license.
|
|
|