Skip to main content

Crate cortiq_engine

Crate cortiq_engine 

Source
Expand description

Cortiq inference engine — sparse forward pass, attention, tokenization, sampling.

Re-exports§

pub use nystrom::NystromState;
pub use pipeline::GenerateResult;
pub use pipeline::Pipeline;
pub use pipeline::TokenCallback;
pub use pipeline::TokenTrace;
pub use runtime::CortiqRuntime;
pub use sampler::SamplerConfig;

Modules§

attention
Attention forward pass — GQA with RoPE, head masking, head-major KV.
fcd
FCD polish trainer — native Rust quality-polish for O(1)-converted models (docs/RUST_FCD.md). Removes the last Python dependency from the cortiq convert --o1 pipeline.
fcd_ops
FCD polish — hand-rolled forward/backward operators.
gptq_capture
Calibration-time Hessian capture for GPTQ / the holographic transfer.
gpu
Facade for GPU backends: a single call entry point for qtensor/pipeline/ linear_core. Job types and the threshold are canonical HERE; behind the facade dispatch goes to a platform backend:
inference
CPU forward-pass primitives: RMS-norm, SiLU, sparse SwiGLU FFN.
kv_cache
KV cache — per-layer, head-major storage.
linear_core
Linear-attention cores, selected by arch.linear_core.kind (descriptor-driven operators — Patent 15 claim 8).
loader
Weight loader: CMF tensor directory → Pipeline.
nystrom
Nyström (landmark) attention kernel — streaming per-GQA-group runtime for long-context attn_type: nystrom layers.
pipeline
Full inference pipeline: tokenize → embed → layers → lm_head → sample → decode.
pool
Persistent worker pool for row-parallel matvecs.
qtensor
QTensor — weight tensor with pluggable storage.
router
Recon-argmin skill routing (spec §9, P1 signal-consistency): the container’s selection descriptors define per-skill affine subspaces over φ(x); the winner is the skill that reconstructs φ best. No trained gate — routing is a property of the skills themselves.
runtime
Runtime state management — model, active task, metrics.
sampler
Token sampling — temperature, top-p, top-k, min-p, repetition penalty.
skillbake
Native DTG-MA skill bake (Patent 2) — no Python, no torch.
swarm
Dynamic per-token skill routing with hysteresis (spec §9 made runtime; VMF-2026 experiment №2).
tokenizer
Byte-level BPE tokenizer — HF tokenizer.json parity.