Skip to content
zapabobPublic
forked from ggml-org/llama.cpp

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

10,886 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llama.cpp

llama

zapabob fork: SO8TriarityTurboQuant in 30 seconds

This fork is a research-grade llama.cpp branch for testing whether long-context KV cache memory can be cut on consumer NVIDIA GPUs without treating quantization as a reconstruction-only problem. The custom path combines TurboQuant KV-cache compression with an SO(8) Triality-inspired K-side protection layer, exposed as key_only_block_so8_triality_vector, while preserving current upstream llama.cpp server/API behavior.

The current public runtime, GGUF schema-v2, four execution modes, parity-coupled residual storage, availability limits, and measured standard sm_120 CUDA evidence are documented in TurboQuant Triality runtime contract.

For a recruiter or engineering reviewer: the interesting work is not another low-bit quantizer, but the validation loop around it. K is protected through the SO(8) vector view, V is compressed with the smallest passing TurboQuant tier, and the result is selected by ablation statistics rather than by visual inspection or a single happy-path prompt.

K-side SO8 Triality orthogonality error with error bars

V-side TurboQuant quality versus memory with error bars

Ablation result

The current operating profile is triality_vector_v_turbo3: public K cache type triality-vector, llama.cpp K entry point q8_0, public V cache type turbo3, and TURBO_LAYER_ADAPTIVE=7. On the synthetic ablation set, 3-bit protected V was the smallest tier that passed the hidden-state quality threshold: hidden cosine similarity mean 0.988765 with 95% CI [0.988445, 0.989086], attention-output relative error mean 0.149698 with 95% CI [0.147634, 0.151763], and exact-KV memory ratio 0.178223.

Question Result
Why not 2-bit V? Lower memory ratio (0.148926) but hidden cosine mean only 0.961259, below the production selection threshold used for this run.
Why not 4-bit V? Better hidden cosine mean (0.996829) and lower attention error (0.079607), but larger memory ratio (0.207520) than the selected 3-bit tier.
Does SO8 K protection stay numerically controlled? The vector K audit passed at the selected tier: mean effective orthogonality error 0.003113, max effective orthogonality error 0.004870, and mean determinant error 0.001814.
How was significance checked? Paired Wilcoxon signed-rank tests over n=9 trials with Holm correction. At 3-bit V, candidate-minus-protected deltas showed SO8-MSE block V was worse on attention error by +0.034621 absolute relative-error units (p_holm=0.01953125), and product-based SO8 V was worse by +0.271150 (p_holm=0.01953125).

Reproduction artifacts live under docs/research/so8-triarity-turboquant/metrics. This fork intentionally keeps exact-score evaluation, estimated-score evaluation, reconstruction metrics, and attention/logit-facing metrics separate so that future upstream merges do not collapse the method into a plain MSE quantizer.

Recent API changes

Hot topics

zapabob fork: related repositories

Repository Role
zapabob/multiscreen-pytorch PyTorch reference implementation of the Multiscreen architecture. KV window size (s_w) can be embedded as GGUF metadata for windowed KV cache experiments.
zapabob/Turboquant-CUDA KV cache quantization research and Triality SO(8) rotation work used before GGUF conversion.
zapabob/Hypura GPU/RAM/NVMe tiered inference scheduler that consumes GGUF artifacts produced by this fork.

Quick start

A few options to get llama.cpp installed on your machine:

Once installed:

# Download and run a model directly from Hugging Face
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF

# Launch OpenAI-compatible API server
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF
VLM session with `llama cli` VLM session with llama cli Built-in web UI against `llama serve` running Qwen 3.6 Built-in web UI against llama serve

Description

