Downloads · 30 days
0
esceptico/qwen3.5-4b-mean-future-r-lens
qwen3.5-4b-mean-future-r-lens is a machine learning model from esceptico. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
A fitted readout tool for transformer internals. It maps an earlier-layer activation into Qwen3.5-4B's layer-30 residual basis for vocabulary inspection. It is not a language model or adapter and does not generate tex…
Downloads · 30 days
0
Access
Public
Updated Sep 3, 2026
Repo size
786 MB
Likes
0
Public
Click a slice to open those files.
.pt786 MB · 100%
From the Hugging Face model README
A fitted readout tool for transformer internals. It maps an earlier-layer activation into Qwen3.5-4B's layer-30 residual basis for vocabulary inspection. It is not a language model or adapter and does not generate text by itself.
The release contains 30 float32 matrices—one for each source layer 0–29—each with shape 2560 × 2560. For a row-vector activation x_l:
x_layer_30_basis = x_l @ R_l.T
Apply Qwen's existing final normalization and unembedding to inspect the vocabulary ranking. The matrices average RelP pseudo-Jacobians produced by a modified backward graph; they are not ordinary Jacobians of Qwen's forward computation. Model weights, activations, and the forward pass remain unchanged.
Token rankings are interpretive projections, not proof that a layer stores literal words or that an early decoded token is the model's final answer. Rare or weakly trained vocabulary rows can also mislead. See the original R-Lens post for motivation and broader caveats.
The fit uses every source position except the final token. For source position s, valid targets are the non-final positions t ≥ s.
This removes the deterministic future-horizon count factor without forcing equal map norms.
<details> <summary>Definition and adjoint</summary>For sequence length $L$, let $S={0,\ldots,L-2}$ and $T_s={t\in S:t\ge s}$. With RelP pseudo-Jacobian block $J^{\mathrm{RelP}}_{l,s\rightarrow30,t}$:
$$ R^{\mathrm{sum}}{l,s}=\sum{t\in T_s}J^{\mathrm{RelP}}{l,s\rightarrow30,t},\qquad R^{\mathrm{mean}}{l,s}=\frac{1}{|T_s|}\sum_{t\in T_s}J^{\mathrm{RelP}}_{l,s\rightarrow30,t}. $$
The normalized position maps are averaged within prompts and then across prompts. The adjoint pullback is:
source_scoring_direction = R_l.T @ target_scoring_direction
It pulls a scoring covector—such as an unembedding row or token contrast—toward a source layer. It is not an inverse reconstruction of a source residual.
</details>Run the included aggregation example with python examples/aggregation_demo.py.
The normalization choice was tested under a frozen matched protocol on Qwen3.5-4B and 9B: Pile fit prompts, separate WikiText-103 evaluation records, four independently fitted conditions per model, and separate primary/replication splits. All pooled 95% intervals for the preregistered summaries favored Mean-Future:
| Measure | Evaluation scope | Improvement across model/split pools |
|---|---|---|
| Hit@10 | Layers 0–10; positions 16 through the penultimate token | +1.86 to +3.71 pp |
| Target-distribution KL | Same | 0.282 to 0.532 lower |
| Residual cosine | Same | +0.0118 to +0.0358 |
| Causal effect | Layers 4, 10, 16, 22, 27; penultimate-token intervention vs matched random directions | +0.0396 to +0.1570 |
Both model sizes passed all transport and causal condition gates. Lines below are pooled estimates; bands are 95% condition-stratified prompt-bootstrap intervals; shading marks the preregistered early-layer band. Layerwise curves are diagnostic, not separate multiple-comparison-adjusted claims.
Exact results and frozen source hashes are in evidence/mean-vs-sum.json and evidence/per-layer-transport.json.
Evidence boundary: the campaign used 6 fit prompts per condition and 4 conditions per model. The uploaded artifact was fitted separately on 100 prompts using all non-final source positions. The campaign validates the Mean-Future normalization, not held-out performance of these exact matrices or a fresh R-Lens-versus-J-Lens superiority claim.
The following fixed-prompt heatmap compares freshly matched 100-prompt J-Lens, Sum R-Lens, and Mean-Future R-Lens fits using the same model revision, prompts, positions, layers, and target. Cell text is the decoded top-1 token; green means the target top-1 appears in the lens top-10; the adjacent panels report top-10 overlap. This is illustrative, not held-out evidence. Open full-resolution SVG.
Sum R-Lens baseline note: prompts 1–2 used Qwen's native gated-delta implementation; prompts 3–100 resumed from the verified checkpoint with
fla-core==0.5.2and Triton3.7.1. Backend equivalence was not independently tested. This affects the illustrative Sum baseline, not the released Mean-Future artifact.
The CKA comparison uses linear CKA over 1,200 uniformly sampled rows of W_U @ J_l, an identity anchor at layer 30, and a second independent 1,200-token sample for stability. Open full-resolution SVG.
| Same-layer CKA | Layers 0–10 | Layers 21–30 |
|---|---|---|
| J vs Sum R | 0.719 | 0.987 |
| J vs Mean-Future R | 0.734 | 0.980 |
| Sum R vs Mean-Future R | 0.844 | 0.995 |
The full matrix is stable across vocabulary samples (r=0.9998, mean absolute difference 0.0024). Early J/R divergence and late convergence replicate; the Qwen-3.6-27B claim of roughly 4–5 J-space bands versus 2–3 R-space bands does not robustly replicate on Qwen3.5-4B. Exploratory segmentation selects 2 bands for J-Lens and 3 for each R-Lens variant, but band count is method-dependent and the matrices are primary. CKA is fitted-matrix geometry, not causal or held-out behavioral evidence.
Exact heatmap cells and fit identities are in evidence/layer-position-readout.json. Primary/replication CKA matrices, sample hashes, summaries, and segmentation are in evidence/cross-lens-cka.json. The method follows the J-Lens CKA analysis.
| Property | Value |
|---|---|
| Base model | Qwen/Qwen3.5-4B |
| Revision | 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a |
| Source → target layers | 0–29 → 30 |
| Residual width / dtype | 2560 / float32 |
| Fit | 100 fixed Pile prompts; all positions through the penultimate token; max 128 tokens |
| Size | 786,442,873 bytes |
| SHA-256 | 07bd8fc4d2e578fb76cd08d9531b175ed6b7a373fe87d86b59ee994d184c07f7 |
Milestones were saved after 10, 25, 50, and 100 prompts; the 50-prompt lens has cosine 0.9979 to the canonical 100-prompt artifact. The exact release file also passed a live test against the pinned model: fingerprint matched, all 30 maps produced finite non-identity outputs, and a final-layer positive control reproduced logits with zero maximum absolute error. This synthetic smoke test validates wiring and compatibility, not superiority. See validation.json and evidence/functional-smoke-test.json.
pip install -r requirements.txt
python load_lens.py
python load_lens.py --local ./lens.pt --demo --layer 16
lens.pt is a postconcept.lens version 2 PyTorch payload. load_lens.py downloads or opens it, then checks its SHA-256, format, finite 2560 × 2560 matrices, exact model identity, layers, prompt count, and Mean-Future settings using torch.load(..., weights_only=True).
import torch
from load_lens import MeanFutureRLens
lens = MeanFutureRLens.from_hub("esceptico/qwen3.5-4b-mean-future-r-lens")
x = torch.randn(2560)
target_basis = lens.transport(x, layer=16)
source_direction = lens.pullback(torch.randn(2560), layer=16, normalize=True)
See examples/basic_usage.py for a complete local example.
provenance.json; maps cover only source layers 0–29 and target layer 30.| Files | Contents |
|---|---|
provenance.json, validation.json | Identity, data fingerprints, estimator rules, environment, deterministic settings, integrity, convergence, and smoke-test summary |
evidence/mean-vs-sum.json, evidence/per-layer-transport.json | Held-out comparison and diagnostic layerwise transport |
evidence/functional-smoke-test.json | Exact-model live compatibility check and decoded readouts |
evidence/layer-position-readout.json, evidence/cross-lens-cka.json | Matched diagnostic comparisons |
assets/generate_figures.py, assets/generate_readout_figure.py, assets/generate_cka_figure.py | Deterministic SVG generators |
SHA256SUMS | Release checksum manifest |
The raw fit prompts, exact sampled CKA token IDs, and internal operational records are not distributed.
Apache-2.0. The base model and datasets retain their own attribution and license requirements.