Skip to content

Model : add hy_v4_flash support - #32517

Closed
Little0o0 wants to merge 12 commits into
ggml-org:masterfrom
Little0o0:hy4-flash
Closed

Little0o0 wants to merge 12 commits into
ggml-org:masterfrom
Little0o0:hy4-flash

Conversation

@Little0o0

@Little0o0 Little0o0 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Adds the Tencent Hy4 Flash model, hy_v4_flash architecture (HYV4FlashForCausalLM, HYV4FlashForConditionalGeneration), VL support for hy_v4 (IMROPE text tower, HYV4VLForConditionalGeneration), and the hy_v4_vl mmproj projectors.

hy_v4_flash keeps hy_v4's iHC, gated MLA and attention sinks, and adds a hybrid stack of sparse full-attention layers alternating with sliding-window layers, a compressed k-pool indexer on the sparse layers, Engram n-gram hash embeddings, latent-space routed experts and an MTP draft block.

Hy4 Flash model: https://huggingface.co/tencent/Hy4-flash
hy_v4_flash gguf: https://huggingface.co/AngelSlim/Hy4-flash-GGUF

Overview

Adds the hy_v4_flash architecture (HYV4FlashForCausalLM, HYV4FlashForConditionalGeneration), VL support for hy_v4 (IMROPE text tower, HYV4VLForConditionalGeneration), and the hy_v4_vl mmproj projectors.

hy_v4_flash keeps hy_v4's iHC, gated MLA and attention sinks, and adds a hybrid stack of sparse full-attention layers alternating with sliding-window layers, a compressed k-pool indexer on the sparse layers, Engram n-gram hash embeddings, latent-space routed experts and an MTP draft block.

Additional information

New files: src/llama-kv-cache-kpool.{h,cpp}, src/llama-memory-idx-iswa.{h,cpp}, conversion/hy_v4_flash.py, src/models/hy-v4-flash.cpp, tools/mtmd/models/hy-v4.cpp.

llama-memory-idx-iswa is a new memory type because llama_memory_hybrid_idx pairs one KV cache with a recurrent cache, while hy_v4_flash needs an iSWA pair plus the indexer cache and has no recurrent layers. We move the k-pool code from the llama_memory_hybrid_idx into llama_kv_cache_kpool. So llama_memory_hybrid_idx and llama-memory-idx-iswa share the k-pool code.

M-RoPE necessarily makes n_pos_per_embd() == 4, so KV-shift is off for every hy_v4_flash user, including text-only users who never touch images. At full context they now get "context full" instead of an automatic shift. However, without M-RoPE the image positions cannot be encoded correctly. This is the standard trade-off for every M-RoPE model in llama.cpp (qwen-vl behaves the same).

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - Claude Opus 5.5 is used in coding and GPT-6 is used for review. I have also reviewed all the code.
    Assisted-by: Claude Opus 5.5, GPT-6

@Little0o0
Little0o0 requested review from a team, CISC and ggerganov as code owners November 18, 2026 05:20
@github-actions github-actions Bot added model Model specific testing Everything test related mtmd Related to multimodal functionality (video/image/audio) conversion labels Nov 18, 2026
@pwilkin

pwilkin commented Nov 18, 2026

Copy link
Copy Markdown
Member

/bot review

@ggml-gh-bot

ggml-gh-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Automated code review

Review of PR #32517 (hy_v4_flash). Checklists run: General (always), New model/architecture, Multimodal (tools/mtmd/), Tests, plus the scope/security passes. No ggml backend or public API changes (good - no new ggml ops, no new llama.h surface).

Blocking

(point 1) Backward-compat risk for existing hy_v4 GGUFs from the NORM->IMROPE switch. src/llama-model.cpp:3835 now returns LLAMA_ROPE_TYPE_IMROPE for HY_V4 whenever use_mrope() is true, and src/models/hy-v4.cpp:46 newly reads rope.dimension_sections. Before this PR, hy_v4 never read sections, so a file carrying them was still run as interleaved NORM rope. The conversion base (conversion/base.py:1976) writes sections whenever the HF rope_parameters contains mrope_section - and the strip you added at conversion/hy_v4.py:119 only protects new conversions. If any previously published hy_v4 GGUF (e.g. the AngelSlim ones linked in the earlier hy_v4 PR) was converted from a config whose rope_parameters carries mrope_section, it now silently flips to NeoX/IMROPE rotation over rope rows that were never reordered to NeoX, i.e. garbage output on a file that used to work. Please verify that no published text-only hy_v4 file carries nonzero sections; if you cannot rule that out, gate the IMROPE path on something only the new VL conversion writes (a dedicated marker key) instead of the legacy sections key.

(point 2) Flash VL and M-RoPE: silently dropped or dead plumbing? HYV4NextVLForConditionalGeneration converts as arch hy_v4_flash, but src/models/hy-v4-flash.cpp never reads rope sections, llama_model_rope_type returns NORM for HY_V4_FLASH unconditionally, and the flash converter strips mrope_section and does not apply rope_rows_to_neox (only the hy_v4 VL subclass does). Yet the comment at src/models/hy-v4-flash.cpp:726 says the 4-plane new_pool_pos input exists "so the vision case can rotate pooled keys with mrope" - while the graph only consumes plane 0 (ggml_view_1d of n_new elements, NORM rope). Either (a) the flash VL reference really uses plain 1-D positions - then planes 1-3 of new_pool_pos and the set_input_kpool fills for them are dead weight and the comment is misleading, or (b) it uses interleaved M-RoPE like hy_v4 VL - then image position encoding is silently dropped and the model is wrong for images. Please confirm which, and trim or complete accordingly.

Will slow the review

