LexFrame: Lexical Reference Frames
A toolkit for interpreting LM residual streams in their native semantics.
LexFrame reads a hidden state the way the model reads it, in the model's own vocabulary. It is model-native: the state is transported layer by layer through the model's own remaining layers, with nothing fitted to the output. It is context-aware: along the way the state attends to its prefix, for a chosen number of rounds of attention.
Quick start
pip install lexframe
import lexframe as lf
frame = lf.LexFrame(model, tokenizer).init(texts) # a loaded Hugging Face model; texts: any unlabelled text
c = frame.view("The Eiffel Tower is located in the city of", k=5)
c.tokens # the top 5 tokens of every layer at every position
docs/USAGE.md lists every command, and demo.py walks through them: where SmolLM3 decides that the Eiffel Tower is in Paris, who wrote that decision, and how to change it.
Citation
@article{gu2026lexframe,
title = {Lexical Reference Frames: Interpreting LM Residual Streams in Native Semantics},
author = {Gu, Jian and Zhang, Hongyu and Chen, Chunyang and Aleti, Aldeida},
journal = {arXiv preprint arXiv:2610.22169},
year = {2026}
}
Licensed under the Apache License 2.0.
Metadata
Release files for lexframe 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lexframe-0.1.1.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lexframe-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.0 kB
Release files / lexframe-0.1.1.tar.gz
| Download URL | lexframe-0.1.1.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
503112b4d1da4a6d14010c6411ed136b09cb0d7732d119a153eaaf4f70f9f9ba
|
|
BLAKE2b-256 checksum How to use checksums |
a7d49994e8e0d74eff56c956b6c014b15904271516e08b7eb143c39afe7d1404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.
Transparency logRelease files / lexframe-0.1.1-py3-none-any.whl
| Download URL | lexframe-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35b6a02eae7409b5bd918825594312604514a20ee3f51f1086e437b2123a3a6d
|
|
BLAKE2b-256 checksum How to use checksums |
5d4e0922c2303643d5565cac47d281a720602bf6aa5e1b3eb34cb0ce8bdf812b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.
Transparency log