ternlang_compress/lib.rs
1// SPDX-License-Identifier: LicenseRef-Ternlang-Commercial
2// ternlang-compress — LLM-to-ternary compression pipeline
3// Copyright (C) 2026 RFI-IRFOS. All rights reserved.
4//
5// Pipeline:
6// Float model (GGUF / safetensors)
7// → per-layer ternary quantization (PTQ)
8// → sparse zero-index construction (CSR)
9// → .tern export (TernModel on-disk format)
10//
11// The resulting model is loaded by ternlang-ml's sparse_matmul kernel,
12// which skips all zero-weight positions at inference time.
13
14pub mod quantize;
15pub mod sparse;
16pub mod model;
17pub mod pipeline;
18pub mod format;
19
20pub use model::{TernModel, TernLayer};
21pub use pipeline::{compress, CompressConfig};
22pub use quantize::PerLayerQuant;
23pub use sparse::SparseIndex;
24
25/// Current on-disk format version. Bump when the .tern format changes.
26pub const FORMAT_VERSION: u32 = 1;