(point 3) ~700 lines of the k-pool machinery are duplicated from llama-memory-hybrid-idx. set_input_kpool is a near byte-identical copy (~250 lines; the only real delta is the tail_full width), and kpool_layout_update/kpool_build_state/kpool_access/get_n_kpool* are copies too. You acknowledge this and defer unification to a follow-up, but these are exactly the kind of subtle invariants (stale tracking, rep dedup, padding) where a future fix in one copy will not reach the other. Consider extracting the shared context/layout core now - the memories differ mainly in which caches they wrap, not in the k-pool logic - or land the follow-up in the same cycle rather than "later".

(point 4) Unreachable by-order code in the new file. llama_memory_idx_iswa is only instantiated for hy_v4_flash, which never sets indexer_kpool_by_order (only qwen4exp sets it, and it uses hybrid_idx). So the by_order branches (sinfos_kpool, kpool_rank/rank vectors, order-mode pool scans) in llama-memory-idx-iswa.cpp are dead for the only user. Either drop them from this file or make the class actually parameterizable.

(point 5) Test coverage gaps in tests/test-llama-archs.cpp:

  • The new hy_v4 IMROPE path (rope-row reorder, use_mrope() branch, the inp_pos concat in hy-v4.cpp:518-523) is not exercised at all - the fixture deliberately writes {0,0,0,0} sections (tests/test-llama-archs.cpp:598). The dense/MoE variant loop already gives you two runs per arch; consider keying nonzero sections on one of them so both rope paths are covered.
  • The MTP draft block (graph_mtp, NEXTN_* tensors, the LLAMA_CONTEXT_TYPE_MTP filters in llama-model.cpp) is untested - the fixture adds no nextn_predict_layers.
  • The indexer-less hy_v4_flash fallback (indexer_top_k == 0 -> plain llama_kv_cache_iswa) is untested; the fixture always writes an indexer.

Nits

(point 6) Overflow-guard can itself wrap at src/models/hy-v4-flash.cpp:178: offsets[c] + primes[c] > (uint64_t) INT32_MAX is u64 addition, so two crafted values near 2^63 wrap past the guard and then get truncated into ple_head_offsets/ple_head_vocab_sizes. Bound the operands individually, e.g. offsets[c] > (uint64_t) INT32_MAX || primes[c] > (uint64_t) INT32_MAX - offsets[c].

(point 7) Copy-paste error message at tools/mtmd/mtmd-model.cpp:3494: the F32 position-embedding error under PROJECTOR_TYPE_HY_V4_FLASH/HY_V4_VL says "hy_v4 requires..." - should name the actual projector type.

(point 8) lookup_token_text_prefix (tools/mtmd/mtmd.cpp:1503) silently returns "" when the marker token is missing, leaving empty img_beg/img_end. A warning there would make a tokenizer-revision mismatch visible instead of quietly breaking image parsing.

(point 9) conversion/hy_v4_flash.py _engram_modify buffers parts and silently drops a whole group if any member tensor is missing - unlike the indexer, which gets a completeness check in prepare_tensors. Consider validating engram groups complete too.

Notes

Good things worth keeping as-is: the main attention routes through build_rope/get_rope_params (the K-shift agrees), the direct ggml_rope_ext in build_indexer_rope is justified because the indexer cache is ROPE_TYPE_NONE (no shift to drift from); loader-side validation of GGUF-derived values (ple array bounds vs LLAMA_MAX_PLE_HEADS, indexer/swa invariants, per-layer MLA geometry, n_head_kv == 1) is thorough and throws instead of asserting; the conversion and llama-quant.cpp agree on which tensors stay F32; AI disclosure is filled in correctly with Assisted-by. Comments are concise and ASCII-clean throughout the new files.

This review was generated automatically by pi coding agent using zai-org/GLM-5.3. It may contain mistakes. Maintainers make the final call.

@ngxson

ngxson commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

@Little0o0 your AI did not follow AGENTS.md carefully

ask it to read the full AGENTS.md again and rerun code-review skill offline

@ryant00000

ryant00000 commented Nov 19, 2026 •

Copy link
Copy Markdown

Maybe I'm somehow doing something wrong, but this doesn't seem to work with the official release from https://huggingface.co/tencent/Hy4-flash

convert_hf_to_gguf.py ./ --outfile /tmp/Hy4-Flash-BF16.gguf
INFO:hf-to-gguf:Loading model:
WARNING:hf-to-gguf:Failed to load model config from .: The checkpoint you are trying to load has model type `hy_v4_flash` but Transformers does not recognize this architecture.

Is this PR only for the pre-release from a while ago? I think the architecture name changed in the flash release, although I don't think any of the actual format did

@Little0o0
Little0o0 marked this pull request as ready for review November 19, 2026 20:23
@Little0o0

Copy link
Copy Markdown
Contributor Author

@Little0o0 your AI did not follow AGENTS.md carefully

ask it to read the full AGENTS.md again and rerun code-review skill offline

@ngxson Dear Xuan-son, I have revised them.

@Little0o0

Little0o0 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Maybe I'm somehow doing something wrong, but this doesn't seem to work with the official release from https://huggingface.co/tencent/Hy4-flash

convert_hf_to_gguf.py ./ --outfile /tmp/Hy4-Flash-BF16.gguf
INFO:hf-to-gguf:Loading model:
WARNING:hf-to-gguf:Failed to load model config from .: The checkpoint you are trying to load has model type `hy_v4_flash` but Transformers does not recognize this architecture.

Is this PR only for the pre-release from a while ago? I think the architecture name changed in the flash release, although I don't think any of the actual format did

@ryant00000 Dear Ryan, yes, architecture name changed in the flash release. I have modified the code to fit the name for the released bf16 model. It can pack the gguf from https://huggingface.co/tencent/Hy4-flash now.

harthuang added 6 commits November 21, 2026 21:54
Add the hy_v4_flash architecture (hybrid sparse/sliding-window attention with a k-pool indexer, Engram embeddings, latent MoE and an MTP draft block), M-RoPE VL support for hy_v4, and the hy_v4_flash / hy_v4_vl mmproj projectors.

