actopo — Activation Topology
Reproducible persistent-homology measurement of LLM activation manifolds.
actopo provides one measurement protocol, one activation-extraction
function, and one topology implementation, so β₁ / survival / PHI numbers
stay consistent across every experiment. It is the tooling behind the
Mathematical Life paper, packaged so the experiments can be reproduced.
Why
Re-implementing "compute β₁" in each analysis script lets the measurement
silently diverge (different ε thresholds, wrong last-token extraction, etc.).
actopo centralises the protocol in a single ProtocolConfig and stamps every
result with the exact config + version + git revision that produced it.
Install
pip install actopo # topology layer (CPU only)
pip install "actopo[extract]" # + activation extraction (torch/transformers)
pip install "actopo[all]" # everything incl. dev/test
Quickstart
The package ships a tiny real example: reasoning activations from Qwen2.5-0.5B (base) vs Qwen2.5-0.5B-Instruct — the paper's core base-vs-instruct comparison.
from actopo import FROZEN_V5, measure
from actopo.metrics import union_test, center_distance
from actopo.data import load_example_cloud
base = load_example_cloud("base") # (600, 896) reasoning activations
inst = load_example_cloud("instruct")
print(measure(base, FROZEN_V5).beta1) # 12
print(measure(inst, FROZEN_V5).beta1) # 50 → alignment EXPANDS β₁ here
# base and instruct occupy the SAME topological region (β₁ changes within it):
u = union_test(base, inst, FROZEN_V5, independent_eps=True)
print(u["verdict"]) # SHARED
print(center_distance(base, inst)) # 0.62
Extract your own activations (needs actopo[extract])
from actopo import FROZEN_V5, measure
from actopo.models import load_model
from actopo.extract import extract_activations
model, tok = load_model("Qwen/Qwen2.5-0.5B", FROZEN_V5)
acts = extract_activations(model, tok, my_prompts, FROZEN_V5) # correct last-token
print(measure(acts, FROZEN_V5).beta1)
Every result can be stamped + verified against the frozen protocol:
from actopo import save_result, verify, load_result, FROZEN_V5
save_result("out.json", {"beta1": 12}, FROZEN_V5)
assert verify(load_result("out.json"), FROZEN_V5) == [] # produced on-protocol
The frozen protocol (FROZEN_V5)
| Parameter | Value |
|---|---|
| β₁ threshold | lifetime > 0.03 × ε_max |
| survival/PHI threshold | lifetime > 0.01 × ε_max |
| layer | L/2 |
| token | last (attention-mask based) |
| point cloud | 1319 prompts |
| PH backend | ripser, maxdim=1, euclidean |
See actopo.protocol.ProtocolConfig for the full, documented field set.
License
MIT.
Metadata
Release files for actopo 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| actopo-0.1.0.tar.gz | 2.0 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| actopo-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.0 MB
Release files / actopo-0.1.0.tar.gz
| Download URL | actopo-0.1.0.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc8f487c4104fbb85d9fbe77881d7ed3cc2c2ef8410c2fd74e6261b30752824f
|
|
BLAKE2b-256 checksum How to use checksums |
d930a5bc31ea1f9790e2e9af0550d8c8db718052761c4f6a012d14d256f5d797
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / actopo-0.1.0-py3-none-any.whl
| Download URL | actopo-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b20abba249e7be8957e823d66651b33a115ed500fa0efc80981f2fba663c091d
|
|
BLAKE2b-256 checksum How to use checksums |
65d4a41b4f5f66fcf2c8d63c2d67d2a530dd70052adc82e5fd6fafa204776c75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for actopo 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.