chessformer-lens 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chessformer_lens-0.0.1/LICENSE +21 -0
- chessformer_lens-0.0.1/PKG-INFO +72 -0
- chessformer_lens-0.0.1/README.md +49 -0
- chessformer_lens-0.0.1/chessformer_lens/__init__.py +22 -0
- chessformer_lens-0.0.1/chessformer_lens.egg-info/PKG-INFO +72 -0
- chessformer_lens-0.0.1/chessformer_lens.egg-info/SOURCES.txt +8 -0
- chessformer_lens-0.0.1/chessformer_lens.egg-info/dependency_links.txt +1 -0
- chessformer_lens-0.0.1/chessformer_lens.egg-info/top_level.txt +1 -0
- chessformer_lens-0.0.1/pyproject.toml +46 -0
- chessformer_lens-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Litman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chessformer_lens
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An interpretability lens for square-token chess transformers (MAIA-3 backend; Lc0-BT next).
|
|
5
|
+
Author-email: David Litman <david.litman1@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/chessformer-lens/chessformer_lens
|
|
8
|
+
Project-URL: Repository, https://github.com/chessformer-lens/chessformer_lens
|
|
9
|
+
Project-URL: Issues, https://github.com/chessformer-lens/chessformer_lens/issues
|
|
10
|
+
Keywords: chess,transformer,mechanistic-interpretability,interpretability,maia,leela,lc0,attention,logit-lens,ablation
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Games/Entertainment :: Board Games
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# chessformer_lens
|
|
25
|
+
|
|
26
|
+
**An interpretability lens for square-token chess transformers.**
|
|
27
|
+
|
|
28
|
+
`chessformer_lens` reads the *internals* of chess models that represent the board as
|
|
29
|
+
64 square tokens with a from×to policy head — the "chessformer" architecture family
|
|
30
|
+
(MAIA-3 today; [Leela Chess Zero](https://lczero.org)'s BT transformers next). It is to
|
|
31
|
+
chess transformers roughly what [TransformerLens](https://github.com/TransformerLensOrg/TransformerLens)
|
|
32
|
+
is to language models: instrumentation for looking at what the network computes, not just
|
|
33
|
+
what it plays.
|
|
34
|
+
|
|
35
|
+
> **Status: pre-alpha (`0.0.1`).** This release reserves the package name. The functional
|
|
36
|
+
> API is being extracted from a working MAIA-3 research harness and lands next. Watch the
|
|
37
|
+
> repo if you want the first usable cut.
|
|
38
|
+
|
|
39
|
+
## What it will expose
|
|
40
|
+
|
|
41
|
+
- **Logit-lens depth curves** — track any move's logit / probability / rank at every
|
|
42
|
+
readout point of the residual stream and watch it "snap" into the model's plan.
|
|
43
|
+
- **Causal ablation grids** — remove a single attention head's exact write and measure the
|
|
44
|
+
effect on a move, across the full block×head grid. Sign convention: `Δ = ablated − clean`,
|
|
45
|
+
so a **positive** Δ means the head was *suppressing* the move and a **negative** Δ means
|
|
46
|
+
it was *carrying* it.
|
|
47
|
+
- **Attention decomposition** — per-head attention maps split into geometry vs. semantics,
|
|
48
|
+
for asking *which* head routes *which* relationship on the board.
|
|
49
|
+
- **Skill-conditioned diffs** — for models with a skill/Elo embedding (e.g. MAIA), diff the
|
|
50
|
+
same position at two ratings, activation-by-activation, to see where expertise lives.
|
|
51
|
+
|
|
52
|
+
## Design
|
|
53
|
+
|
|
54
|
+
The coupling to any specific engine lives behind a small adapter (residual-stream readout
|
|
55
|
+
points, hookable forward pass, exact per-head writes, and a policy-logit decode). Any
|
|
56
|
+
square-token transformer with a from×to policy head can be plugged in — which is why the
|
|
57
|
+
roadmap is **MAIA-3 → Lc0-BT**, the two current members of that family.
|
|
58
|
+
|
|
59
|
+
## Roadmap
|
|
60
|
+
|
|
61
|
+
- [ ] `0.1` — MAIA-3 backend: logit lens, ablation grids, attention maps, skill diffs
|
|
62
|
+
- [ ] Lc0-BT backend (weight conversion + Smolgen handling)
|
|
63
|
+
- [ ] Interactive board-native visualizer
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT © 2026 David Litman
|
|
68
|
+
|
|
69
|
+
## Citing
|
|
70
|
+
|
|
71
|
+
If `chessformer_lens` contributes to published work, a citation helps others find it — see
|
|
72
|
+
`CITATION.cff` (GitHub's "Cite this repository" button) once the first release is out.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# chessformer_lens
|
|
2
|
+
|
|
3
|
+
**An interpretability lens for square-token chess transformers.**
|
|
4
|
+
|
|
5
|
+
`chessformer_lens` reads the *internals* of chess models that represent the board as
|
|
6
|
+
64 square tokens with a from×to policy head — the "chessformer" architecture family
|
|
7
|
+
(MAIA-3 today; [Leela Chess Zero](https://lczero.org)'s BT transformers next). It is to
|
|
8
|
+
chess transformers roughly what [TransformerLens](https://github.com/TransformerLensOrg/TransformerLens)
|
|
9
|
+
is to language models: instrumentation for looking at what the network computes, not just
|
|
10
|
+
what it plays.
|
|
11
|
+
|
|
12
|
+
> **Status: pre-alpha (`0.0.1`).** This release reserves the package name. The functional
|
|
13
|
+
> API is being extracted from a working MAIA-3 research harness and lands next. Watch the
|
|
14
|
+
> repo if you want the first usable cut.
|
|
15
|
+
|
|
16
|
+
## What it will expose
|
|
17
|
+
|
|
18
|
+
- **Logit-lens depth curves** — track any move's logit / probability / rank at every
|
|
19
|
+
readout point of the residual stream and watch it "snap" into the model's plan.
|
|
20
|
+
- **Causal ablation grids** — remove a single attention head's exact write and measure the
|
|
21
|
+
effect on a move, across the full block×head grid. Sign convention: `Δ = ablated − clean`,
|
|
22
|
+
so a **positive** Δ means the head was *suppressing* the move and a **negative** Δ means
|
|
23
|
+
it was *carrying* it.
|
|
24
|
+
- **Attention decomposition** — per-head attention maps split into geometry vs. semantics,
|
|
25
|
+
for asking *which* head routes *which* relationship on the board.
|
|
26
|
+
- **Skill-conditioned diffs** — for models with a skill/Elo embedding (e.g. MAIA), diff the
|
|
27
|
+
same position at two ratings, activation-by-activation, to see where expertise lives.
|
|
28
|
+
|
|
29
|
+
## Design
|
|
30
|
+
|
|
31
|
+
The coupling to any specific engine lives behind a small adapter (residual-stream readout
|
|
32
|
+
points, hookable forward pass, exact per-head writes, and a policy-logit decode). Any
|
|
33
|
+
square-token transformer with a from×to policy head can be plugged in — which is why the
|
|
34
|
+
roadmap is **MAIA-3 → Lc0-BT**, the two current members of that family.
|
|
35
|
+
|
|
36
|
+
## Roadmap
|
|
37
|
+
|
|
38
|
+
- [ ] `0.1` — MAIA-3 backend: logit lens, ablation grids, attention maps, skill diffs
|
|
39
|
+
- [ ] Lc0-BT backend (weight conversion + Smolgen handling)
|
|
40
|
+
- [ ] Interactive board-native visualizer
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT © 2026 David Litman
|
|
45
|
+
|
|
46
|
+
## Citing
|
|
47
|
+
|
|
48
|
+
If `chessformer_lens` contributes to published work, a citation helps others find it — see
|
|
49
|
+
`CITATION.cff` (GitHub's "Cite this repository" button) once the first release is out.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""chessformer_lens — an interpretability lens for square-token chess transformers.
|
|
2
|
+
|
|
3
|
+
Reads the internals of chess models that treat the board as 64 square tokens with a
|
|
4
|
+
from x to policy head (MAIA-3 today; Leela Chess Zero's BT transformers next):
|
|
5
|
+
|
|
6
|
+
* logit-lens curves for any move across all readout points (depth)
|
|
7
|
+
* per-head / per-(block, head) causal ablation grids (delta = ablated - clean,
|
|
8
|
+
so positive means the head SUPPRESSES the move)
|
|
9
|
+
* attention decomposition per head (geometry vs. semantics)
|
|
10
|
+
* skill-conditioned representation diffs (for models with an Elo embedding)
|
|
11
|
+
|
|
12
|
+
Status: pre-alpha. 0.0.1 reserves the name; the functional API lands next.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
try: # populated once the distribution is installed
|
|
16
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
17
|
+
|
|
18
|
+
__version__ = version("chessformer-lens")
|
|
19
|
+
except Exception: # running from a source checkout without an install
|
|
20
|
+
__version__ = "0.0.1"
|
|
21
|
+
|
|
22
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chessformer_lens
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An interpretability lens for square-token chess transformers (MAIA-3 backend; Lc0-BT next).
|
|
5
|
+
Author-email: David Litman <david.litman1@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/chessformer-lens/chessformer_lens
|
|
8
|
+
Project-URL: Repository, https://github.com/chessformer-lens/chessformer_lens
|
|
9
|
+
Project-URL: Issues, https://github.com/chessformer-lens/chessformer_lens/issues
|
|
10
|
+
Keywords: chess,transformer,mechanistic-interpretability,interpretability,maia,leela,lc0,attention,logit-lens,ablation
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Games/Entertainment :: Board Games
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# chessformer_lens
|
|
25
|
+
|
|
26
|
+
**An interpretability lens for square-token chess transformers.**
|
|
27
|
+
|
|
28
|
+
`chessformer_lens` reads the *internals* of chess models that represent the board as
|
|
29
|
+
64 square tokens with a from×to policy head — the "chessformer" architecture family
|
|
30
|
+
(MAIA-3 today; [Leela Chess Zero](https://lczero.org)'s BT transformers next). It is to
|
|
31
|
+
chess transformers roughly what [TransformerLens](https://github.com/TransformerLensOrg/TransformerLens)
|
|
32
|
+
is to language models: instrumentation for looking at what the network computes, not just
|
|
33
|
+
what it plays.
|
|
34
|
+
|
|
35
|
+
> **Status: pre-alpha (`0.0.1`).** This release reserves the package name. The functional
|
|
36
|
+
> API is being extracted from a working MAIA-3 research harness and lands next. Watch the
|
|
37
|
+
> repo if you want the first usable cut.
|
|
38
|
+
|
|
39
|
+
## What it will expose
|
|
40
|
+
|
|
41
|
+
- **Logit-lens depth curves** — track any move's logit / probability / rank at every
|
|
42
|
+
readout point of the residual stream and watch it "snap" into the model's plan.
|
|
43
|
+
- **Causal ablation grids** — remove a single attention head's exact write and measure the
|
|
44
|
+
effect on a move, across the full block×head grid. Sign convention: `Δ = ablated − clean`,
|
|
45
|
+
so a **positive** Δ means the head was *suppressing* the move and a **negative** Δ means
|
|
46
|
+
it was *carrying* it.
|
|
47
|
+
- **Attention decomposition** — per-head attention maps split into geometry vs. semantics,
|
|
48
|
+
for asking *which* head routes *which* relationship on the board.
|
|
49
|
+
- **Skill-conditioned diffs** — for models with a skill/Elo embedding (e.g. MAIA), diff the
|
|
50
|
+
same position at two ratings, activation-by-activation, to see where expertise lives.
|
|
51
|
+
|
|
52
|
+
## Design
|
|
53
|
+
|
|
54
|
+
The coupling to any specific engine lives behind a small adapter (residual-stream readout
|
|
55
|
+
points, hookable forward pass, exact per-head writes, and a policy-logit decode). Any
|
|
56
|
+
square-token transformer with a from×to policy head can be plugged in — which is why the
|
|
57
|
+
roadmap is **MAIA-3 → Lc0-BT**, the two current members of that family.
|
|
58
|
+
|
|
59
|
+
## Roadmap
|
|
60
|
+
|
|
61
|
+
- [ ] `0.1` — MAIA-3 backend: logit lens, ablation grids, attention maps, skill diffs
|
|
62
|
+
- [ ] Lc0-BT backend (weight conversion + Smolgen handling)
|
|
63
|
+
- [ ] Interactive board-native visualizer
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT © 2026 David Litman
|
|
68
|
+
|
|
69
|
+
## Citing
|
|
70
|
+
|
|
71
|
+
If `chessformer_lens` contributes to published work, a citation helps others find it — see
|
|
72
|
+
`CITATION.cff` (GitHub's "Cite this repository" button) once the first release is out.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chessformer_lens
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chessformer_lens"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "An interpretability lens for square-token chess transformers (MAIA-3 backend; Lc0-BT next)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "David Litman", email = "david.litman1@gmail.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"chess",
|
|
15
|
+
"transformer",
|
|
16
|
+
"mechanistic-interpretability",
|
|
17
|
+
"interpretability",
|
|
18
|
+
"maia",
|
|
19
|
+
"leela",
|
|
20
|
+
"lc0",
|
|
21
|
+
"attention",
|
|
22
|
+
"logit-lens",
|
|
23
|
+
"ablation",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
27
|
+
"Intended Audience :: Science/Research",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
|
+
"Topic :: Games/Entertainment :: Board Games",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
# Runtime deps are intentionally omitted from the 0.0.1 name-reservation build.
|
|
37
|
+
# They land with the first functional release (torch, chess, matplotlib, ...).
|
|
38
|
+
dependencies = []
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/chessformer-lens/chessformer_lens"
|
|
42
|
+
Repository = "https://github.com/chessformer-lens/chessformer_lens"
|
|
43
|
+
Issues = "https://github.com/chessformer-lens/chessformer_lens/issues"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
include = ["chessformer_lens*"]
|