ggml : add ggml_conv_1d_grouped#22833
Open
Juste-Leo2 wants to merge 1 commit into
Open
Conversation
kmbandy
added a commit
to kmbandy/llama.cpp
that referenced
this pull request
May 17, 2026
Ports PR ggml-org#22833 and PR ggml-org#23112 from ggml-org/llama.cpp onto our fork. - ggml: add ggml_conv_1d_grouped op (depthwise + headwise conv via ggml_view_3d slicing, falls back to existing conv1d/dw for groups=1 and groups=IC) - gguf: register ZAYA arch, CCA_VAL_PROJ1/2, CCA_CONV_GRP, CCA_K_SCALE, RES_SCALE_HS/RES/FINAL, ZAYA_ROUTER_MLP2/4/BIASES/EDA_SCALE tensors - src: add llama_model_zaya with alternating CCA (even) and MoE (odd) layers; residual scaling at every layer and final norm - conversion/zaya.py: HF→GGUF converter for ZayaModel/ZayaForCausalLM - Includes ggml_cont fixes for ROCm non-contiguous tensor compatibility and F16 cast fixes for CPU backend (from Zyphra fork review) Markovian RSA (test-time compute method) is intentionally excluded and will be a separate implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds the
ggml_conv_1d_groupedoperation (sub-graph) to be used in supporting CCA (Compressed Convolutional Attention) for future support of Zyphra's models (ZAYA1).(This is a first step towards #22776)
CCA uses a specific convolution system that doesn't seem to be currently implemented in
llama.cpp.Figure 1: Architecture of Compressed Convolutional Attention (CCA), extracted from the ZAYA1 technical report (arXiv:2605.05365).
Here, the added operation amounts to supporting Depthwise Conv and Headwise Conv.
To explain how it works, I made a diagram with matplotlib:
Figure 2: Functioning of the Grouped 1D Convolution operation (example with Groups = 2).
For example, when the group is equal to 2, we have an initial splitting of the tensors with separate convolutions. Then comes a concatenation to get the final tensor back.
Additional information
The code contains a small trick: the idea is to use
ggml_view_3dto avoid making lots of memory copies. I took care to keep the code modifications to a minimum to make the review easier.Here are the results obtained for the tests:
Note: I will do my best to answer questions regarding the implementation. Currently, it uses existing
llama.cppoperations, which I think is best for maintainability at the start.Requirements