The main goal of llama.cpp is to enable LLM (and VLM) inference with minimal setup and state-of-the-art performance on a wide range of hardware - locally and in the cloud.

  • Plain C/C++ implementation without any dependencies
  • Apple silicon is a first-class citizen - optimized via ARM NEON, Accelerate and Metal frameworks
  • AVX, AVX2, AVX512 and AMX support for x86 architectures
  • RVV, ZVFH, ZFH, ZICBOP and ZIHINTPAUSE support for RISC-V architectures
  • 1.5-bit, 2-bit, 3-bit, 4-bit, 5-bit, 6-bit, and 8-bit integer quantization for faster inference and reduced memory use
  • Custom CUDA kernels for running LLMs on NVIDIA GPUs (support for AMD GPUs via HIP and Moore Threads GPUs via MUSA)
  • Vulkan and SYCL backend support
  • CPU+GPU hybrid inference to partially accelerate models larger than the total VRAM capacity

The llama.cpp project is build on top of the ggml library.

Supported backends

Backend Target devices
BLAS All
BLIS All
CANN Ascend NPU
CUDA Nvidia GPU
HIP AMD GPU
Hexagon [In Progress] Snapdragon
IBM zDNN IBM Z & LinuxONE
MUSA Moore Threads GPU
Metal Apple Silicon
OpenCL Adreno GPU
OpenVINO [In Progress] Intel CPUs, GPUs, and NPUs
RPC All
SYCL Intel GPU
VirtGPU VirtGPU APIR
Vulkan GPU
WebGPU All
ZenDNN AMD CPU

Documentation

Tools

Development

Contributing

  • Contributors can open PRs
  • Collaborators will be invited based on contributions
  • Maintainers can push to branches in the llama.cpp repo and merge PRs into the master branch
  • Any help with managing issues, PRs and projects is very appreciated!
  • Read the CONTRIBUTING.md for more information

XCFramework

The XCFramework is a precompiled version of the library for iOS, visionOS, tvOS, and macOS. It can be used in Swift projects without the need to compile the library from source. For example:

// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "MyLlamaPackage",
    targets: [
        .executableTarget(
            name: "MyLlamaPackage",
            dependencies: [
                "LlamaFramework"
            ]),
        .binaryTarget(
            name: "LlamaFramework",
            url: "https://github.com/ggml-org/llama.cpp/releases/download/b5046/llama-b5046-xcframework.zip",
            checksum: "c19be78b5f00d8d29a25da41042cb7afa094cbf6280a225abe614b03b20029ab"
        )
    ]
)

The above example is using an intermediate build b5046 of the library. This can be modified to use a different version by changing the URL and checksum.

Completions

Command-line completion is available for some environments.

Bash Completion

$ build/bin/llama-cli --completion-bash > ~/.llama-completion.bash
$ source ~/.llama-completion.bash

Optionally this can be added to your .bashrc or .bash_profile to load it automatically. For example:

$ echo "source ~/.llama-completion.bash" >> ~/.bashrc

TurboQuant support (fork status)

This fork includes TurboQuant-related integration for CUDA-based GGUF workflows.

What is included

  • TurboQuant conversion and runtime wiring for GGUF workflows
  • CUDA path/tooling integration for local inference
  • Compatibility checks for existing llama-cli and llama-server usage

Scope and notes

  • This is a fork-specific extension and may differ from upstream ggml-org/llama.cpp.
  • Behavior can vary by GPU architecture, driver, CUDA toolkit, and model quantization.

Measured results (local environment)

Test environment

  • OS: Windows 11
  • GPU: NVIDIA GeForce RTX 3060 (12 GB VRAM)
  • CUDA: 13.2
  • Build: b8483-abe37ec28
  • Model: Qwen3.5-9B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf (Q4_K_M, ~5.23 GiB)

Runtime settings

llama-cli -m "%USERPROFILE%\Desktop\EasyNovelAssistant\EasyNovelAssistant\KoboldCpp\Qwen3.5-9B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf" -ngl 99 -c 8192 -i

Dependencies

Acknowledgements

  • yhirose/cpp-httplib - Single-header HTTP server, used by llama-server - MIT license
  • nothings/stb - Single-header image format decoder, used by multimodal subsystem - Public domain
  • nlohmann/json - Single-header JSON library, used by various tools/examples - MIT License
  • mackron/miniaudio - Single-header audio format decoder, used by multimodal subsystem - Public domain
  • sheredom/subprocess.h - Single-header process launching solution for C and C++ - Public domain

About

LLM inference in C/C++

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages