Instructions to use ceselder/muse-spark-olens-qwen-reader with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ceselder/muse-spark-olens-qwen-reader with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Cross-model oracle lens: Qwen3.6-27B reads Muse Spark Open layer-40 activations through an affine map
Built with Muse Spark Open. A Muse Spark Open activation (h40, the gated residual stream leaving 0-based layer 40, 8,192-d; see
ceselder/muse-spark-olens-lens) is mapped by a learned affine map A (8192 -> 5120) into the layer-42 space
of Qwen3.6-27B, injected exactly as our public Qwen oracle lens expects (norm-matched add at the output of decoder block 1 at the marker token γ, id 158983),
and a Qwen rsLoRA reader writes one bullet (* ...) saying what Muse is about to generate. Why: Muse rollouts need an 8 x B200 node per arm; the Qwen reader
trains at 7.7 s per 2,048-row SFT step and 17-18 s per 256 x 8 RL step on 8 x B200, with the reward still computed by a Muse reconstructor. This reader is a
Derivative of both models (trained on Muse's outputs and activations, built on Qwen's weights), so both licences ship here. WorkspaceBench (21 families without
typo variants / all 24) 0.248 / 0.228 (SFT) -> 0.378 / 0.425 at the released RL checkpoint (the native Muse lens: 0.289 / 0.274 -> 0.440 / 0.481; Kimi's reader of
Kimi-K3: 0.219 / 0.204 -> 0.370 / 0.425). Part of the collection Muse Spark olens. Written 2026-10-26 from NOTES.md (section "Qwen cross-model
reader" + "RL phase") and the run logs of ceselder/muse-olens (commit 46b1c0b); numbers are exact copies.
The release checkpoint is release/ = rl_step_0250/ (RL arm c, lr 6e-6, step 250), chosen by the highest held-out reconstruction of its greedy bullets
(reward 0.3269 / centred cosine 0.561 on 256 held-out rows; steps 225-300 lie within 0.006 = the 256-row noise, 250 is the formal maximum) -- never by the bench.
The bench-highest checkpoint of the arm is step 200 (0.404 / 0.451), selected on the bench itself, so that number is optimistic by construction and the
checkpoint is not shipped.
1. What is in this repo
| folder | what | files |
|---|---|---|
ridge_map/ |
The closed-form ridge map Muse h40 -> Qwen h42 before any co-training (xqm_affine): fitted on 1,856,828 byte-aligned (Muse position, Qwen position) pairs; validation (4,096 positions of the first paired part) centred cosine 0.713, FVE (best scale) 0.524, raw cosine 0.875; held-out file 0.705. |
affine.pt (W [5120, 8192], b [5120], meta incl. mu_m, mu_q, d_in, d_out), results.json (fit, lambda grid, scaling curve, held-out evals) |
sft_final/ |
The reader after SFT (xqm_sft2: fresh rsLoRA r64/a16 + the ridge map co-trained, one clean pass over 2,899,968 de-duplicated Muse-verbatim targets, held-out CE 2.7491). The init of every RL arm. |
adapter_config.json + adapter_model.safetensors (rsLoRA r64 on Qwen3.6-27B, 466.9M params; base_model_name_or_path = Qwen/Qwen3.6-27B), affine.pt (the map as it was at the end of the SFT), meta.json, metrics.json (held-out CE curve + arguments) |
release/ = rl_step_0250/ |
The reader after RL (xqm_rl_c: CISPO against the Muse reconstructor ar1c, lr 6e-6, map lr 2e-5, step 250 = the pick). |
same + metrics.json (the trainer's metrics at the step) |
The SFT co-trains the map at lr 3e-4 (relative drift ||W - W0|| / ||W0|| = 0.918 by the end; Kimi's reader 1.94) and the RL moves it a little more (map lr 2e-5),
so neither sft_final/affine.pt nor release/affine.pt is the ridge map: load each reader with its own affine.pt. ridge_map/ is the linear baseline.
| checkpoint | held-out CE (1,024 targets) | held-out recon of greedy bullets: reward / ccos (256 rows; Muse's own continuation 0.1706) | WorkspaceBench no-typo (21) [95% CI] / all 24 / workspace-only (11) | hallucination rate |
|---|---|---|---|---|
sft_final (bench tag xqm_rl_a_step0000) |
2.7491 | 0.1985 / 0.425 | 0.248 [0.233, 0.262] / 0.228 / 0.118 | 0.430 |
release = rl_step_0250 |
- | 0.3269 / 0.561 | 0.378 [0.360, 0.395] / 0.425 / 0.311 | 0.428 |
| native Muse lens, release (arm F step 300; lens repo) | - | 0.3307 / 0.565 | 0.440 / 0.481 / 0.378 | 0.498 |
2. How it is wired
- Muse side. h40 of the frozen Muse Spark Open, captured on plain token ids (no BOS, no template) with the vllm-metamodels
muse-sparkfork; 8,192-d, ||h|| ~ 64. - Map.
A(h) = W h + b, fitted asW (h - mu_m) + mu_qby closed-form ridge on byte-aligned pairs from the harvest parts: every captured Muse position whose token END byte is also a Qwen token end byte (95.9% of positions on hand-checked snippets; the misses are word-merge differences -- Muse's o200k-style pre-tokenizer splits numbers in threes and keeps'son the word like Qwen); x = Muse h40, y = Qwen3.6-27B's own layer-42 state (hidden_states[43]) at the same text position (early exit at block 42). fp64 shift-centred moments; lambda = 0.03 x mean diag(Cxx) (the grid 1e-5 .. 0.1 is flat within 0.001). The map carries direction: the injection is norm-matched, and the prediction is shrunk (centred norm 43.8 vs 61.1). Zero-shot reference before any training: the released Qwen single-activation SFT lens fed A(h40) through this map reaches CE 3.739 on Muse's own continuations -- as informative as Qwen's own layer-42 state at the same text position (3.804; shuffled 5.710, no injection 5.144). The fresh reader passes that by SFT step ~20. - Injection. The Qwen one-bullet lens recipe: forward hook on the output of decoder block 1; at the marker position
h <- h + ||h|| * unit(A(h_muse))(prompt forward only). Prompt = the Qwen chat template with thinking off around the same instruction as the native lens ("You are shown an internal activation vector ... one line starting with '* '. <concept>γ</concept>"), 70 tokens, marker at position 57. - Reader. Qwen3.6-27B frozen bf16 + rsLoRA r64 / alpha 16 on the attention projections, the linear-attention projections and the MLP of every block (the LoraConfig of our released Qwen single-activation lens; 466.9M LoRA parameters), from scratch (B = 0 asserted at init).
- Grammar. The one-bullet grammar v3 on the Qwen vocabulary (
*first, then <= 16 content tokens,<|im_end|>; newlines /*/|, specials, CJK, whitespace runs, invisible chars, glyphs banned; 190,485 content ids allowed); for the Muse-scored reward and every eval the Qwen bullet is decoded, re-encoded with Muse's tokenizer and cut at 16 Muse tokens.
3. How it was trained
3.1 Data
- Targets = Muse's verbatim continuations (the same rows as the native lens's SFT, re-tokenised for Qwen;
split == sftkept rows only): 3,444,449 one-bullet targets of 3,462,010 kept rows (99.5%; 2.7% cut to 16 tokens, 0.2% dropped as empty, 0.3% illegal under the grammar), prepared per harvest part from the CURRENT (post-rewrite) file versions with (window, t) carried on every row so the stream can de-duplicate. Held-out = 1,024 targets of the held-out file (7,494 targets of its 7,569 kept rows). - RL prompt pool: the 514,502 window-disjoint above-threshold rows of the
rl-split documents (no continuation ever sampled there;/vol/xqm/pool_wd, repacked into 8 files aspool_wd8with the global row order unchanged), 256 new prompts per step, none reused (76,800 per arm), identical prompts for every arm (seed 0).
3.2 SFT (sft_final)
xqm_sft2: fresh rsLoRA r64 + the ridge map, one pass over 2,899,968 rows (1,416 steps x 2,048) in "available parts" order with (window, t) de-duplication (0 duplicates dropped: the de-duplicated preps hold none), lr 3e-5 (LoRA) / 3e-4 (map; the Kimi probe showed 3e-4 ahead of 6e-5 at every eval), warm-up 20, linear to 5%; sanity gate at step 25. Held-out CE (1,024 held-out targets): 5.622 (0) | 3.222 (25) | 2.988 (50) | 2.889 (100) | 2.857 (150) | 2.841 (200) | 2.822 (300) | 2.809 (400) | 2.793 (500) | 2.786 (600) | 2.777 (700) | 2.769 (800) | 2.763 (900) | 2.761 (1,000) | 2.758 (1,100) | 2.753 (1,200) | 2.750 (1,300) | 2.7495 (1,400) | 2.7491 (final, 1,416) -- still inching down at the end. Train CE over the last 50 steps 2.711; 7.67 s/step median on 8 x B200 (~3.3 h incl. a Modal worker loss and a clean resume from step 25). Kimi's reader for comparison: 2.710 at 491 steps / 1.0M rows (different base model and data).xqm_sft(the first run, reference only, not shipped): the same recipe streamed behind the harvest; it consumed ~105k positions twice (3.6% of its budget) because 23 harvest parts were rewritten in place under it -> restarted asxqm_sft2. Its curve: 5.622 (0) -> 3.233 (25) -> 2.986 (50) -> 2.839 (225) -> 2.7905 (600) -> 2.7722 (875) -> 2.761 (1,050, cancelled).
3.3 RL (release = rl_step_0250)
CISPO as for the native lens: 256 prompts x 8 samples per step, T = 1 under the grammar, batch-normalised group advantages, truncated importance ratio (clip 5) against the HF sampler's log-probs, no KL penalty (logged), constant LoRA lr, map lr 2e-5, 300 steps, AdamW. Reward = the Muse reconstructor
ar1c(ceselder/muse-spark-olens-reconstructor; held-out cosine 0.378) served as a reward service:clamp(cos, 0)^2on the Muse-re-tokenised bullet (<= 16 Muse tokens). 17-18 s/step on 8 x B200 (generation 4 s, reward 5-7 s, fwd+bwd 7-8 s); ~1.5 h per arm.Learning-rate rule (the highest lr whose step-25 sampled-token content NLL stays above ~1.0 with margin), four arms from the same init, same prompts:
arm LoRA lr content NLL @25 train reward @25 ccos KL/tok to SFT bullets at the 16-Muse-token cap verdict b 1.5e-6 2.344 0.199 0.426 0.168 10.2% passes (lowest lr; cancelled) a 3e-6 2.199 0.212 0.441 0.205 12.5% passes at 25 (later 1.18 @50, 0.47 @75, 0.40 @100: the entropy collapsed after the rule's step; cancelled at 125) c 6e-6 1.692 0.237 0.470 0.341 14.8% passes with margin -> the arm that ran to 300 = the release d 1e-5 0.627 0.269 0.504 0.937 19.5% fails (entropy collapsed by step 25; Kimi's 1e-5: 0.45) Arm c curve: held-out greedy reconstruction (256 held-out rows,
ar1creward; Muse's own continuation 0.1706) 0.1985 (0) | 0.2654 (25) | 0.2880 (50) | 0.2939 (75) | 0.3000 (100) | 0.3090 (125) | 0.3099 (150) | 0.3157 (175) | 0.3145 (200) | 0.3214 (225) | 0.3269 (250) | 0.3251 (275) | 0.3260 (300); ccos 0.425 -> 0.561. Train: content NLL 1.69 (25) -> 0.48 (50) -> 0.40-0.52 afterwards (the entropy collapse arm a showed at 3e-6 arrives by step 50 at 6e-6), KL/tok to the SFT init 0.34 (25) -> 1.28 (50) -> 1.8 (100) -> 2.0-2.4 (150+), train reward 0.237 -> 0.31, map drift small. Arm a (3e-6) held-out: 0.251 / 0.270 / 0.285 / 0.292 / 0.301 at 25-125; arm b 0.246 (25); arm d 0.271 (25). Kimi anchors: 3e-6 / LoRA-AR reward 2.12 @25; 1e-5 / affine reward 0.45 (collapse).
4. How good
WorkspaceBench on Muse's 15,043 cells and activations (the same cells as the native lens; claude-sonnet-5 judge; 4 joined single-bullet T = 1 samples per cell, each
cut at 16 Muse tokens; evaluation only, no checkpoint selected on it). Every judged checkpoint of the shipped arm and the runs it is compared with, no-typo (21) / all 24:
| run (lr) | 0 | 25 | 50 | 75 | 100 | 125 | 150 | 175 | 200 | 225 | 250 | 275 | 300 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| arm c (6e-6) = this repo | .248/.228 | .363/.362 | .374/.412 | .391/.438 | .391/.437 | .390/.438 | .392/.439 | .396/.446 | .404/.451 | .399/.445 | .378/.425 | .399/.448 | .388/.440 |
| arm a (3e-6; cancelled at 125) | .248/.228 | .326/.319 | .375/.383 | .369/.403 | .377/.424 | .376/.422 | - | - | - | - | - | - | - |
| step-25 snapshots by lr: b 1.5e-6 / c 6e-6 / d 1e-5 (mean_21) | .306 / .363 / .365 | ||||||||||||
Kimi-K3 reader xqk_rl3 (reference) |
.232/.214 | .291/.279 | .310/.302 | .336/.332 | .359/.366 | .383/.422 | .382/.436 | .394/.442 | .368/.422 | .364/.419 | .358/.416 | .373/.426 | .370/.425 |
| checkpoint | no-typo (21) [95% CI] | all 24 | workspace-only (11) | hallucination rate (lower is better) |
|---|---|---|---|---|
sft_final (xqm_rl_a_step0000) |
0.248 [0.233, 0.262] | 0.228 | 0.118 | 0.430 |
release = rl_step_0250 |
0.378 [0.360, 0.395] | 0.425 | 0.311 | 0.428 |
| arm c step 200 (bench-highest, selected on the bench; not shipped) | 0.404 [0.386, 0.422] | 0.451 | 0.346 | 0.464 |
| native Muse lens, release (arm F step 300; lens repo) | 0.440 | 0.481 | 0.378 | 0.498 |
| Kimi-K3 reader after RL (kimi-k3-olens-qwen-reader) | 0.370 | 0.425 | 0.317 | 0.460 |
Per family at the release (normalised): typo 0.97, basic_readout 0.88, typo_mt 0.80, multilingual 0.79, user_modeling 0.72, multihop 0.68, association 0.62, brew 0.61, hallucination 0.57, basic_readout_mt 0.56, poetry 0.52, multilingual_typo 0.49, buggy_code 0.36, relational 0.31, multilingual_mt 0.30, role_bound 0.28, conjunctive 0.16, moral 0.13, multi_concept_dm 0.12, multilingual_multihop 0.11, directed_mod 0.10, multihop_mt 0.04, arithmetic 0.04, chain 0.03 (at SFT: basic_readout 0.83, association 0.11, arithmetic 0.037). Reading: RL lifts the headline by +0.13-0.16 within 75 steps and the bench then moves inside +-0.015 between adjacent checkpoints (0.38-0.40) while the held-out reconstruction keeps rising to step 250; the released Qwen reader of Muse ends 0.06 below the native Muse lens on the headline and 0.01 above Kimi's reader of Kimi-K3.
5. How to use
import torch, torch.nn.functional as F
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
d = "release" # or "sft_final"
tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.6-27B")
model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.6-27B", dtype=torch.bfloat16, device_map={"": 0}), d).eval()
A = torch.load(f"{d}/affine.pt"); W, b = A["W"].cuda(), A["b"].cuda() # [5120, 8192], [5120]
v = h40.float().cuda() @ W.T + b # h40 = Muse Spark Open stream leaving layer 40 (8192), from vLLM + the muse-spark fork (lens repo: capture_h40)
MARKER_ID = 158983 # γ
msgs = [{"role": "user", "content": "You are shown an internal activation vector from a language model, enclosed in <concept> tags. It encodes what the model is about to generate next.\n\n"
"Write the single most important piece of content in this activation as one line starting with '* '.\n\n<concept>γ</concept>"}]
ids = tok(tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False, enable_thinking=False), add_special_tokens=False, return_tensors="pt").input_ids.cuda()
def inject(_m, _i, out): # norm-matched add at the output of block 1, marker position, prompt forward only
h = out[0] if isinstance(out, tuple) else out
if h.shape[1] <= 1: return out
pos = (ids[0] == MARKER_ID).nonzero()[0, 0]
h = h.clone(); base = h[0, pos]; h[0, pos] = base + base.norm() * F.normalize(v.to(h.dtype), dim=-1)
return (h, *out[1:]) if isinstance(out, tuple) else h
hook = model.get_base_model().model.layers[1].register_forward_hook(inject)
out = model.generate(ids, max_new_tokens=18, do_sample=True, temperature=1.0, top_p=1.0, eos_token_id=248046) # <|im_end|>; add the grammar masks (muse_stack/xqm_common.py) for the exact bench protocol
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True)); hook.remove()
The exact training/bench sampler (grammar v3 logits processor, 16-Muse-token cut, batched injection) is xqm_policy.Policy in muse_stack/ (xqm_common.py +
xqm_policy.py, shipped here and in the lens repo).
6. Caveats
- Research checkpoint; the reader was trained on high-entropy web-text positions of Muse Spark Open and Muse's verbatim continuations; expect weaker readouts far from that distribution. Hallucination rate 0.43 on the bench's hallucination family (unchanged by RL).
- The map is fitted on exact byte-aligned positions and carries direction only (the injection is norm-matched); positions inside a Qwen word never entered the fit. The ridge fit itself includes ~82k duplicated pairs of 1.86M (4.4%: the pre-rewrite part versions) -- a 2x weight on those rows in a closed-form fit, kept because the map is co-trained during SFT anyway.
sft_final/affine.pt,release/affine.ptandridge_map/affine.ptare three different matrices; pair each reader with its own.- Content NLL fell below 0.5 by step 50 (entropy collapse) while the held-out reconstruction kept rising to step 250 and the bench stayed inside +-0.015: the step-25 rule is a no-collapse margin at launch, not a guarantee; the pick is by held-out reconstruction and the steps 225-300 are within its noise.
- WorkspaceBench is evaluation only; nothing was selected by it. The bench cells are Muse cells (the reader is judged on how well it describes Muse's state).
- Licence. The adapter and map are built on Qwen3.6-27B (Apache-2.0,
LICENSE-APACHE-2.0-Qwen3.6-27B.txt) and trained on the outputs and activations of Muse Spark Open, which makes them a Derivative under the Muse Model License (LICENSE.md+USE_POLICY.md, Meta's files verbatim: notice + policy must accompany every copy, "Built with Muse Spark Open" must be displayed, Model-as-a-Service clause above US$20M). Copyright (c) 2026 Meta Platforms, Inc. for Muse Spark Open; Qwen3.6-27B is Copyright Alibaba Cloud.
7. Provenance
- Code:
ceselder/muse-olens(commit46b1c0b) --src/xqm_common.py(prompt, grammar, Muse tokenizer, alignment,AffineMap),src/xqm_pairs.py(pairs),src/xqm_fit_affine.py(ridge),src/xqm_prep.py(targets, pools),src/xqm_sft.py,src/xqm_rl.py,src/xqm_bench.py,src/xqm_policy.py;NOTES.mdsections "Qwen cross-model reader (xqm worker)" + "RL phase". Logs:/vol/ckpt/xqm_sft2/log.jsonl,/vol/ckpt/xqm_rl_{a,b,c,d}/log.jsonl,wsb/tables/xqm_rl_*_stepXXXX.json; rollouts in ceselder/muse-spark-olens-rl-rollouts, bench readouts + verdicts in ceselder/muse-spark-olens-workspacebench-readouts; report http://5.78.192.0/reports/view/muse-spark-olens/report.html. - Reward model: ceselder/muse-spark-olens-reconstructor (
lora_ar_h40_bos_ar1c). Native lens: ceselder/muse-spark-olens-lens. Kimi-K3 / GLM-5.3 analogues: ceselder/kimi-k3-olens-qwen-reader, ceselder/glm5.3-olens-qwen-reader. - Base models: Qwen/Qwen3.6-27B (the reader), meta-models/Muse-Spark-Open-816B-A42B-NVFP4 (the activations). Built with Muse Spark Open.
- Downloads last month
- -
Model tree for ceselder/muse-spark-olens-qwen-reader
Base model
Qwen/Qwen3.6-27B
