Downloads · 30 days
285
9% of all-time downloads
vincespeed/K2-Horizon-MoVA-36B-A4B-APEX-GGUF
K2-Horizon-MoVA-36B-A4B-APEX-GGUF is a text generation model from vincespeed. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
🛑 READ BEFORE YOU RUN THIS MODEL The "Use this model" quick-start buttons above (llama serve -hf ..., winget, Docker, Ollama, etc.) point to vanilla/upstream llama.cpp. They will NOT work correctly with these files.…
Downloads · 30 days
285
9% of all-time downloads
All-time downloads
3.1K
Public
Repo size
72.7 GB
Likes
4
Trending 1
Click a slice to open those files.
.gguf72.7 GB · 100%
From the Hugging Face model README
🛑 READ BEFORE YOU RUN THIS MODEL
The "Use this model" quick-start buttons above (llama serve -hf ..., winget, Docker, Ollama, etc.) point to vanilla/upstream llama.cpp. They will NOT work correctly with these files.
Upstream llama.cpp has no support for the
k2-horizonarchitecture yet, and even the community fork that adds support has two known bugs. If you use the auto-generated buttons above, you will get one of:
- a load failure (
Failed to process regex ... regex_error) on Windows, or- garbage/repeated output (
> > > ...) on any OS.You must build the patched fork described in Building the Runtime below. There is currently no other correct way to run this GGUF with llama.cpp.
This repository contains 3 quantized GGUF profiles of the K2-Horizon-MoVA-36B-A4B model, produced using Apex-Quant technology.
| Profile | Size | BPW | Use Case |
|---|---|---|---|
| i-quality | 23.8 GB | 5.47 | Highest quality, production environments |
| i-balanced | 26.2 GB | 6.02 | Maximum expert precision (densest expert quant) |
| i-compact | 17.6 GB | 4.04 | Compact deployment, low VRAM/RAM |
BPW = Bits Per Weight. Higher value = better quality.
Note: unlike most model families, here i-balanced is larger than i-quality — it keeps all routed experts at Q5_K or higher, while i-quality compresses mid-layer experts to IQ4_XS. Choose based on your memory budget vs. precision preference.
models/
├── K2-Horizon-36B-i-quality.gguf # 23.8 GB — highest quality
├── K2-Horizon-36B-i-balanced.gguf # 26.2 GB — max expert precision
└── K2-Horizon-36B-i-compact.gguf # 17.6 GB — compact
These models were created based on the K2-Horizon-MoVA-36B-A4B model.
K2HorizonForCausalLM)These quantized models were produced using Apex-Quant technology.
llama-quantize, --tensor-type-file)apex-quant/scripts/generate_config.sh --profile <profile> --layers 48The K2-Horizon support fork (MBZUAI-IFM/llama.cpp) provides the base K2-Horizon support. On top of the pinned commit below, two fixes are required for reliable operation (both verified empirically in our test setup):
| # | Issue | Observed Symptom | Fix |
|---|---|---|---|
| 1 | Tokenizer pre-regex contains \u200C/\u200D escapes unsupported by MSVC std::regex | Model fails to load on Windows: Failed to process regex ... regex_error(error_escape) | Remove the \u200C|\u200D alternation from the K2_HORIZON pre-tokenization regex |
| 2 | Decoder residual/norm wiring diverged from the vLLM reference behavior | Model loads fine but generates garbage/repeated tokens (> > > ...), possible crashes during graph reservation | Rewrite residual flow in k2-horizon.cpp forward pass following vLLM semantics (see note below) |
Both fixes are provided as ready-to-apply patches below.
# 1. Clone the official K2-Horizon fork and pin the exact commit these models were validated against
git clone https://github.com/MBZUAI-IFM/llama.cpp llama-cpp-k2horizon
cd llama-cpp-k2horizon
git checkout 35999d101cf2233fc54f09c3c8d599da7303ce02
# 2. Apply the two patches (from this repo's patches/ directory)
git apply /path/to/patches/0001-fix-k2-horizon-msvc-regex.patch
git apply /path/to/patches/0002-fix-k2-horizon-parallel-norm.patch
src/llama-vocab.cpp)MSVC's std::regex rejects \uXXXX escape sequences, so loading any K2-Horizon model crashes on Windows before inference even starts. The zero-width joiner/non-joiner alternatives are irrelevant for BPE pre-tokenization quality and are removed:
case LLAMA_VOCAB_PRE_TYPE_K2_HORIZON:
regex_exprs = {
- "...(?:\\p{L}|\\p{M}|\\u200C|\\u200D)+...",
+ "...(?:\\p{L}|\\p{M})+...",
};
(Full, exact diff: patches/0001-fix-k2-horizon-msvc-regex.patch)
src/models/k2-horizon.cpp)This patch rewires the decoder residual path to follow the vLLM reference semantics (K2HorizonRMSNorm.forward(x, residual)), where the running sum of sublayer outputs is tracked across layers and folded in before normalization.
Status note: With this patch applied, the repeated-token (
> > >) failure mode and the graph-reservation crash disappeared and generation became coherent. The exact causal mechanism has not been independently verified against the upstream weights — treat this patch as a validated fix rather than a proven diagnosis.
The new residual flow tracks an accumulated residual tensor across layers:
ggml_tensor * residual = nullptr; // outside the layer loop
for (int il = 0; il < n_layer; ++il) {
// --- parallel norm BEFORE attention ---
if (il == 0) {
residual = inpL; // layer 0: residual = embedding
cur = group_rms_norm(inpL, attn_norm);
} else {
cur = ggml_add(ctx0, inpL, residual); // prev MLP out + accumulated sum
residual = cur;
cur = group_rms_norm(cur, attn_norm);
}
/* ...attention... */
// --- parallel norm BEFORE FFN ---
cur = ggml_add(ctx0, cur, residual); // attn out + accumulated sum
residual = cur;
cur = group_rms_norm(cur, ffn_norm);
/* ...MoE FFN... */
cur = build_cvec(cur, il);
inpL = cur; // NO residual add here (deferred)
}
// final layer: fold last MLP output into the accumulated sum, then normalize
cur = ggml_add(ctx0, inpL, residual);
cur = group_rms_norm(cur, output_norm);
(Full, exact diff: patches/0002-fix-k2-horizon-parallel-norm.patch)
Windows (Visual Studio 2022 + CUDA):
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DLLAMA_CUDA=ON
cmake --build build --config Release
Linux (GCC/Clang + CUDA):
cmake -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_CUDA=ON
cmake --build build --config Release -j$(nproc)
CPU-only builds work too (drop -DLLAMA_CUDA=ON).
./build/bin/Release/llama-cli -m K2-Horizon-36B-i-compact.gguf -n 30 --temp 0.7 --top-p 0.9 -p "Merhaba dünya"
✅ Working: coherent natural-language answer (~27–45 tok/s decode with full CUDA offload).
❌ Broken: repeated > or command-line echo → one of the patches was not applied, or you are running an unpatched (vanilla/upstream) llama.cpp build.
k2-horizonLayer bands (48 layers): EDGE = L0–4 & L43–47 · NEAR = L5–9 & L38–42 · MID = L10–37
⚠️ Both examples below assume you already built the patched fork from the section above. Running these commands against a stock
llama-cli/llama-serverbuild (including the one installed via the "Use this model" buttons at the top of this page) will not work.
# Interactive chat
./build/bin/Release/llama-cli -m models/K2-Horizon-36B-i-quality.gguf \
-n 256 --temp 0.7 --top-p 0.9 -p "Hello, how are you?"
# Single-shot completion
./build/bin/Release/llama-completion -m models/K2-Horizon-36B-i-compact.gguf \
-n 128 -p "Explain mixture-of-experts models:"
Build llama-cpp-python against the same patched source tree (see above), e.g.:
CMAKE_BUILD_ARGS="-DLLAMA_CURL=OFF" pip install llama-cpp-python \
--global-option=build_ext \
--global-option="--library_dir=$(pwd)/build/lib" \
--global-option="--include_dir=$(pwd)/include"
from llama_cpp import Llama
llm = Llama(
model_path="models/K2-Horizon-36B-i-quality.gguf",
n_ctx=8192,
n_threads=8,
)
output = llm("Hello, how are you?", max_tokens=256)
print(output["choices"][0]["text"])
| Criterion | i-quality | i-balanced | i-compact |
|---|---|---|---|
| Quality | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
| Speed | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| RAM/VRAM | High | Highest | Low |
| Size | 23.8 GB | 26.2 GB | 17.6 GB |
| BPW | 5.47 | 6.02 | 4.04 |
⚠️ Please review the original model's license/terms before commercial use. The GGUF files are repackaged quantizations of the upstream weights.