AI Memory / context compression — at1 ctx

An LLM's KV-cache, activations and embeddings are float tensors with strong per-channel and temporal structure — and its context is mostly tokens the answer doesn't need. at1 ctx compresses both, losslessly where it counts: KV/tensor bytes recovered byte-exact, and context pruned so the model's greedy output stays byte-identical. Every container carries a SHA-256 you can re-verify.

Use it

# KV / tensor mode — structure-aware, byte-exact, numpy only (no PyTorch)
at1 ctx kv compress kv_layer0.npy -o kv_layer0.at1kv
at1 ctx kv verify   kv_layer0.at1kv        # SHA-256 checked, byte-exact roundtrip

# context mode — prune a prompt so the model's greedy output stays byte-identical
#   (needs a local HF causal LM: pip install torch transformers)
at1 ctx compress prompt.txt --model gpt2 -o prompt.at1ctx
at1 ctx verify   prompt.at1ctx             # greedy continuation matches the full context

Two modes

  • KV & tensor mode (at1 ctx kv) — a lossless, structure-aware codec that reorders token-major floats to channel-major and byte-plane splits each value, then keeps whichever is smaller, so it is provably never-worse than plain deflate. Works on fp32/fp16/bf16 and needs only numpy.
  • Context mode (at1 ctx compress) — prune a prompt, system message or RAG chunk so a given model's greedy continuation is byte-identical to the full context. The .at1ctx container stores the kept token ids plus a SHA-256 of the guaranteed output. This mode runs a local Hugging Face causal LM, so it needs PyTorch + transformers; invoking it without them prints a clear install hint and exits.

Honest scope

Proven: byte-exact lossless roundtrip on real GPT-2 KV-cache and activation tensors at fp32 and fp16 (about 1.22–1.24× over raw, 1.13–1.15× beyond plain deflate), a never-worse fallback on incompressible input, and single-byte tamper refusal via the embedded SHA-256. Real transformer tensors are fairly high-entropy, so the lossless structure-aware win over deflate is real but modest and is reported per tensor, never promised as a universal. This is about size + integrity, not encryption.

See the marketing overview at AT-1 Memory.

← CLI reference