Desktop foundation / core (ubuntu-latest) (push) Failing after 28s
Desktop foundation / core (macos-latest) (push) Canceled after 0s
Desktop foundation / core (windows-latest) (push) Canceled after 0s
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
84 lines
4.7 KiB
Markdown
84 lines
4.7 KiB
Markdown
# Experimental Keyless QSA runtime
|
|
|
|
Requirements of record: `PROJECT_CHARTER.md` G7 and MCP `STRA-11`.
|
|
Method source: [Keyless Attention](https://arxiv.org/html/2606.21848v1),
|
|
effective query projection and GQA value-space routing.
|
|
|
|
The pretrained Qwen retrofit is a distinct experiment from the authors'
|
|
from-scratch training. It is never enabled as the normal Strata default.
|
|
The old V→K activation predictor is not used by this implementation.
|
|
|
|
## Representation and operations
|
|
|
|
- Each main QSA layer stores a single INT8 V pool and its quantization scales,
|
|
in both resident GPU pages and the authoritative host mirror. Full attention
|
|
K codes and scales are not allocated. Independent QSA indexer keys remain.
|
|
- The original per-head query and gate projection is retained. Its query half
|
|
is normalized with the existing Q norm, transformed by an explicit per-head
|
|
routing matrix, then position-encoded. The gate half is unchanged.
|
|
- Attention scores use the rotated view of cached V at the selected token's
|
|
position. The value sum retrieves the raw, unrotated V. Rotation happens
|
|
while reading V; no second persistent rotated V cache is required.
|
|
- Prefill, single-token decode, speculative verification, streaming page
|
|
movement and conversation snapshots must implement the same representation.
|
|
The MTP draft model retains its original K+V cache; it is a distinct model.
|
|
- Initial support is INT8 without the optional Hadamard rotation. Unsupported
|
|
KV formats, missing/invalid routing data or mismatched source projections
|
|
fail startup explicitly. A runtime cannot silently fall back to K+V.
|
|
|
|
## Conversion and quality
|
|
|
|
For row-major source projections, the linear initializer is
|
|
`A = Wk Wv.T pinv(Wv Wv.T)`, so `q_keyless = q A` and the effective
|
|
un-normalized query projection is `A.T Wq`. Query/gate rows are split per
|
|
head; each query head is matched to its GQA value head. Export records source
|
|
tensor digests and measures the score-matrix residual. This residual evaluates
|
|
the paper's linear subspace condition, not the full normalized model.
|
|
|
|
Source Q/K normalization is nonlinear and is not proven removable by this
|
|
initializer. Frozen-model query-routing calibration must account for it and
|
|
RoPE before quality preservation can be claimed. Routing artifacts identify
|
|
their source model and calibration state. Weight-space error, attention error
|
|
and full-model task quality are separate results.
|
|
|
|
## Acceptance and trial
|
|
|
|
The CUDA implementation must match an independent CPU reference for routed
|
|
queries, causal selections, positional scores and raw V retrieval, including
|
|
nonidentity page tables and multiple verifier rows. Saved states must be
|
|
format-specific. Ordinary K+V must preserve its baseline result.
|
|
|
|
Use the same console harness and game prompt for full-model comparisons.
|
|
Report completed requests, tool calls, input/cached/output tokens, weighted
|
|
decode tok/s, wall time, memory and independent game checks. A multi-day
|
|
`qwen-codex` trial requires repeated request, tool-call, cancellation and
|
|
long-context stability evidence plus an explicit rollback profile.
|
|
|
|
## Current measured state (2026-10-04)
|
|
|
|
The first implementation has passed numerical CUDA, physical streaming and
|
|
snapshot tests on RTX 5090. The pretrained-model retrofit failed the identical
|
|
console agent workload both before and after frozen routing distillation.
|
|
This is an experimental architecture with a **failed model quality gate**.
|
|
It is not qualified for a multi-day project trial. See
|
|
[the measurements](experiments/2026-10-04-keyless-runtime.md).
|
|
|
|
The initial artifact is generated with `scripts/prepare-keyless-routing.py`.
|
|
`STRATA_KEYLESS_PREFILL_TRACE` captures bounded ordinary-Qwen teacher activations
|
|
only in offline inference. `scripts/calibrate-keyless-routing.py` fits causal
|
|
teacher attention KL while keeping the pretrained projections and norms frozen.
|
|
Training and validation are distinct prompts; full-model task quality is a
|
|
separate gate. Reusing validation to compare fits makes it a calibration
|
|
validation set, not a final unbiased model benchmark.
|
|
|
|
`STRATA_KEYLESS_ROUTING` enables a source-bound artifact. Initial support requires
|
|
INT8, no Hadamard rotation, one GPU stage and zero position base. Missing or
|
|
mismatched artifacts fail explicitly. M-RoPE value scoring follows the same
|
|
per-cell time/height/width positions as query rotation. Image task quality has
|
|
not been qualified; only the positional kernel arithmetic has been tested.
|
|
|
|
`scripts/check-keyless-gpu.sh` runs synthetic CUDA gates on an idle GPU, without
|
|
model weights. CI includes offline routing/gradient tests and an optional manual
|
|
CUDA job for a configured `strata-gpu` self-hosted runner. Hosted Actions has
|
|
not run: this local project still has no hosted GitHub repository.
|