Skip to content

Releases

AdapTQ v0.2.2

Choose a tag to compare

@l3tchupkt l3tchupkt released this 04 Oct 12:51

Changelog

All notable changes to AdapTQ are documented in this file.
Format follows Keep a Changelog.

[Unreleased]


[0.2.2] — 2026-10-04 — Stabilization, Streaming & Release Hygiene

Added

  • Ollama Streaming Generation: Implemented generate_streaming() in OllamaAdapter
    using chunked NDJSON streaming via /api/generate with stream: True. Resolves the
    issue where the Ollama adapter yielded no tokens because decode_next() returns None
    for REST-only backends.
  • Ollama Demo Streaming Flag: Added --stream option to examples/ollama_demo.py
    to demonstrate real-time token streaming.
  • Unit Tests (tests/test_ollama_streaming.py): Offline mock suite validating ordered
    fragment delivery, malformed-chunk skipping, HTTP error reporting, and post-exhaustion
    metric capture.
  • Integration test: integration_tests/test_llama_cpp_python_tracking.py — unit
    coverage for llama-cpp-python KV tracking without serializing llama state.
  • adaptq/paged_cache.py: PagedKVCache with block allocator, copy-on-write prefix
    sharing, and sequence block-table management.

Fixed

  • Production → research dependency: adaptq/runtime_py/backends/transformers_hf.py
    previously imported adaptq.research.packed_kv_pt. Fixed to import from
    adaptq.reference.packed_kv_pt (production reference module).
  • Max-Lloyd Codebook Boundaries (Issue #16): Resolved potential floating-point
    exceptions and undefined behaviour when constructing centroids from vectors containing
    NaNs, infinite outliers, or pure-zero sequences.
  • Snapshot Storage Validations: Added bound checks to SessionSnapshot::load()
    preventing illegal dimensions, token counts, and bit widths from causing malformed
    buffer allocations.
  • Optional-dependency test skip: test_llama_cpp_python_available and
    test_transformers_backend_available now skip cleanly via pytest.skip() when the
    optional backend package is absent, instead of failing with AssertionError.

Portability

  • AVX2 Dynamic Dispatch (Issue #7): Refactored away from global -mavx2 flags and
    #ifdef __AVX2__ guards. Uses __builtin_cpu_supports with function-level
    #pragma GCC target. Binary wheels fall back to scalar on older CPUs instead of
    crashing with SIGILL.

Documentation

  • README: Removed unsupported performance image, corrected API Quick Start examples
    to match V2.1 create_adapter() / ModelConfig API.
  • Backend accuracy: vllm and mlx documented as stubs (planned V3); ollama
    documented as REST-only (no internal KV interception).
  • Docs: Replaced all stale build_v2 CLI references with build_release across
    docs/testing.md, docs/v2.1_integration.md, docs/v2_replay.md.

CI

  • ci.yml: Pytest step now uses -m "not gpu_required and not slow" to reliably
    skip GPU-only and long-running tests on standard runners.
  • integration.yml: Replaced stale build_v2 CMake build directory with
    build_release throughout.
  • publish.yml: Build step now produces both wheel and sdist (python -m build).

Tests (v0.2.2)

  • pytest: 94 collected — 84 passed, 10 skipped (optional deps), 0 failed
  • Skips: all test_llama_cpp_python.* skip when llama-cpp-python not installed
  • C++ CTest: 67/67 pass on Linux CI (not runnable natively on Windows)

[0.2.1] — 2026-07-22 — V2.1: Real Runtime Integration & Validation

Added

Python — Multi-Backend Adapter Layer

  • adaptq/runtime_py/ — IRuntimeAdapter Python ABC + backend registry
    • create_adapter(backend) factory for all supported backends
    • backend_available(backend) / list_available_backends() discovery helpers
    • IRuntimeAdapter.generate_streaming(): Added metrics tracking (wall time, tokens/sec, token IDs, KV stats) and lifecycle guarantees via generation_result()
  • adaptq/runtime_py/backends/transformers_hf.py — HuggingFace Transformers adapter (Priority 1)
    • Hooks into DynamicCache.update() to intercept K/V per layer
    • Supports any CausalLM: Qwen, LLaMA, Mistral, Gemma, GPT-2, …
    • CPU and GPU; auto-detects device
  • adaptq/runtime_py/backends/llama_cpp_python.py — llama-cpp-python adapter (Priority 1)
    • Hooks into Llama.eval() + Llama.sample() token loop
    • Full generate() pipeline with save/restore llama context state
    • KV stats via size estimation (approximate)
  • adaptq/runtime_py/backends/ollama.py — Ollama REST adapter (Priority 2)
    • POST /api/generate with streaming JSON
    • No internal KV access; captures timing and token counts
  • adaptq/runtime_py/backends/vllm.py — vLLM stub (Priority 3, CUDA required)
  • adaptq/runtime_py/backends/mlx.py — MLX stub (Priority 5, Apple Silicon)
  • adaptq/runtime_py/backends/llama_cpp.py — llama.cpp C++ stub (Priority 6, source build)

C++ — IRuntimeAdapter Interface

  • runtime/adapters/adapter.h — IRuntimeAdapter pure C++ interface (9 virtual methods)
  • runtime/adapters/runtime_metadata.h — ModelConfig, SessionConfig, KVCacheView, RuntimeMetadata, GenerationResult

Examples (6 demos)

  • examples/transformers_demo.py — full Transformers pipeline demo
  • examples/llama_demo.py — full llama-cpp-python pipeline + context save/restore
  • examples/ollama_demo.py — Ollama REST generation demo
  • examples/snapshot_demo.py — standalone snapshot pipeline (no model required)
  • examples/branch_replay_demo.py — branch replay at midpoint
  • examples/compare_backends.py — cross-backend comparison table

Benchmarks

  • benchmarks/bench_all.py — unified benchmark runner (KV memory, latency, snapshot size)
  • Output formats: JSON, CSV, Markdown

Integration Tests

  • integration_tests/conftest.py — shared fixtures, markers, --model-hf, --model-gguf CLI args
  • integration_tests/test_adapter_contract.py — 25 backend-agnostic contract tests
  • integration_tests/test_transformers.py — 15 end-to-end transformers tests
  • integration_tests/test_llama_cpp_python.py — 10 end-to-end llama-cpp-python tests

CI

  • .github/workflows/integration.yml — 4-job CI: C++ tests, adapter contracts, transformers integration, Python validation

Documentation

  • docs/v2.1_integration.md — backend integration guide + "how to add a new backend"

Changed

  • adaptq/__init__.py — exports create_adapter(), list_available_backends()
  • pyproject.toml — version 0.2.1; optional deps for each backend
  • pyproject.toml — [tool.pytest.ini_options] now covers integration_tests/
  • CLAUDE.md — V2.1 architecture notes

Fixed (Pre-Release Audit)

  • CRITICAL: Fixed SyntaxError in adaptq/__init__.py (duplicate docstring) that prevented the package from being imported.
  • Fixed adaptq/__init__.py missing __version__.
  • Fixed adaptq/replay.py stale binary path (build_v2 → build_release), duplicate --format flag, and namespace pollution.
  • Fixed adaptq/runtime_py/backends/transformers_hf.py torch_dtype deprecation warning (changed to dtype).
  • Expanded .gitignore to cover all build directories (build_release, build_debug, etc.).
  • Made validate_*.sh, replay.py, and run_tests.py fully cross-platform (removed hardcoded WSL paths).

Test Results (V2.1)

  • C++: 67/67 tests pass (unchanged)
  • Integration contract: 25/25 pass (no model required)
  • Transformers integration: 15/15 pass (Qwen2-0.5B, CPU, 167s)
  • Backends available: transformers, llama_cpp_python, ollama

[0.2.0] — 2026-07-22 — V2: Replay + Compare

Added

C++ (Core)

  • runtime/runtime_context.h/cpp — RuntimeContext orchestration class
    • Full wire-up: IPolicy → IKVStrategy → IStorageBackend → IKernelBackend
    • Token log (log_tokens=true) for FP32 K/V capture used by snapshot replay
    • StrategyFactory / StorageFactory typedefs; runtime strategy registry
    • strategy_factory_by_name() and strategy_names() registry functions
    • make_contiguous() public factory for ContiguousSlabStorage
  • replay/session_snapshot.h/cpp — SessionSnapshot versioned binary format
    • Magic 0x41515353 ("AQSS"), version 2, little-endian self-describing header
    • Per-head K/V slab data, scales, format tags capture
    • Optional strategy state serialization via IReplayHooks
    • Optional token log for deterministic replay
    • capture(), save(), load() API
  • replay/replay_engine.h/cpp — ReplayEngine
    • replay() — full deterministic replay from token 0
    • branch(from_token) — warm-up replay then return ready context
    • replay_with(strategy_name) — cross-strategy replay
    • ReplayReport with per-token ComputeMetrics
  • cli/cmd_replay.cpp — adaptq replay <snapshot.aqss> [options]
    • --strategy har_fixed|fp_passthrough — override strategy
    • --from-token N — branch mode
    • --metrics — collect per-token metrics
    • --output <file> — file output
    • --format json|csv|md|tex — output format
  • cli/cmd_compare.cpp — adaptq compare <snapshot.aqss> --strategies A,B
    • JSON/CSV/Markdown/LaTeX output
    • Aggregated per-strategy summary: wall time, avg latency, avg quality, avg bits/dim
  • cli/cmd_create_strategy.cpp — adaptq create-strategy <Name>
    • Scaffolds full IKVStrategy directory under strategies/<name>/

Tests (C++)

  • tests/unit/test_runtime_context.cpp — 10 tests for RuntimeContext
  • tests/unit/test_session_snapshot.cpp — 8 tests for SessionSnapshot
  • tests/unit/test_replay_engine.cpp — 9 tests for ReplayEngine

Python

  • adaptq/replay.py — ReplayEngine, ReplayResult, CompareResult, snapshot_info
    • Thin subprocess wrappers around adaptq replay/compare CLI
    • `Compare...
Read more

AdapTQ v0.2.3

Choose a tag to compare

@l3tchupkt l3tchupkt released this 04 Oct 13:02

Changelog

All notable changes to AdapTQ are documented in this file.
Format follows Keep a Changelog.

[Unreleased]


[0.2.3] — 2026-10-04 — V2.3: PyPI Release Unblocker

Fixed

  • PyPI Release: Bumped version to 0.2.3 to bypass PyPI's 14-day lock on modifying existing release versions, allowing the 0.2.2 stabilization and streaming fixes to be successfully published.

[0.2.2] — 2026-10-04 — Stabilization, Streaming & Release Hygiene

Added

  • Ollama Streaming Generation: Implemented generate_streaming() in OllamaAdapter
    using chunked NDJSON streaming via /api/generate with stream: True. Resolves the
    issue where the Ollama adapter yielded no tokens because decode_next() returns None
    for REST-only backends.
  • Ollama Demo Streaming Flag: Added --stream option to examples/ollama_demo.py
    to demonstrate real-time token streaming.
  • Unit Tests (tests/test_ollama_streaming.py): Offline mock suite validating ordered
    fragment delivery, malformed-chunk skipping, HTTP error reporting, and post-exhaustion
    metric capture.
  • Integration test: integration_tests/test_llama_cpp_python_tracking.py — unit
    coverage for llama-cpp-python KV tracking without serializing llama state.
  • adaptq/paged_cache.py: PagedKVCache with block allocator, copy-on-write prefix
    sharing, and sequence block-table management.

Fixed

  • Production → research dependency: adaptq/runtime_py/backends/transformers_hf.py
    previously imported adaptq.research.packed_kv_pt. Fixed to import from
    adaptq.reference.packed_kv_pt (production reference module).
  • Max-Lloyd Codebook Boundaries (Issue #16): Resolved potential floating-point
    exceptions and undefined behaviour when constructing centroids from vectors containing
    NaNs, infinite outliers, or pure-zero sequences.
  • Snapshot Storage Validations: Added bound checks to SessionSnapshot::load()
    preventing illegal dimensions, token counts, and bit widths from causing malformed
    buffer allocations.
  • Optional-dependency test skip: test_llama_cpp_python_available and
    test_transformers_backend_available now skip cleanly via pytest.skip() when the
    optional backend package is absent, instead of failing with AssertionError.

Portability

  • AVX2 Dynamic Dispatch (Issue #7): Refactored away from global -mavx2 flags and
    #ifdef __AVX2__ guards. Uses __builtin_cpu_supports with function-level
    #pragma GCC target. Binary wheels fall back to scalar on older CPUs instead of
    crashing with SIGILL.

Documentation

  • README: Removed unsupported performance image, corrected API Quick Start examples
    to match V2.1 create_adapter() / ModelConfig API.
  • Backend accuracy: vllm and mlx documented as stubs (planned V3); ollama
    documented as REST-only (no internal KV interception).
  • Docs: Replaced all stale build_v2 CLI references with build_release across
    docs/testing.md, docs/v2.1_integration.md, docs/v2_replay.md.

CI

  • ci.yml: Pytest step now uses -m "not gpu_required and not slow" to reliably
    skip GPU-only and long-running tests on standard runners.
  • integration.yml: Replaced stale build_v2 CMake build directory with
    build_release throughout.
  • publish.yml: Build step now produces both wheel and sdist (python -m build).

Tests (v0.2.2)

  • pytest: 94 collected — 84 passed, 10 skipped (optional deps), 0 failed
  • Skips: all test_llama_cpp_python.* skip when llama-cpp-python not installed
  • C++ CTest: 67/67 pass on Linux CI (not runnable natively on Windows)

[0.2.1] — 2026-07-22 — V2.1: Real Runtime Integration & Validation

Added

Python — Multi-Backend Adapter Layer

  • adaptq/runtime_py/ — IRuntimeAdapter Python ABC + backend registry
    • create_adapter(backend) factory for all supported backends
    • backend_available(backend) / list_available_backends() discovery helpers
    • IRuntimeAdapter.generate_streaming(): Added metrics tracking (wall time, tokens/sec, token IDs, KV stats) and lifecycle guarantees via generation_result()
  • adaptq/runtime_py/backends/transformers_hf.py — HuggingFace Transformers adapter (Priority 1)
    • Hooks into DynamicCache.update() to intercept K/V per layer
    • Supports any CausalLM: Qwen, LLaMA, Mistral, Gemma, GPT-2, …
    • CPU and GPU; auto-detects device
  • adaptq/runtime_py/backends/llama_cpp_python.py — llama-cpp-python adapter (Priority 1)
    • Hooks into Llama.eval() + Llama.sample() token loop
    • Full generate() pipeline with save/restore llama context state
    • KV stats via size estimation (approximate)
  • adaptq/runtime_py/backends/ollama.py — Ollama REST adapter (Priority 2)
    • POST /api/generate with streaming JSON
    • No internal KV access; captures timing and token counts
  • adaptq/runtime_py/backends/vllm.py — vLLM stub (Priority 3, CUDA required)
  • adaptq/runtime_py/backends/mlx.py — MLX stub (Priority 5, Apple Silicon)
  • adaptq/runtime_py/backends/llama_cpp.py — llama.cpp C++ stub (Priority 6, source build)

C++ — IRuntimeAdapter Interface

  • runtime/adapters/adapter.h — IRuntimeAdapter pure C++ interface (9 virtual methods)
  • runtime/adapters/runtime_metadata.h — ModelConfig, SessionConfig, KVCacheView, RuntimeMetadata, GenerationResult

Examples (6 demos)

  • examples/transformers_demo.py — full Transformers pipeline demo
  • examples/llama_demo.py — full llama-cpp-python pipeline + context save/restore
  • examples/ollama_demo.py — Ollama REST generation demo
  • examples/snapshot_demo.py — standalone snapshot pipeline (no model required)
  • examples/branch_replay_demo.py — branch replay at midpoint
  • examples/compare_backends.py — cross-backend comparison table

Benchmarks

  • benchmarks/bench_all.py — unified benchmark runner (KV memory, latency, snapshot size)
  • Output formats: JSON, CSV, Markdown

Integration Tests

  • integration_tests/conftest.py — shared fixtures, markers, --model-hf, --model-gguf CLI args
  • integration_tests/test_adapter_contract.py — 25 backend-agnostic contract tests
  • integration_tests/test_transformers.py — 15 end-to-end transformers tests
  • integration_tests/test_llama_cpp_python.py — 10 end-to-end llama-cpp-python tests

CI

  • .github/workflows/integration.yml — 4-job CI: C++ tests, adapter contracts, transformers integration, Python validation

Documentation

  • docs/v2.1_integration.md — backend integration guide + "how to add a new backend"

Changed

  • adaptq/__init__.py — exports create_adapter(), list_available_backends()
  • pyproject.toml — version 0.2.1; optional deps for each backend
  • pyproject.toml — [tool.pytest.ini_options] now covers integration_tests/
  • CLAUDE.md — V2.1 architecture notes

Fixed (Pre-Release Audit)

  • CRITICAL: Fixed SyntaxError in adaptq/__init__.py (duplicate docstring) that prevented the package from being imported.
  • Fixed adaptq/__init__.py missing __version__.
  • Fixed adaptq/replay.py stale binary path (build_v2 → build_release), duplicate --format flag, and namespace pollution.
  • Fixed adaptq/runtime_py/backends/transformers_hf.py torch_dtype deprecation warning (changed to dtype).
  • Expanded .gitignore to cover all build directories (build_release, build_debug, etc.).
  • Made validate_*.sh, replay.py, and run_tests.py fully cross-platform (removed hardcoded WSL paths).

Test Results (V2.1)

  • C++: 67/67 tests pass (unchanged)
  • Integration contract: 25/25 pass (no model required)
  • Transformers integration: 15/15 pass (Qwen2-0.5B, CPU, 167s)
  • Backends available: transformers, llama_cpp_python, ollama

[0.2.0] — 2026-07-22 — V2: Replay + Compare

Added

C++ (Core)

  • runtime/runtime_context.h/cpp — RuntimeContext orchestration class
    • Full wire-up: IPolicy → IKVStrategy → IStorageBackend → IKernelBackend
    • Token log (log_tokens=true) for FP32 K/V capture used by snapshot replay
    • StrategyFactory / StorageFactory typedefs; runtime strategy registry
    • strategy_factory_by_name() and strategy_names() registry functions
    • make_contiguous() public factory for ContiguousSlabStorage
  • replay/session_snapshot.h/cpp — SessionSnapshot versioned binary format
    • Magic 0x41515353 ("AQSS"), version 2, little-endian self-describing header
    • Per-head K/V slab data, scales, format tags capture
    • Optional strategy state serialization via IReplayHooks
    • Optional token log for deterministic replay
    • capture(), save(), load() API
  • replay/replay_engine.h/cpp — ReplayEngine
    • replay() — full deterministic replay from token 0
    • branch(from_token) — warm-up replay then return ready context
    • replay_with(strategy_name) — cross-strategy replay
    • ReplayReport with per-token ComputeMetrics
  • cli/cmd_replay.cpp — adaptq replay <snapshot.aqss> [options]
    • --strategy har_fixed|fp_passthrough — override strategy
    • --from-token N — branch mode
    • --metrics — collect per-token metrics
    • --output <file> — file output
    • --format json|csv|md|tex — output format
  • cli/cmd_compare.cpp — adaptq compare <snapshot.aqss> --strategies A,B
    • JSON/CSV/Markdown/LaTeX output
    • Aggregated per-strategy summary: wall time, avg latency, avg quality, avg bits/dim
  • cli/cmd_create_strategy.cpp — adaptq create-strategy <Name>
    • Scaffolds full IKVStrategy directory under strategies/<name>/

Tests (C++)

  • tests/unit/test_runtime_context.cpp — 10 tests for RuntimeContext
  • tests/unit/test_session_snapshot.cpp —...
Read more

AdapTQ v0.2.1

Choose a tag to compare

@l3tchupkt l3tchupkt released this 23 Jul 17:10

Release Notes: AdapTQ v0.2.1

We are thrilled to announce AdapTQ v0.2.1, the first production-ready release of the Adaptive Streaming Vector Quantization engine for LLM inference on edge devices!

AdapTQ allows you to achieve 4–8× smaller KV cache footprints by dynamically scaling compression down to 2, 3, or 4 bits per weight, seamlessly executing entirely on the CPU with zero model changes required.

🚀 Highlights

  • Multi-Backend Support (V2.1): We now provide drop-in wrappers for Hugging Face transformers and llama-cpp-python. You can initialize our C++ KV-cache completely opaquely to the generation loop.
  • Deterministic Replay & Branching (V2): You can now snapshot exact KV states into binary .aqss files and instantly branch or replay conversations from any specific token without any context-recomputation overhead.
  • Hybrid Execution & Seamless SIMD: AdapTQ handles everything under the hood. Short sequences stay in FP32; large contexts are routed through an ultra-fast quad-unrolled AVX2 SIMD rotation and quantization pipeline.
  • Tested & Benchmarked: Zero heap allocations in the hot path. 100% C++ tests passing. Successfully measured 1,139 tokens/sec and 8x memory footprint reductions on 4-bit configurations.

🆕 New Features

  • Drop-in Python Adapter (adaptq.create_adapter()) for seamless Hugging Face and Llama.cpp integrations.
  • ReplayEngine and SessionSnapshot APIs via the new adaptq.replay module.
  • High-performance native CLI adapTQ_demo (accessible via PyPI or source builds) providing automated strategy benchmarking.
  • A fully overhauled README.md and documentation suite to help you start hacking instantly!

🛠️ Improvements & Fixes

  • Resolved severe installation-blocking bugs related to duplicated docstrings on __init__.py.
  • Streamlined the pyproject.toml and .gitignore logic to support safe native source distributions.
  • Cleaned up the repository significantly, removing duplicate examples and legacy testing shell scripts.
  • Fixed snapshot sizing logic that overestimated sizes when capturing state.

📦 Upgrade Notes

This marks the first true beta release of AdapTQ V2. If you used the v0.1.0 engine directly via the C-API, note that you should now integrate via RuntimeContext to properly utilize the snapshotting and unified strategy logic. See docs/v2.1_integration.md for migration examples.

AdapTQ v0.1.0 — Initial Public Release

Choose a tag to compare

@l3tchupkt l3tchupkt released this 25 Apr 20:40

🚀 AdapTQ v0.1.0 — Initial Release

First public release of AdapTQ: Adaptive Streaming Vector Quantization engine for efficient LLM KV-cache compression and attention.

✨ Features

  • Hadamard-Accelerated Rotation (FWHT-based)
  • 2/3/4-bit vector quantization (Max-Lloyd codebooks)
  • LUT-driven attention (no full dequantization)
  • Hybrid FP32 / Quantized execution (auto switch)
  • Contiguous KVFlatBuffer (streaming-friendly)
  • AVX2 optimized kernels
  • Python (PyBind11) API support

⚡ Performance

  • Up to 10×–17× speedup at long contexts
  • 4×–16× KV memory reduction
  • Stable cosine similarity ≈ 0.94+

📦 Install

pip install adaptq