self-learning-model
Models whose weights change while they run. Predict → get surprised → rewrite a small, bounded part of yourself → never forget the base. Proven with falsifiable experiments (PROOF.md, p ≤ 4e-04).
pip install self-learning-model # zero-dependency core
pip install "self-learning-model[qwen]" # + the self-learning Qwen3-VL runtime
1 · Strands-expert Qwen3-VL-2B that keeps learning
A Qwen3-VL-2B post-tuned on the entire strands-agents codebase (strands probes NLL 4.85 → 2.22, 8/8 improved), plus a plastic layer that adapts at inference — with a provable off-switch.
from slm.qwen import StrandsPlasticQwen # needs [qwen] + HF_TOKEN
m = StrandsPlasticQwen.from_pretrained() # cagataydev/strands-qwen3-vl-2b
print(m.chat("How do I create a custom tool in Strands Agents?"))
for doc in your_stream:
m.observe(doc, learn=True) # predicts; if surprised, rewrites its fast weights
m.reset() # exactly back to the strands-expert base
Verified: continual out-of-distribution stream NLL 6.18 → 5.37 while strands
expertise is untouched (Δ −0.01). Model: cagataydev/strands-qwen3-vl-2b (private).
2 · Zero-dependency core (Python + browser, bit-identical)
The mechanism in ~600 lines of stdlib Python, mirrored in vanilla JS (Δ≈1e-15):
from slm import SelfLearningLM
lm = SelfLearningLM.from_pretrained("cagataydev/self-learning-model")
lm.observe("novel text", learn=True) # weights change — no training step
Live demo: docs/index.html — watch a transformer's weight matrix rewrite itself in your browser as it reads.
Is it really learning? Yes — proven.
Six skeptic attacks, six closed doors (PROOF.md):
| attack | test | result |
|---|---|---|
| "it memorized the stream" | freeze → eval on unseen inputs | err 0.665→0.044, 20/20 |
| "knowledge is in optimizer state" | transplant weights into virgin body | identical, Δ=0 |
| "any perturbation helps" | same-norm random-direction updates | no learning |
| "the update process is the trick" | shuffled-target control | no learning |
| "black box" | decode M_eff vs true W* |
correlation 0.005→0.943 |
| "toy result" | real frozen GPT, held-out docs, info-ladder controls | p=4.0e-04 |
Honest negatives included: single-prompt in-context (softmax attention already wins), emergent in-context learning at tiny scale, and the finding that ~⅓ of naive test-time-training gains are mere calibration — a confound we control for.
How it works
frozen base (instinct — never updated, can't forget)
+ tiny plastic LoRA (experience — updated every step at inference)
+ surprise gate (learn only when wrong) + EMA decay (bounded, stable)
loss = next-observation prediction error ← the free label from reality
The stability–plasticity dilemma is resolved by the decay: without it the model learns hard but forgets (retention +7.09); with it, it learns and retains (+0.03).
More
| PROOF.md | the proof of learning, exact statistics |
| RESULTS.md | all experiments E0–E7b, incl. negatives |
| ARCHITECTURE.md / PLASTIC.md / SCIENCE.md | design, delta-rule method, protocol |
| strands_tune/ · qwen_plastic/ | Qwen training & eval pipelines |
| BROWSER.md · web/ | the zero-dep browser story |
Built on ideas from TTT (Sun et al.), Titans (Behrouz et al.), fast-weight programmers (Schmidhuber), DeltaNet — and @karpathy's atomic GPT.
MIT.
Metadata
Release files for self-learning-model 0.2.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 | Actions |
|---|---|---|---|---|
| self_learning_model-0.2.0.tar.gz | 25.9 kB | Without provenance | Details for self_learning_model-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| self_learning_model-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for self_learning_model-0.2.0-py3-none-any.whl |
Total release size: 55.8 kB
Release files / self_learning_model-0.2.0.tar.gz
| Download URL | self_learning_model-0.2.0.tar.gz |
|---|---|
| Size | 25.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b453554bdb786841b8a442f2fa2a4d157a90959c41fada0ef485037e1a0402cf
|
|
BLAKE2b-256 checksum How to use checksums |
103dcb6edcae2de9cfd24e0b57008086465ebe05a0de449c643fa3e12168a9bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / self_learning_model-0.2.0-py3-none-any.whl
| Download URL | self_learning_model-0.2.0-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fb964a2edf3243cff0d33da6a728c1f1f1f07d3e300b2a8f6d221b8f08ea833
|
|
BLAKE2b-256 checksum How to use checksums |
d91913a65a31e225646115002e6c74cae278a18d744a01ba5b4f38286349ced8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for self-learning-model 0.2.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.