Assisted-by: Claude Opus 5.5
Share the k-pool indexer code between llama_memory_hybrid_idx and llama_memory_idx_iswa via llama_kv_cache_kpool, drop the VL / mmproj changes and keep hy_v4 on NORM rope, trim comments.

Assisted-by: Claude Opus 5.5
The released Hy4-flash checkpoints name the architecture HYV4Flash*, call the sparse layers deepseek_sparse_attention, drop engram_enable and ship the Engram token map as a lookup_table tensor instead of engram_vocab_map.npz. Read the map from the tensor when it is there, keep the npz path for the checkpoints that carry it, and skip the dfly draft layers.

Assisted-by: Claude Opus 5, GPT-6
Read the M-RoPE sections of the HY4 VL text model again (IMROPE over NeoX ordered rope rows) and add back the hy_v4_vl mmproj projector.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
@arichiardi

Copy link
Copy Markdown
Contributor

I was eager to try this out and I am reporting what I see (mmproj not hooked up aside):

Nov 21 14:17:45 llamacpp@hy4-flash[217631]: 0.00.121.350 I srv  llama_server: initializing ...
Nov 21 14:17:45 llamacpp@hy4-flash[217631]: 0.00.121.358 I cmn  common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
Nov 21 14:17:45 puffin llamacpp@hy4-flash[217631]: 0.00.121.442 I srv  init_listene: The UI is disabled
Nov 21 14:17:45 llamacpp@hy4-flash[217631]: 0.00.121.444 I srv  init_listene: Use --ui/--no-ui (or deprecated --webui/--no-webui) to enable/disable
Nov 21 14:17:45 llamacpp@hy4-flash[217631]: 0.00.122.870 I srv    load_model: loading model '/var/lib/llm/models/gguf/AngelSlim/Hy4-flash-GGUF/Hy4-flash-Q3_K-00001-of-00002.gguf'
Nov 21 14:17:48 llamacpp@hy4-flash[217631]: 0.02.947.995 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
...

Please let me know if you need more - I have the model running here and can debug.

bmaltais pushed a commit to bmaltais/omarchy-local-ai that referenced this pull request Nov 21, 2026
Upstream llama.cpp doesn't run Hy4 flash yet (ggml-org/llama.cpp#32517 is open). Tencent's
AngelSlim publishes one patch against a pinned llama.cpp commit that adds the architecture, its
vision tower, multi-token prediction and SPARK-4Bit kernels tuned for the GB10. The image fetches
that patch at a pinned Hugging Face revision, checks its SHA-256, and builds llama-server with CUDA
13.4.3 for sm_121a, setting AngelSlim's recommended kernel switches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alfiedotwtf

Copy link
Copy Markdown

Very nice @Little0o0!

I've gone from 8t/s with the initial PR to 15t/s with this recent MTP commit... then combining "--spec-draft-n-max 4" with "--spec-draft-p-min 0.8", I'm hitting 19t/s!

@EmilPi

EmilPi commented Nov 22, 2026

Copy link
Copy Markdown

Hello @Little0o0 , thanks for your work! I get Nov 22 19:24:31 builder llama-server[3278591]: [49189] 0.00.489.975 E mtmd_get_memory_usage: error: load_hparams: unknown projector type: hy_v4_flash:

Nov 22 19:24:31 builder llama-server[3278591]: [49189] 0.00.488.666 I srv    load_model: loading model 'AngelSlim/Hy4-flash-GGUF:Q3_K'
Nov 22 19:24:31 builder llama-server[3278591]: [49189] 0.00.489.975 E mtmd_get_memory_usage: error: load_hparams: unknown projector type: hy_v4_flash
Nov 22 19:24:31 builder llama-server[3278591]: [49189]
Nov 22 19:24:31 builder llama-server[3278591]: [49189] 0.00.815.173 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
Nov 22 19:26:17 builder llama-server[3278591]: [49189] 1.46.040.594 I cmn          init: llama threadpool init, n_threads = 16
Nov 22 19:26:17 builder llama-server[3278591]: [49189] 1.46.657.006 E mtmd_init_from_file: error: load_hparams: unknown projector type: hy_v4_flash
Nov 22 19:26:17 builder llama-server[3278591]: [49189]
Nov 22 19:26:17 builder llama-server[3278591]: [49189] 1.46.657.011 E srv    load_model: failed to load multimodal model, '/home/ai/.cache/huggingface/hub/models--AngelSlim--Hy4-flash-GGUF/snapshots/bcbc7db5dcf4162cc1e1b8ed6c65567e843ebe46/mmproj-Hy4-flash-bf16.gguf'
Nov 22 19:26:17 builder llama-server[3278591]: [49189] 1.46.657.015 I srv    operator(): operator(): cleaning up before exit...
Nov 22 19:26:17 builder llama-server[3278591]: [49189] 1.46.660.065 E srv  server_run_i: exiting due to model loading error

My running config in .ini presets file is

[Hy4-Flash-Q3]
hf = AngelSlim/Hy4-flash-GGUF:Q3_K
ctx-size = 131072
ctk = q8_0
ctv = q8_0
no-mmproj-offload = true
fit = off
cmoe = true
moe-cache-mib = 33768
load-mode = none

I compiled from source and commit history is

commit 5c96c98047c6710072e2bea4b59277ef3847f2ff (HEAD -> hy4-flash)
Author: harthuang <[email protected]>
Date:   Sat Nov 21 22:23:42 2026 +0800

    model : hy_v4_flash : fix conflicts after rebase
    
    Assisted-by: Claude Opus 5.5

commit c0477ee354ec0c6a48f5ef5343edffdb6f6f5aac
Author: harthuang <[email protected]>
Date:   Fri Nov 20 04:15:58 2026 +0800

    mtmd : hy_v4_vl review fixes
    
    Assisted-by: Claude Opus 5.5

commit e4a0a81c229d9b5da9d40c431a082843eee4ae1f
Author: harthuang <[email protected]>
Date:   Fri Nov 20 02:42:14 2026 +0800

    model : restore hy_v4 VL support
    
    Read the M-RoPE sections of the HY4 VL text model again (IMROPE over NeoX ordered rope rows) and add back the hy_v4_vl mmproj projector.
    
    Assisted-by: Claude Opus 5.5

commit b47bda70775ae57b74fa7400813fd312bf9d36f2
Author: harthuang <[email protected]>
Date:   Thu Nov 19 14:54:42 2026 +0800

    conversion : read the hy_v4_flash Engram token map from the checkpoint
    
    The released Hy4-flash checkpoints name the architecture HYV4Flash*, call the sparse layers deepseek_sparse_attention, drop engram_enable and ship the Engram token map as a lookup_table tensor instead of engram_vocab_map.npz. Read the map from the tensor when it is there, keep the npz path for the checkpoints that carry it, and skip the dfly draft layers.
    
    Assisted-by: Claude Opus 5, GPT-6

commit a9d9367d55c67fac1f2ec2ee3f9bace4fda92396
Author: harthuang <[email protected]>
Date:   Thu Nov 19 12:07:55 2026 +0800

    model : hy_v4_flash review fixes
    
    Share the k-pool indexer code between llama_memory_hybrid_idx and llama_memory_idx_iswa via llama_kv_cache_kpool, drop the VL / mmproj changes and keep hy_v4 on NORM rope, trim comments.
    
    Assisted-by: Claude Opus 5.5

commit 3944f82d520236e0c683ea82d656f47388fbeef2
Author: harthuang <[email protected]>
Date:   Tue Nov 17 23:46:07 2026 +0800

    model : add hy_v4_flash support
    
    Add the hy_v4_flash architecture (hybrid sparse/sliding-window attention with a k-pool indexer, Engram embeddings, latent MoE and an MTP draft block), M-RoPE VL support for hy_v4, and the hy_v4_flash / hy_v4_vl mmproj projectors.
    
    Assisted-by: Claude Opus 5.5

commit 0b51bb2fed322bc884f96f98db340e2b0f6ea176 (origin/master, origin/HEAD)
Author: Xuan-Son Nguyen <[email protected]>
Date:   Sun Nov 22 17:52:56 2026 +0100
...

Published files carry no rope sections, so default them to the checkpoint's
[12, 10, 10, 0] and reorder the rope rows to NeoX in the graph. The weights
stay as published.

The vision tower is the hy_v4_vl one, so hy_v4_flash reuses its projector
code. Its encoder ffn uses the tanh gelu (bias_activation_fusion).

Assisted-by: Claude Opus 5
@Little0o0

Copy link
Copy Markdown
Contributor Author

Hi @ryant00000 and @EmilPi . The issue was caused by my forgetting to add the mmproj to Hy4-Flash. I’ve added them now, and it has no bug now!

@Little0o0

Copy link
Copy Markdown
Contributor Author

Very nice @Little0o0!

I've gone from 8t/s with the initial PR to 15t/s with this recent MTP commit... then combining "--spec-draft-n-max 4" with "--spec-draft-p-min 0.8", I'm hitting 19t/s!

Thanks for sharing the data point and recipes!

With M-RoPE a whole image shares one position, so pools of consecutive
positions never form for image cells and the forced tail resolves every
image token to the same cell. Group consecutive cells instead, as
qwen4exp does. Text is unaffected: its positions are consecutive.

Assisted-by: Claude Opus 5
@Little0o0

Copy link
Copy Markdown
Contributor Author

Hi @ngxson and @pwilkin, I’ve revised and reviewed the code with AI assistance, instructing it to follow Agent.md and address the issues raised by the community. We’d appreciate it if you could take another look and share any further suggestions.

@pwilkin

pwilkin commented Nov 23, 2026

Copy link
Copy Markdown
Member

/bot review

@ggml-gh-bot

ggml-gh-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Automated code review

Review of the delta since the last automated pass (commit 0a054d0b): the two new commits, c167c51 (restore VL support / M-RoPE for hy_v4_flash) and 6809f12 (group k-pools by cell order). Prior points 2, 3, 4, 6 and 9 are addressed and I verified the fixes; findings below focus on the new code plus what is still open.

Verified in the new commits (no action needed)

  • The NeoX reorder in hy_v4_flash_rope_to_neox is mathematically correct (interleaved pairs to first-half/second-half), and it is applied symmetrically to q and k, to the indexer query and to the pooled key, so q.k dot products and cache contents stay consistent.
  • The [t, h, w, t] position concat matches the IMROPE kernel layout (p_h = pos[i2+ne2] is ext.y, p_w is ext.x), and plane 3 = t is genuinely needed: with sections {12, 10, 10, 0}, the interleaved-sector scheme in ggml_mrope_cache_init sends sector 31 to the 4th position, and token-only ubatches carry 0 there. The new_pool_pos 4-plane fill in llama-kv-cache-kpool.cpp writes the same plane order.
  • KV-shift consistency: rope_type is now IMROPE, which build_rope_shift maps to NEOX ordering - matching the NeoX-reordered rows now stored in the cache. (Previously NORM + interleaved was also self-consistent; the change is coherent end to end.)
  • indexer_kpool_by_order = true is safe: kpool_rank resolves same-position cells (M-RoPE image tokens) by cell index, and the by-order branches in the shared k-pool code were already exercised by qwen4exp; setting it here also removes the prior "dead code in llama-memory-idx-iswa" concern.
  • All PROJECTOR_TYPE_HY_V4_VL switch sites gained the HY_V4_FLASH case, the name map and string parsing are wired (this fixes the "unknown projector type: hy_v4_flash" report), and the flash fixture's rope dim (64) matches the hardcoded default sections.
  • The overflow guard (prior point 6) and the Engram completeness check (prior point 9) are correctly fixed.

Will slow the review

