Skip to content

feat(prefill): add bit-packed KakeyaLattice snapshots - #167

Merged
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/prefill-kakeyalattice-codec-0712
Jul 12, 2026
Merged

feat(prefill): add bit-packed KakeyaLattice snapshots#167
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/prefill-kakeyalattice-codec-0712

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Summary

  • add an explicit KAKEYA_LATTICE_D4 prefill compression codec to the proto/API
  • quantize heterogeneous Gemma-4 K/V tensors with D4 Q=38, bit-pack codes, and reconstruct standard portable KPKV snapshots on import
  • frame and checksum packed payloads without weakening existing zlib/raw validation
  • pin KakeyaLattice 1.6.1 git commit because bit-packed support is not yet published to PyPI
  • require a distinct kakeya-prefill-v3-kl-d4-q38 compatibility format and configure head/worker deployment consistently

Real snapshot evidence

On the live 145-token Gemma snapshot from allens:

  • raw KPKV: 33,197,920 bytes
  • current zlib wire: 26,267,657 bytes
  • KakeyaLattice framed wire: 12,950,269 bytes
  • raw-to-wire ratio: 2.56x
  • encode: 1.71 s; decode: 0.41 s
  • relative K/V MSE: 5.98e-4

This improves storage and warm-hit transfer. It does not reduce allens model prefill compute time.

Tests

  • platform-neutral suite — 817 passed, 1 skipped
  • TypeScript SDK — 54 passed, 100% coverage; typecheck passed
  • real KakeyaLattice 1.6.1 heterogeneous 256/512-head snapshot round trip — passed
  • proto lint, format and generated stub drift — passed

Made with Cursor

Introduce an explicit D4 Q38 wire codec for heterogeneous Gemma KV tensors, pin the unreleased 1.6.1 dependency, and require matching cache format metadata so lossy packed snapshots are only exchanged by compatible nodes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FluffyAIcode
FluffyAIcode merged commit ea1c765 into main Jul 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant