Elffuss BraidHub

kikocis/coco public

ef0750d7e4e7 · 5.2 KiBSourceRawPermalink

coco — an architecture-agnostic LLM engine in Rust

coco

An architecture-agnostic LLM inference + quantization engine, in Rust. Built on candle + Metal.

License Rust GPU tests status

Website How it works Blog

One engine, not one-file-per-architecture. Every model reduces to a config row plus a single pluggable per-layer seam — so supporting a new architecture is an afternoon, not a rewrite.

Status: early but real. Builds clean, cargo test is green (12/12), and the headline pieces are validated against oracles. It is honest about what it can't do yet (see Limitations). This is a working research engine, not a drop-in llama.cpp replacement.


What works today

Validated (reproducible)

Limitations (honest)

Quick start

cargo build --release
# run generation (point --model at a HF model dir with config.json, tokenizer.json, *.safetensors)
cargo run --release --bin coco -- --model ./model --prompt "The capital of France is"
# validate the GatedDeltaNet port against its oracle
cargo run --release --bin gdn_ref
cargo test --release

Layout

filewhat
src/config.rsarch registry + config parsing (ARCH_REGISTRY, resolve_arch, build_model dispatch)
src/model.rsDenseDecoder, DecoderLayer, the SequenceMixer trait + its 3 impls, MoeFfn
src/turboquant.rsthe data-free quantizer (rotation + codebook + radius)
src/qlinear.rsfused Metal kernels (quantized matvec, flash-decode, rmsnorm)
src/eval.rs / src/merge.rseval harness + evolutionary merge
tests/fixtures/golden oracles for validation

The story

The design decisions here are written up, for humans, at bitacora.utopiaia.com — the SequenceMixer seam, oracle-first validation, turboquant, the bandwidth thesis, and an honest engineering war story about a GPU kernel that came out 20× slower.

License

Apache-2.0. See LICENSE.