(point 1) src/models/hy-v4-flash.cpp:69-78: the loader defaults rope_sections to the hardcoded checkpoint value {12, 10, 10, 0}, but the converter can never write sections for this arch - HYV4FlashModel inherits HYV4Model's strip of mrope_section (conversion/hy_v4.py:117-118). So the C++ magic number is the only source for every flash GGUF, present and future. If a later flash variant ships different rope dims or sections, conversion produces a GGUF that throws at load ("rope sections must sum to n_rot / 2") with no way to fix it from the converter. Since the flash graph does its own row reorder, writing rope.dimension_sections from the config is safe for this arch (unlike plain hy_v4) - consider emitting them in the flash text conversion and keeping the loader default only as the compatibility fallback for the already-published files.

(point 2) Still open from the previous review: the MTP draft block (graph_mtp, NEXTN_*) and the indexer-less fallback (indexer_top_k == 0) have no coverage in tests/test-llama-archs.cpp, and the hy_v4 IMROPE path (a HY_V4 fixture with nonzero sections) is still untested - the fixture deliberately writes zeros. The flash fixture does now exercise the new IMROPE + by-order paths implicitly, which is good.

Notes

(point 3) Switching hy_v4_flash to M-RoPE disables context shift: llama_kv_cache::get_can_shift() returns false when n_pos_per_embd() > 1, so text-only users who previously got KV-shift at full context will now hit "context full". This is the standard trade-off for all M-RoPE models (qwen-vl behaves the same), so nothing to change in code - but it is a user-visible behavior change worth stating in the PR description.

Nits

(point 4) The mrope branch in build_indexer_rope (src/models/hy-v4-flash.cpp:738-747) duplicates build_rope_impl's mrope branch almost line for line, and llm_graph_context::build_rope_indexer (src/llama-graph.cpp:1801) already wraps both branches plus the offset handling. If the explicit freq_base argument is the reason for hand-rolling, that is already covered by the existing comment, but consider whether build_rope_indexer + the reorder would do; also note the hand-rolled call passes nullptr factors while the helper would pass rp.factors.

(point 5) Carried over, not addressed: the position-embedding error under PROJECTOR_TYPE_HY_V4_VL/HY_V4_FLASH at tools/mtmd/mtmd-model.cpp:3929 still reads "hy_v4 requires a 2D F32 ..." - it should name the actual projector type, since the case now serves two of them.

(point 6) Carried over, not addressed: lookup_token_text_prefix (tools/mtmd/mtmd.cpp:1634) still silently returns "" when the marker token is missing; flash VL now also depends on it for img_beg/img_end, so a tokenizer-revision mismatch still fails quietly instead of warning.

Reminder on the previous review's point 1

The HY_V4 NORM->IMROPE flip still rests on the claim that no published text-only hy_v4 GGUF carries rope.dimension_sections; nothing in the delta changed that code. If that claim has been verified against the published files, this can be considered closed.

This review was generated automatically by pi coding agent using zai-org/GLM-5.3. It may contain mistakes. Maintainers make the final call.

… path

The conversion now writes rope.dimension_sections from the checkpoint, so a
variant with a different rope split no longer depends on the loader default.
The default stays as the fallback for the already published files.

Also warn when an image marker token is missing instead of silently dropping
it, name the projector type in the position-embedding error, and run the
arch test without an indexer.

Assisted-by: Claude Opus 5
@Little0o0

Little0o0 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author
Automated code review

Automated code review
Review of the delta since the last automated pass (commit 0a054d0b): the two new commits, c167c51 (restore VL support / M-RoPE for hy_v4_flash) and 6809f12 (group k-pools by cell order). Prior points 2, 3, 4, 6 and 9 are addressed and I verified the fixes; findings below focus on the new code plus what is still open.

Verified in the new commits (no action needed)

  • The NeoX reorder in hy_v4_flash_rope_to_neox is mathematically correct (interleaved pairs to first-half/second-half), and it is applied symmetrically to q and k, to the indexer query and to the pooled key, so q.k dot products and cache contents stay consistent.
  • The [t, h, w, t] position concat matches the IMROPE kernel layout (p_h = pos[i2+ne2] is ext.y, p_w is ext.x), and plane 3 = t is genuinely needed: with sections {12, 10, 10, 0}, the interleaved-sector scheme in ggml_mrope_cache_init sends sector 31 to the 4th position, and token-only ubatches carry 0 there. The new_pool_pos 4-plane fill in llama-kv-cache-kpool.cpp writes the same plane order.
  • KV-shift consistency: rope_type is now IMROPE, which build_rope_shift maps to NEOX ordering - matching the NeoX-reordered rows now stored in the cache. (Previously NORM + interleaved was also self-consistent; the change is coherent end to end.)
  • indexer_kpool_by_order = true is safe: kpool_rank resolves same-position cells (M-RoPE image tokens) by cell index, and the by-order branches in the shared k-pool code were already exercised by qwen4exp; setting it here also removes the prior "dead code in llama-memory-idx-iswa" concern.
  • All PROJECTOR_TYPE_HY_V4_VL switch sites gained the HY_V4_FLASH case, the name map and string parsing are wired (this fixes the "unknown projector type: hy_v4_flash" report), and the flash fixture's rope dim (64) matches the hardcoded default sections.
  • The overflow guard (prior point 6) and the Engram completeness check (prior point 9) are correctly fixed.

Will slow the review

(point 1) src/models/hy-v4-flash.cpp:69-78: the loader defaults rope_sections to the hardcoded checkpoint value {12, 10, 10, 0}, but the converter can never write sections for this arch - HYV4FlashModel inherits HYV4Model's strip of mrope_section (conversion/hy_v4.py:117-118). So the C++ magic number is the only source for every flash GGUF, present and future. If a later flash variant ships different rope dims or sections, conversion produces a GGUF that throws at load ("rope sections must sum to n_rot / 2") with no way to fix it from the converter. Since the flash graph does its own row reorder, writing rope.dimension_sections from the config is safe for this arch (unlike plain hy_v4) - consider emitting them in the flash text conversion and keeping the loader default only as the compatibility fallback for the already-published files.

(point 2) Still open from the previous review: the MTP draft block (graph_mtp, NEXTN_*) and the indexer-less fallback (indexer_top_k == 0) have no coverage in tests/test-llama-archs.cpp, and the hy_v4 IMROPE path (a HY_V4 fixture with nonzero sections) is still untested - the fixture deliberately writes zeros. The flash fixture does now exercise the new IMROPE + by-order paths implicitly, which is good.

Notes

(point 3) Switching hy_v4_flash to M-RoPE disables context shift: llama_kv_cache::get_can_shift() returns false when n_pos_per_embd() > 1, so text-only users who previously got KV-shift at full context will now hit "context full". This is the standard trade-off for all M-RoPE models (qwen-vl behaves the same), so nothing to change in code - but it is a user-visible behavior change worth stating in the PR description.

Nits

(point 4) The mrope branch in build_indexer_rope (src/models/hy-v4-flash.cpp:738-747) duplicates build_rope_impl's mrope branch almost line for line, and llm_graph_context::build_rope_indexer (src/llama-graph.cpp:1801) already wraps both branches plus the offset handling. If the explicit freq_base argument is the reason for hand-rolling, that is already covered by the existing comment, but consider whether build_rope_indexer + the reorder would do; also note the hand-rolled call passes nullptr factors while the helper would pass rp.factors.

(point 5) Carried over, not addressed: the position-embedding error under PROJECTOR_TYPE_HY_V4_VL/HY_V4_FLASH at tools/mtmd/mtmd-model.cpp:3929 still reads "hy_v4 requires a 2D F32 ..." - it should name the actual projector type, since the case now serves two of them.

(point 6) Carried over, not addressed: lookup_token_text_prefix (tools/mtmd/mtmd.cpp:1634) still silently returns "" when the marker token is missing; flash VL now also depends on it for img_beg/img_end, so a tokenizer-revision mismatch still fails quietly instead of warning.

Reminder on the previous review's point 1

The HY_V4 NORM->IMROPE flip still rests on the claim that no published text-only hy_v4 GGUF carries rope.dimension_sections; nothing in the delta changed that code. If that claim has been verified against the published files, this can be considered closed.

This review was generated automatically by pi coding agent using zai-org/GLM-5.3. It may contain mistakes. Maintainers make the final call.

Regarding the points mentioned above, I provide the following explanation as to how these points have been fixed or why they have not been fixed.

  • Point 1 (fixed): I fixed it by adding new _write_rope_sections() at conversion/hy_v4_flash.py:228, which reads mrope_section out of the nested dict. The default at src/models/hy-v4-flash.cpp:69 stays, with its comment changed to say it only keeps the already published files loadable.
  • Point 2 (partially fixed): (a) I fixed indexer-less fallback (top_k == 0) bytests/test-llama-archs.cpp:1500 replaces the config axis pair<bool,bool> with struct arch_config { moe; vl; no_indexer; } ; (b) hy_v4 IMROPE is already covered because tests/test-llama-archs.cpp:1522 overwrites the sections with {12, 10, 10, 0} under the vl config. (c) The test harness has no MTP support at all, since it may include a significant change in shared test infra, so I did not add coverage for it.
  • Point 3 (unfixed): without M-RoPE the image positions cannot be encoded correctly. This is the standard trade-off for every M-RoPE model in llama.cpp (qwen-vl behaves the same). I have add this into PR description.
  • Point 4 (unfixed) : get_rope_factors() always returns nullptr for flash. The GGUF has no rope_freqs tensor and no scaling config at all (only three rope keys: rope.dimension_count, rope.freq_base, rope.freq_base_swa), so rope_long / rope_short are never created. Passing nullptr by hand and passing rp.factors through the helper are equivalent for this model. The gain is deduplication only located on hy-v4-flash.cpp, and getting it wrong is a silent numerical error, so the risk is asymmetric and the current code stays.
  • point 5 (fixed):tools/mtmd/mtmd-model.cpp:3930 now uses PROJECTOR_TYPE_NAMES[model.proj_type] and names the real projector.
  • point 6 (fixed): tools/mtmd/mtmd.cpp:1645 adds a LOG_WRN.

@EmilPi

EmilPi commented Nov 23, 2026 •

Copy link
Copy Markdown

@Little0o0 Getting logs like this on image input after rebasing on master:

Nov 23 20:24:46 builder llama-server[3383006]: [39543] 57.24.179.221 I slot launch_slot_: id  0 | task 340 | processing task, is_child = 0
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.240 W decode: failed to find a memory slot for batch of size 2048
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.246 E failed to decode image
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.341 E slot   operator(): id  0 | task 340 | failed to decode mtmd chunk, idx = 23, res = 1
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.381 E slot   operator(): id  0 | task 340 | failed to process mtmd chunk, res = -1
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.384 E srv    send_error: task id = 340, error: failed to process mtmd chunk
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.388 I slot      release: id  0 | task 340 | stop processing: n_tokens = 23, truncated = 0
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.412 W srv          stop: cancel task, id_task = 340
Nov 23 20:25:54 builder llama-server[3383006]: [39543] 58.31.978.872 I slot       select: id  0 | task -1 | selected slot by LRU, n_tokens = 23, t_last = 2281574488365
Nov 23 20:25:54 builder llama-server[3383006]: [39543] 58.31.979.501 I slot launch_slot_: id  0 | task 345 | processing task, is_child = 0
Nov 23 20:43:40 builder llama-server[3403406]: [43373] 0.00.550.931 I srv    load_model: loading model 'AngelSlim/Hy4-flash-GGUF:Q3_K'
Nov 23 20:43:40 builder llama-server[3403406]: [43373] 0.00.985.342 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
Nov 23 20:44:43 builder llama-server[3403406]: 1.08.796.785 I srv  ensure_model: waiting until model name=Hy4-Flash-Q3 is fully loaded...
Nov 23 20:45:20 builder llama-server[3403406]: [43373] 1.41.054.060 I cmn          init: llama threadpool init, n_threads = 16
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.42.649.939 I srv    load_model: loaded multimodal model, '/home/ai/.cache/huggingface/hub/models--AngelSlim--Hy4-flash-GGUF/snapshots/b85056a1a1eacae21317df7481d3c0f06912ae02/mmproj-Hy4-flash-bf16.gguf'
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.42.988.485 I srv    load_model: initializing, n_slots = 1, n_ctx_slot = 131072, kv_unified = 'false'
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.004.834 I srv  server_run_i: model loaded
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.005.152 I srv  server_on_li: listening on http://127.0.0.1:43373
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.005.386 I srv    operator(): child server monitoring thread started, waiting for EOF on stdin...
Nov 23 20:45:23 builder llama-server[3403406]: [43373] 1.43.463.078 I slot       select: id  0 | task -1 | selected slot by LRU, n_tokens = 0, t_last = -1
Nov 23 20:45:23 builder llama-server[3403406]: [43373] 1.43.463.834 I slot launch_slot_: id  0 | task 0 | processing task, is_child = 0
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.427.476 W decode: failed to find a memory slot for batch of size 2048
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.427.484 E failed to decode image
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.896 E slot   operator(): id  0 | task 0 | failed to decode mtmd chunk, idx = 19, res = 1
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.970 E slot   operator(): id  0 | task 0 | failed to process mtmd chunk, res = -1
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.973 E srv    send_error: task id = 0, error: failed to process mtmd chunk
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.995 I slot      release: id  0 | task 0 | stop processing: n_tokens = 19, truncated = 0
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.430.018 W srv          stop: cancel task, id_task = 0

Other models handle same image fine. Config:

[Hy4-Flash-Q3]
hf = AngelSlim/Hy4-flash-GGUF:Q3_K
ctx-size = 131072
ctk = q8_0
ctv = q8_0
no-mmproj-offload = true
fit = off
cmoe = true
moe-cache-mib = 33768
load-mode = none
spec-draft-n-max = 4
spec-draft-p-min = 0.8

Short git log:

$ git log --oneline --decorate | head -n20
367eba8bc (HEAD -> hy4-flash) model : hy_v4_flash : group k-pools by cell order
a282a3d3d model : hy_v4_flash : restore VL support
5fd97ddfe model : hy_v4_flash : fix conflicts after rebase
3fbbdca43 mtmd : hy_v4_vl review fixes
102ffb147 model : restore hy_v4 VL support
786cc1f32 conversion : read the hy_v4_flash Engram token map from the checkpoint
7f9f93644 model : hy_v4_flash review fixes
0fdedacce model : add hy_v4_flash support
239242322 (origin/master, origin/HEAD, master) ggml: compact bias on the existing FLASH_ATTN_EXT (#32740)

@Little0o0

Copy link
Copy Markdown
Contributor Author
quoted reply

@Little0o0 Getting logs like this on image input after rebasing on master:

Nov 23 20:24:46 builder llama-server[3383006]: [39543] 57.24.179.221 I slot launch_slot_: id  0 | task 340 | processing task, is_child = 0
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.240 W decode: failed to find a memory slot for batch of size 2048
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.246 E failed to decode image
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.341 E slot   operator(): id  0 | task 340 | failed to decode mtmd chunk, idx = 23, res = 1
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.381 E slot   operator(): id  0 | task 340 | failed to process mtmd chunk, res = -1
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.384 E srv    send_error: task id = 340, error: failed to process mtmd chunk
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.388 I slot      release: id  0 | task 340 | stop processing: n_tokens = 23, truncated = 0
Nov 23 20:25:37 builder llama-server[3383006]: [39543] 58.15.275.412 W srv          stop: cancel task, id_task = 340
Nov 23 20:25:54 builder llama-server[3383006]: [39543] 58.31.978.872 I slot       select: id  0 | task -1 | selected slot by LRU, n_tokens = 23, t_last = 2281574488365
Nov 23 20:25:54 builder llama-server[3383006]: [39543] 58.31.979.501 I slot launch_slot_: id  0 | task 345 | processing task, is_child = 0
Nov 23 20:43:40 builder llama-server[3403406]: [43373] 0.00.550.931 I srv    load_model: loading model 'AngelSlim/Hy4-flash-GGUF:Q3_K'
Nov 23 20:43:40 builder llama-server[3403406]: [43373] 0.00.985.342 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
Nov 23 20:44:43 builder llama-server[3403406]: 1.08.796.785 I srv  ensure_model: waiting until model name=Hy4-Flash-Q3 is fully loaded...
Nov 23 20:45:20 builder llama-server[3403406]: [43373] 1.41.054.060 I cmn          init: llama threadpool init, n_threads = 16
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.42.649.939 I srv    load_model: loaded multimodal model, '/home/ai/.cache/huggingface/hub/models--AngelSlim--Hy4-flash-GGUF/snapshots/b85056a1a1eacae21317df7481d3c0f06912ae02/mmproj-Hy4-flash-bf16.gguf'
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.42.988.485 I srv    load_model: initializing, n_slots = 1, n_ctx_slot = 131072, kv_unified = 'false'
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.004.834 I srv  server_run_i: model loaded
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.005.152 I srv  server_on_li: listening on http://127.0.0.1:43373
Nov 23 20:45:22 builder llama-server[3403406]: [43373] 1.43.005.386 I srv    operator(): child server monitoring thread started, waiting for EOF on stdin...
Nov 23 20:45:23 builder llama-server[3403406]: [43373] 1.43.463.078 I slot       select: id  0 | task -1 | selected slot by LRU, n_tokens = 0, t_last = -1
Nov 23 20:45:23 builder llama-server[3403406]: [43373] 1.43.463.834 I slot launch_slot_: id  0 | task 0 | processing task, is_child = 0
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.427.476 W decode: failed to find a memory slot for batch of size 2048
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.427.484 E failed to decode image
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.896 E slot   operator(): id  0 | task 0 | failed to decode mtmd chunk, idx = 19, res = 1
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.970 E slot   operator(): id  0 | task 0 | failed to process mtmd chunk, res = -1
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.973 E srv    send_error: task id = 0, error: failed to process mtmd chunk
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.429.995 I slot      release: id  0 | task 0 | stop processing: n_tokens = 19, truncated = 0
Nov 23 20:46:20 builder llama-server[3403406]: [43373] 2.40.430.018 W srv          stop: cancel task, id_task = 0

Other models handle same image fine. Config:

[Hy4-Flash-Q3]
hf = AngelSlim/Hy4-flash-GGUF:Q3_K
ctx-size = 131072
ctk = q8_0
ctv = q8_0
no-mmproj-offload = true
fit = off
cmoe = true
moe-cache-mib = 33768
load-mode = none
spec-draft-n-max = 4
spec-draft-p-min = 0.8
Short git log:

$ git log --oneline --decorate | head -n20
367eba8bc (HEAD -> hy4-flash) model : hy_v4_flash : group k-pools by cell order
a282a3d3d model : hy_v4_flash : restore VL support
5fd97ddfe model : hy_v4_flash : fix conflicts after rebase
3fbbdca43 mtmd : hy_v4_vl review fixes
102ffb147 model : restore hy_v4 VL support
786cc1f32 conversion : read the hy_v4_flash Engram token map from the checkpoint
7f9f93644 model : hy_v4_flash review fixes
0fdedacce model : add hy_v4_flash support
239242322 (origin/master, origin/HEAD, master) ggml: compact bias on the existing FLASH_ATTN_EXT (#32740)

@EmilPi The Hy4-flash image decode failure above because its sliding-window KV cache must hold the whole image at once, and the server does not cap image size for this causal model so it returns a 500 instead of a clear error. The minimum values needed for the -b/-ub should be image tokens + 512. So it can use -ub 4096 -b 4096 to fix this error. I also added the clear error infromation in the commit.

An image is decoded as one batch whose positions share one M-RoPE value,
so sliding-window masking never frees its cells. The whole image must fit
in the sliding-window cache, which is sized from -b and -ub. When an image
fails to decode on such a model, print the image token count and the
minimum -b and -ub that fit it.

Assisted-by: Claude Opus 5
@EmilPi

EmilPi commented Nov 24, 2026

Copy link
Copy Markdown

This is for the 3840x2160 image with ub/b = 3072:

Nov 24 10:43:21 builder llama-server[3529180]: [42605] 3.23.929.928 E failed to decode image
Nov 24 10:43:21 builder llama-server[3529180]: [42605] 3.23.929.937 E the image has 4128 tokens, but -b is 3072 and -ub is 3072. with sliding-window attention the batch and ubatch must each cover the image, use -b and -ub of at least 4640

Did I understand right this is an architectural constraint, and text tokens do not count into ub/b >= (image tokens) + 512?

@Little0o0

Copy link
Copy Markdown
Contributor Author

@EmilPi Yes. There is a constraint that min(-b, -ub) >= image_tokens + n_swa . The image' own requirement does not depend on text.

Comment thread tools/mtmd/mtmd.cpp Outdated
Comment on lines +1633 to +1634
// returns the full text of the first token starting with prefix, for marker tokens that embed a per-revision tokenizer hash (hy-v4)
std::string lookup_token_text_prefix(const std::string & prefix) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is needed, are we doing backward compatibility or something?

why can't we support only the latest version of tokenizer, what's the pre-revision?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I move these codes into tools/mtmd/models/hy-v4.cpp. Now it will not disturb the common code. These codes are used for backward compatibility for the official released gguf on https://huggingface.co/AngelSlim/Hy4-flash-GGUF .

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's recommended to just reconvert the gguf, it's more simple to do than having a compat code in here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we decide to merge #32960 instead because it's less changes to the code base

please reach out to https://huggingface.co/AngelSlim so they can update the gguf with the merged version

Comment thread tools/mtmd/mtmd-helper.cpp Outdated
Comment on lines 172 to 178
if (chunk_type == MTMD_INPUT_CHUNK_TYPE_IMAGE && llama_model_n_swa(llama_get_model(lctx)) > 0) {
// the whole image must stay in the sliding-window cache until it is decoded, see docs
LOG_ERR("the image has %d tokens, but -b is %d and -ub is %d. with sliding-window attention "
"the batch and ubatch must each cover the image, use -b and -ub of at least %d\n",
n_tokens, n_batch, llama_n_ubatch(lctx), n_tokens + 512);
}
return ret;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this, it's never been tested to make sure it's not break other models

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have remove them on the latest commit.

@ServeurpersoCom

Copy link
Copy Markdown
Contributor

I opened #32960 as a smaller alternative to this one that leaves the memory API untouched: no new KV cache type and no change to llama-memory-hybrid-idx. It runs hy_v4_flash on the existing llama_kv_cache_dsa_iswa like dots3note, and rebuilds the indexer pools from the cache cells at each ubatch instead of keeping a pooled state.

MTP and the VL path are not in #32960, they could come on top of it once the base is in.

@EmilPi

EmilPi commented Nov 26, 2026

Copy link
Copy Markdown

Again there are conflicts with master...
Hope this is merged soon, because it is impossible to use Inkling-2-Mini with all performance improvements and Hy4-Flash simultaneously now.

@ngxson

ngxson commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

support is already added in #32960

closing this for now

@ngxson ngxson closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion model Model specific mtmd Related to multimodal functionality (video/image/audio) testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants