Repository navigation
models: Add Flint model (FlintForCausalLM) - #30928
Conversation
| // note: this can technically be: | ||
| // e = ggml_scale(ctx0, amax, 1.0f/32768.0f); | ||
| // but we leave x32 headroom for the F16 sums of 32 values in Q8 activation blocks | ||
| e = ggml_scale(ctx0, amax, 1.0f/1024.0f); |
There was a problem hiding this comment.
This is related to: #30861 (comment)
A workaround until we have a better fix.
There was a problem hiding this comment.
This is super interesting. I faced this problem when testing Mellum 2.1 on CUDA with a Q5 quant. Codex patched it inside ggml-cuda.cu with additional CUDA kernels conditionally downscaling the activations before calling ggml_cuda_mul_mat_id and scaling them back afterwards. Unsure if slop or viable option, thought mentioning here wouldn't hurt.
This comment was marked as resolved.
This comment was marked as resolved.
…l-org#30928 has been added and adapted.
|
Related Flint bug report: #31000. With Flint NVFP4 on b11823 and OpenCode 2.1.2, some turns contain literal tool-call XML only in reasoning and end with |
docs/models/flint covers: - README: architecture, acquisition, usage, the quantizations the kernels accept, reasoning and tool-call behaviour, and memory. - QUALITY: GPU engine vs scalar CPU oracle vs llama.cpp logit agreement, tokenizer and template parity evidence, replay guarantees (batched == serial, split prefill, snapshots), known limits, and reproduction commands. - EXPERIMENTS: retained and rejected kernel and engine decisions. - BENCHMARKS: HTTP sweeps against llama-server on the same UD-Q4_K_XL GGUF, performance power profile. Headline results vs llama.cpp: pp2048 2372.9 vs 1665.8 tok/s (+42%), tg128 67.65 vs 53.77 tok/s (+26%), 131K-depth tg 30.99 vs 27.77 (+12%), 8-user decode 270.94 vs 194.85 tok/s (+39%), load 4.1 vs 5.3 s. Peak memory at 133K context is 1.3% higher. The pinned .#llama-cpp-reference (b11069) predates Flint. The reference is therefore an ad-hoc ROCm build of upstream llama.cpp 970b51ce, which includes Flint support from a37cc461 (ggml-org/llama.cpp#30928). Its revision and build flags are recorded in model-identities.json; a Nix pin is still needed. The model is also listed in the root README, docs/BENCHMARKS.md, docs/TESTING.md, check-docs and the benchmark-model skill.
Picks up Flint architecture support (ggml-org/llama.cpp#30928). Rebases llama-opencl-adreno-cpy-constreg.patch onto the gemv_noshuffle_q4_k glu kernel change from #30421. Signed-off-by: Mengsheng Wu <mengshengwu@outlook.com>
Row declared with this spec. Scope, upstream anchors, design, risks, gates and owed items are in the spec; the issue records the same first wave. The reason this row exists now: the quantized artifacts are on disk and sha256-verified, llama.cpp's only flint support is an open PR from the model author (ggml-org/llama.cpp#30928, head 1b44e30775dcb2f93952116b05f89e5bd797f b00), vLLM has no flint code, and the peer (mistral.rs) has started a Flint implementation — so the architecture has a reference implementation to gate against and a second implementation to cross-check. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [maki]
* chore(llama-cpp): bump to a37cc461 and drop the TTS patch Move the llama.cpp pin to a37cc461, the merge of the Flint architecture (ggml-org/llama.cpp#30928). The TTS task patch is gone: upstream now carries SERVER_TASK_TYPE_TTS, server_task::tts_inp, server_task_result_tts, server_context_meta::has_cap_tts and the mtmd gen-audio helpers. The patch is detected as already applied on the new pin. The gRPC server uses the same symbols. The bonsai and turboquant forks still lack them and keep using disable-tts-task.sh, so they are unchanged. The score task patch is still needed: upstream has no SERVER_TASK_TYPE_SCORE. It is regenerated against the new pin and applies with no offset or fuzz. Upstream added SERVER_TASK_TYPE_TRANSCRIBE_RT to server_task::need_logits(), which broke one hunk, so SCORE is added next to it by hand. The C++ backend was not built for this change. Assisted-by: Claude:claude-sonnet-5-5 * feat(gallery): add flint Add Recursive Flint, a 39.8B mixture-of-experts coding model with about 2.5B active parameters, from the Unsloth GGUF repository. It runs on llama.cpp with the Flint architecture support added upstream in ggml-org/llama.cpp#30928. Three quantizations are listed, with the default declaring the others as variants: UD-Q4_K_XL (25 GB), UD-Q2_K_XL (13.6 GB) for small hosts and UD-Q6_K_XL (36 GB) for larger ones. Sampling defaults follow the model card (temperature 1, top_p 0.95, top_k 20). The library file gallery/models/index.yaml is edited and gallery/index.yaml is regenerated from it. Assisted-by: Claude:claude-sonnet-5-5 --------- Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
The b11069 .#llama-cpp-reference predates Flint support, so Flint's comparisons used an unpinned ROCm build. .#llama-cpp-flint-reference builds upstream llama.cpp 970b51ce (build 11827, which includes Flint support from a37cc461, ggml-org/llama.cpp#30928). It uses the same ROCm overrides as the other references and installs llama-server-flint and llama-bench-flint, so it can sit in one shell with the other llama.cpp pins.
…0928 Flint is a 39.8B-A2.5B MoE coder: 256 routed experts top-6 plus a shared expert, 49 layers (2 dense + 47 MoE), hybrid attention (35 sliding-window layers, window 513, with the other 14 full attention), GQA 32 q / 4 kv, head dim 128, per-head QK RMSNorm, learned attention sinks, RoPE only on the sliding-window layers. Ported from ggml-org/llama.cpp ggml-org#30928 (a37cc46): - src/models/flint.cpp + the llama_model_flint entry in models.h - LLM_ARCH_FLINT in llama-arch, loader mapping and rope type in llama-model - vocab: LLAMA_VOCAB_PRE_TYPE_FLINT pre-tokenizer and the Flint end-of-generation ids - gguf-py: MODEL_ARCH.FLINT, its tensor list, the softmax_offset sinks mapping, and the flint.attention.rope_pattern key Prerequisites our base did not have, brought in because Flint needs them: - per-layer RoPE flags: hparams.rope_pattern, llama_hparams::has_rope(), LLM_KV_ATTENTION_ROPE_PATTERN and the default fill (all layers RoPE) - llama-kv-cache: only K-shift when a layer in the cache actually has RoPE - gguf-py: GGUFWriter::add_rope_pattern - llama-model-saver: Flint joins the archs the saver skips, because it keeps a per-layer SWA pattern and the saver does not write that key back yet test-llama-archs: Flint row (MoE mandatory, half-SWA pattern, rope pattern, expert weights norm/scale, shared expert FF). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…0928 (#134) Flint is a 39.8B-A2.5B MoE coder: 256 routed experts top-6 plus a shared expert, 49 layers (2 dense + 47 MoE), hybrid attention (35 sliding-window layers, window 513, with the other 14 full attention), GQA 32 q / 4 kv, head dim 128, per-head QK RMSNorm, learned attention sinks, RoPE only on the sliding-window layers. Ported from ggml-org/llama.cpp ggml-org#30928 (a37cc46): - src/models/flint.cpp + the llama_model_flint entry in models.h - LLM_ARCH_FLINT in llama-arch, loader mapping and rope type in llama-model - vocab: LLAMA_VOCAB_PRE_TYPE_FLINT pre-tokenizer and the Flint end-of-generation ids - gguf-py: MODEL_ARCH.FLINT, its tensor list, the softmax_offset sinks mapping, and the flint.attention.rope_pattern key Prerequisites our base did not have, brought in because Flint needs them: - per-layer RoPE flags: hparams.rope_pattern, llama_hparams::has_rope(), LLM_KV_ATTENTION_ROPE_PATTERN and the default fill (all layers RoPE) - llama-kv-cache: only K-shift when a layer in the cache actually has RoPE - gguf-py: GGUFWriter::add_rope_pattern - llama-model-saver: Flint joins the archs the saver skips, because it keeps a per-layer SWA pattern and the saver does not write that key back yet test-llama-archs: Flint row (MoE mandatory, half-SWA pattern, rope pattern, expert weights norm/scale, shared expert FF). Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
reference/llama.cpp predates Flint support (ggml-org/llama.cpp#30928), and moving that pin would move the calibrated parity floors of every other checkpoint. reference/llama.cpp-flint sits at the Flint merge, a37cc461, and build-llamacpp.sh takes the checkout as an optional argument. This llama.cpp revision fails to build the server and cli targets unless the UI asset gzip step is off, so the script now passes LLAMA_UI_GZIP=OFF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FQuaJnVoxF8s1wvU9Antfa
* Add Flint model (FlintForCausalLM). Assisted by Codex * cleanup * one more --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
* Add Flint model (FlintForCausalLM). Assisted by Codex * cleanup * one more --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
El PR ggml-org#30928 (flint) usa cuatro cosas de upstream que este arbol no tenia (son de commits de upstream posteriores a agosto-2026): - hparams.rope_pattern: el patron de RoPE por capa. El GGUF de flint lo trae ('<arch>.attention.rope_pattern': 1 = usa RoPE, 0 = NoPE) y sin el las capas densas se desplazarian con RoPE cuando no toca. - hparams.has_rope(il): si esa capa usa RoPE. El K-shift solo se aplica si alguna capa lo usa: una capa NoPE no se puede desplazar. - LLM_KV_ATTENTION_ROPE_PATTERN: la clave (enum de llama-arch.h, su tabla de cadenas y el LLM_KV de gguf-py). - hparams.n_ff_exp por capa: aqui n_ff_exp es un escalar (los demas MoE lo cargan asi). Se anade n_ff_exp_layer(il), que usa el patron por capa si lo hay y si no el escalar, y flint lo usa para dimensionar los tensores de los expertos. Ademas, flint necesita el reescalado del src1 del MoE (el amax de upstream, PR ggml-org#30656) porque su activacion puede desbordar f16. Este fork sustituyo ese mecanismo por el guard L2 propio (que solo actua en Metal), asi que se anade una rama especifica para FLINT que conserva la via de upstream (el reescalado solo afecta a la proyeccion 'down' y se deshace con scale_s). Y el enum de los pre-types del vocab: FLINT=62 no colisiona con INKLING=57 ni con SPARK2_5=58 (los valores no se persisten: el GGUF guarda el nombre, no el numero; y no se usan como indice).
Overview
Adds Flint (
FlintForCausalLM) support, including Hugging Face to GGUF conversion, tokenizer handling, and inference with sliding/full attention and routed/shared experts.Uses the adaptive expert-activation scaling from #30861 with a 1,024 threshold, leaving headroom for 32-value Q8 activation block sums to fit in F16.
The model's chat template requires for hexadecimal string escapes.
GGUF repositories: NVFP4 and INT4
Additional information
test-llama-archspasses on CPU, CUDA and Metal, including checks for Mistral4/Mellum, which share the scaling helper.Most runtime validation used existing GGUFs.
Requirements