revisionlab 0.1.0__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.
- revisionlab-0.1.0/.github/workflows/ci.yml +55 -0
- revisionlab-0.1.0/.gitignore +16 -0
- revisionlab-0.1.0/CODE_OF_CONDUCT.md +11 -0
- revisionlab-0.1.0/CONTRIBUTING.md +77 -0
- revisionlab-0.1.0/LICENSE +21 -0
- revisionlab-0.1.0/PKG-INFO +109 -0
- revisionlab-0.1.0/README.md +85 -0
- revisionlab-0.1.0/STATE.md +28 -0
- revisionlab-0.1.0/docs/evidence/INDEPENDENT_VERIFICATION.json +2598 -0
- revisionlab-0.1.0/docs/evidence/README.md +10 -0
- revisionlab-0.1.0/docs/evidence/SELECTION_LOCK.json +350 -0
- revisionlab-0.1.0/docs/evidence/SUMMARY.json +1323 -0
- revisionlab-0.1.0/docs/evidence/v13-source-sha256.json +52 -0
- revisionlab-0.1.0/docs/methods.md +41 -0
- revisionlab-0.1.0/docs/provenance.md +35 -0
- revisionlab-0.1.0/docs/release-notes-v0.1.0.md +26 -0
- revisionlab-0.1.0/docs/releasing.md +20 -0
- revisionlab-0.1.0/docs/source-audit.md +22 -0
- revisionlab-0.1.0/docs/verification.md +30 -0
- revisionlab-0.1.0/examples/delayed_forecast.py +22 -0
- revisionlab-0.1.0/pyproject.toml +56 -0
- revisionlab-0.1.0/src/revisionlab/__init__.py +19 -0
- revisionlab-0.1.0/src/revisionlab/baselines.py +148 -0
- revisionlab-0.1.0/src/revisionlab/diagnostics.py +42 -0
- revisionlab-0.1.0/src/revisionlab/memory.py +195 -0
- revisionlab-0.1.0/src/revisionlab/protocols.py +123 -0
- revisionlab-0.1.0/src/revisionlab/py.typed +0 -0
- revisionlab-0.1.0/src/revisionlab/replay.py +204 -0
- revisionlab-0.1.0/src/revisionlab/serialization.py +113 -0
- revisionlab-0.1.0/src/revisionlab/smoke.py +97 -0
- revisionlab-0.1.0/tests/test_baselines.py +109 -0
- revisionlab-0.1.0/tests/test_core.py +298 -0
- revisionlab-0.1.0/tests/test_replay.py +237 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
env:
|
|
14
|
+
OMP_NUM_THREADS: "1"
|
|
15
|
+
MKL_NUM_THREADS: "1"
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python: ["3.10", "3.11", "3.12"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python }}
|
|
25
|
+
cache: pip
|
|
26
|
+
- name: Install CPU runtime and development tools
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
30
|
+
python -m pip install -e ".[dev]"
|
|
31
|
+
- name: Lint and formatting
|
|
32
|
+
run: |
|
|
33
|
+
python -m ruff check .
|
|
34
|
+
python -m ruff format --check .
|
|
35
|
+
- name: Types
|
|
36
|
+
run: python -m mypy src/revisionlab
|
|
37
|
+
- name: Contracts, diagnostics, compile, and serialization
|
|
38
|
+
run: python -m pytest
|
|
39
|
+
- name: Build and validate distributions
|
|
40
|
+
run: |
|
|
41
|
+
python -m build
|
|
42
|
+
python -m twine check dist/*
|
|
43
|
+
- name: Install wheel outside source checkout
|
|
44
|
+
shell: bash
|
|
45
|
+
run: |
|
|
46
|
+
python -m pip uninstall -y revisionlab
|
|
47
|
+
python -m pip install --no-deps dist/*.whl
|
|
48
|
+
smoke_dir=$(mktemp -d)
|
|
49
|
+
cd "$smoke_dir"
|
|
50
|
+
python -c "from pathlib import Path; import revisionlab; path=Path(revisionlab.__file__).resolve(); assert 'site-packages' in path.parts and 'src' not in path.parts, path; print(path)"
|
|
51
|
+
revisionlab-check
|
|
52
|
+
- uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: distributions-py${{ matrix.python }}
|
|
55
|
+
path: dist/*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
We welcome contributors of all backgrounds and experience levels. Treat people with respect, give constructive feedback, and focus disagreements on evidence and ideas.
|
|
4
|
+
|
|
5
|
+
Harassment, threats, discriminatory language, sexual attention, personal attacks, and disclosure of private information without permission are unacceptable. Listen to criticism, acknowledge mistakes, respect boundaries, and consider the effects of your words.
|
|
6
|
+
|
|
7
|
+
This code applies in project spaces and when representing the project publicly. Maintainers may remove harmful content, warn contributors, or restrict participation, considering context, impact, and repetition. Maintainers follow the same standards.
|
|
8
|
+
|
|
9
|
+
For an incident, contact a repository maintainer through an available private GitHub channel. If no private channel is available, open an issue requesting private contact without sensitive details. Use GitHub private vulnerability reporting for security issues when enabled. Do not post private incident details publicly. Maintainers should protect reporter privacy and explain enforcement decisions where appropriate.
|
|
10
|
+
|
|
11
|
+
Adapted from [Contributor Covenant 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Keep delayed-feedback behavior explicit. A corrector should be easy to replace without changing ticket issuance, maturity checks, or how forecasts are evaluated.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Use Python 3.10 or newer:
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
python -m pip install -e ".[dev]"
|
|
11
|
+
revisionlab-check
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Add a corrector in five minutes
|
|
15
|
+
|
|
16
|
+
1. Implement `read(key)`, `write(evidence)`, and `snapshot()` using the memory protocol.
|
|
17
|
+
2. Return a finite scalar correction from `read`; check key shape and finite values before updating.
|
|
18
|
+
3. Make `write` atomic: validate a candidate before committing it, and preserve state/counters if it fails.
|
|
19
|
+
4. Return copied state from `snapshot`.
|
|
20
|
+
5. Supply your corrector to generic `DelayedReplay` and test an issued ticket, exact maturity, duplicate release, and foreign owner.
|
|
21
|
+
|
|
22
|
+
Start with [examples/delayed_forecast.py](examples/delayed_forecast.py). Import `DelayedReplay` from `revisionlab.replay`; its constructor accepts your memory plus a horizon. `issue(issue_hour, base_prediction, read_key)` returns a ticket, and `release(ticket.ticket_id, target, now_hour)` evaluates the issued forecast before settling its update. Low-level correctors may apply repeated `write` calls; the runner owns exactly-once enforcement. Checkpoint helpers live in `revisionlab.serialization`.
|
|
23
|
+
|
|
24
|
+
This runnable custom bias corrector ignores the key and learns only a global residual offset:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import math
|
|
28
|
+
import numpy as np
|
|
29
|
+
from revisionlab.replay import DelayedReplay
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class BiasCorrector:
|
|
33
|
+
def __init__(self):
|
|
34
|
+
self.value = 0.0
|
|
35
|
+
|
|
36
|
+
def read(self, key):
|
|
37
|
+
return self.value
|
|
38
|
+
|
|
39
|
+
def write(self, evidence):
|
|
40
|
+
residual = evidence.target - evidence.ticket.base_prediction
|
|
41
|
+
candidate = self.value + 0.1 * (residual - self.value)
|
|
42
|
+
if not math.isfinite(candidate):
|
|
43
|
+
raise ValueError("Nonfinite candidate")
|
|
44
|
+
self.value = candidate
|
|
45
|
+
|
|
46
|
+
def snapshot(self):
|
|
47
|
+
return {"value": self.value}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
runner = DelayedReplay(BiasCorrector(), horizon=2)
|
|
51
|
+
ticket = runner.issue(0, 1.0, np.array([1.0]))
|
|
52
|
+
assert runner.release(ticket.ticket_id, target=2.0, now_hour=2) == 1.0
|
|
53
|
+
assert runner.memory.snapshot() == {"value": 0.1}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Built-in checkpoint helpers support only `ResidualMemory`, `RLS_Corrector`, `NoWrite`, and `ShuffledWrite`. They reject custom correctors; `snapshot()` alone is not a resumable checkpoint contract. Supporting your custom corrector's persistence is separate work, not a five-minute registration promise.
|
|
57
|
+
|
|
58
|
+
Use a negative control name that describes what it does. No-write and shuffled-write controls must not be described as trained alternatives or evidence of improved memory. Keep prediction-time keys and issued forecasts fixed when feedback arrives; do not recompute past forecasts using current state.
|
|
59
|
+
|
|
60
|
+
The runner retains settled IDs for lifetime duplicate detection. Include that growing ledger and pending tickets in memory accounting instead of reporting only the fixed corrector state.
|
|
61
|
+
|
|
62
|
+
For a new rule, document its equation, forgetting/rate settings, clipping, initialization, state budget, and supported inputs. Distinguish a local residual update from full-model gradients. Compare identical inputs, baseline predictions, and released labels while scoring each policy's own actual issued forecast.
|
|
63
|
+
|
|
64
|
+
## Checks
|
|
65
|
+
|
|
66
|
+
```powershell
|
|
67
|
+
python -m ruff check .
|
|
68
|
+
python -m ruff format --check .
|
|
69
|
+
python -m mypy src/revisionlab
|
|
70
|
+
python -m pytest
|
|
71
|
+
python -m build
|
|
72
|
+
python -m twine check dist/*
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Tests should expose causal leakage, failed-write mutation, duplicate settlement, and restore differences. Passing the original happy-path suite is insufficient: [the source audit](docs/source-audit.md) records failures found after 23 original tests passed. A separate reviewer evaluates author changes; authors do not self-approve.
|
|
76
|
+
|
|
77
|
+
Do not add raw weather data, large checkpoints, credentials, or generated environments to the package. Keep historical receipts separate from newly executed results. Follow [the Code of Conduct](CODE_OF_CONDUCT.md).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cjw0076 and RevisionLab contributors
|
|
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,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: revisionlab
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PyTorch-native delayed-feedback memory contracts, controls, and diagnostics
|
|
5
|
+
Project-URL: Repository, https://github.com/cjw0076/revisionlab
|
|
6
|
+
Project-URL: Issues, https://github.com/cjw0076/revisionlab/issues
|
|
7
|
+
Author: cjw0076
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: numpy>=1.24
|
|
15
|
+
Requires-Dist: torch>=2.2
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
18
|
+
Requires-Dist: hatch>=1.13; extra == 'dev'
|
|
19
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
20
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
22
|
+
Requires-Dist: twine>=5; extra == 'dev'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# RevisionLab
|
|
26
|
+
|
|
27
|
+
**PyTorch-native delayed-feedback memory contracts, controls, and diagnostics.**
|
|
28
|
+
|
|
29
|
+
RevisionLab records a prediction when it is issued, waits for its outcome to mature, and applies a residual-state update to the memory that owned the prediction. It provides a small substrate for testing delayed correction: immutable tickets, explicit memory interfaces, replay, negative controls, and resumable state.
|
|
30
|
+
|
|
31
|
+
v0.1 focuses on fixed-capacity residual memory and RLS correction. It does not implement Cosmos v14 state splitting or the v10 learned-refinement toy. It makes no claim to support every neural architecture. [archcredit](https://github.com/cjw0076/archcredit) remains a separate architecture/credit benchmark library; RevisionLab does not depend on it.
|
|
32
|
+
|
|
33
|
+
## Install and check
|
|
34
|
+
|
|
35
|
+
From a checkout with Python 3.10 or newer:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
python -m pip install -e ".[dev]"
|
|
39
|
+
revisionlab-check
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The check runs a small synthetic delayed-feedback example. It does not download weather data or replay the historical experiment.
|
|
43
|
+
|
|
44
|
+
## Minimal API
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import numpy as np
|
|
48
|
+
from revisionlab import ResidualMemory
|
|
49
|
+
from revisionlab.replay import DelayedReplay
|
|
50
|
+
|
|
51
|
+
runner = DelayedReplay(ResidualMemory(2, rate=0.1), horizon=2)
|
|
52
|
+
ticket = runner.issue(0, 1.0, np.array([1.0, 0.0]))
|
|
53
|
+
error = runner.release(ticket.ticket_id, target=2.0, now_hour=2)
|
|
54
|
+
assert ticket.prediction == 1.0
|
|
55
|
+
assert error == 1.0
|
|
56
|
+
assert runner.memory.read(np.array([1.0, 0.0])) == 0.1
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See [examples/delayed_forecast.py](examples/delayed_forecast.py) for a complete replay example. `revisionlab.serialization.save_checkpoint(path, runner)` and `load_checkpoint(path)` preserve delayed-feedback runners using the four native built-in correctors. Custom correctors and the NumPy reference are not supported by these checkpoint helpers in v0.1.
|
|
60
|
+
|
|
61
|
+
## Contracts
|
|
62
|
+
|
|
63
|
+
| Boundary | Purpose |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| Prediction ticket | Keeps prediction-time key, baseline, actual forecast, maturity, and owner identity. |
|
|
66
|
+
| Released evidence | Rejects targets that have not matured and invalid timestamp/target fields. |
|
|
67
|
+
| Memory `read`/`write`/`snapshot` | Reads a correction, applies valid delayed evidence, and copies state. |
|
|
68
|
+
| `DelayedReplay` | Owns tickets, evaluates the issued forecast, and settles feedback exactly once. |
|
|
69
|
+
| Checkpoint | Preserves memory, replay owner, pending tickets, and settled identities for resume. |
|
|
70
|
+
| Local alignment | Compares a correction update with a local residual-loss reference direction. |
|
|
71
|
+
|
|
72
|
+
The NumPy reference and PyTorch-native implementations use fixed-capacity state. Negative controls are explicitly named; shuffled writes corrupt write addressing rather than demonstrating a new learning rule. A no-write control must preserve zero correction and perform no learning.
|
|
73
|
+
|
|
74
|
+
`ResidualMemory(slots, rate)` is the native normalized-delta corrector. `revisionlab.baselines` provides `RLS_Corrector(slots, forget)`, `NoWrite(slots)`, and `ShuffledWrite(slots, rate, seed=...)`. See [the method manifest](docs/methods.md) for equations and clipping. Low-level memory `write` applies each valid call; **exactly-once settlement is a `DelayedReplay` guarantee**, not a guarantee of direct memory writes. Tickets retain prediction-time keys and forecasts, and the runner rejects duplicate/foreign settlement.
|
|
75
|
+
|
|
76
|
+
Memory values have fixed capacity. Replay retains settled ticket identities for lifetime deduplication, so its total audit ledger grows with settled forecasts; report that overhead alongside pending tickets. Do not call the entire runner constant-memory.
|
|
77
|
+
|
|
78
|
+
## What the evidence means
|
|
79
|
+
|
|
80
|
+
Recovered v13 artifacts report the following historical mean joint MSE:
|
|
81
|
+
|
|
82
|
+
| Historical policy | Mean joint MSE |
|
|
83
|
+
| --- | ---: |
|
|
84
|
+
| Frozen baseline | 2.122014 |
|
|
85
|
+
| Native live residual | 2.092176 |
|
|
86
|
+
| Live RLS | 2.070044 |
|
|
87
|
+
|
|
88
|
+
These are prior-run receipts for one site and the first half of 2026, across five weight seeds. The residual method improved on the frozen baseline in that recorded setting, while RLS had the lower mean MSE. This release has not rerun the full weather experiment, established superiority over RLS, or demonstrated generalization to other climates. See [provenance](docs/provenance.md) and [historical evidence](docs/evidence/README.md).
|
|
89
|
+
|
|
90
|
+
The original shuffled-write policy used a fixed cyclic permutation. The release's seeded `ShuffledWrite` control is a distinct policy and does not reproduce that historical control automatically.
|
|
91
|
+
|
|
92
|
+
Local residual alignment `rho` is not full-model BPTT alignment. The delta primitive is differentiable, but that alone does not prove correct global credit assignment or causal memory capacity. Zero-norm directions have undefined alignment.
|
|
93
|
+
|
|
94
|
+
## Development and contribution
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
97
|
+
python -m ruff check .
|
|
98
|
+
python -m ruff format --check .
|
|
99
|
+
python -m mypy src/revisionlab
|
|
100
|
+
python -m pytest
|
|
101
|
+
python -m build
|
|
102
|
+
python -m twine check dist/*
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) explains the five-minute corrector recipe. CI covers Python 3.10/3.11/3.12, lint/format, types, tests, `aot_eager` compile/serialization/gradcheck, and wheel installation outside the checkout. A CI definition is not a claim that hosted jobs have already passed; current receipts belong in [STATE.md](STATE.md).
|
|
106
|
+
|
|
107
|
+
See [release steps](docs/releasing.md) for TestPyPI/PyPI handoff and [the source audit](docs/source-audit.md) for adversarial regression requirements. No PyPI upload automation is configured. Licensed under [MIT](LICENSE); participation follows the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
108
|
+
|
|
109
|
+
Local v0.1.0 validation: **95 tests passed, 1 CUDA hardware skip**; lint/format, strict package types, and separate reviews passed. See [verification evidence](docs/verification.md) and [release notes](docs/release-notes-v0.1.0.md). Hosted and publication receipts are recorded separately.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# RevisionLab
|
|
2
|
+
|
|
3
|
+
**PyTorch-native delayed-feedback memory contracts, controls, and diagnostics.**
|
|
4
|
+
|
|
5
|
+
RevisionLab records a prediction when it is issued, waits for its outcome to mature, and applies a residual-state update to the memory that owned the prediction. It provides a small substrate for testing delayed correction: immutable tickets, explicit memory interfaces, replay, negative controls, and resumable state.
|
|
6
|
+
|
|
7
|
+
v0.1 focuses on fixed-capacity residual memory and RLS correction. It does not implement Cosmos v14 state splitting or the v10 learned-refinement toy. It makes no claim to support every neural architecture. [archcredit](https://github.com/cjw0076/archcredit) remains a separate architecture/credit benchmark library; RevisionLab does not depend on it.
|
|
8
|
+
|
|
9
|
+
## Install and check
|
|
10
|
+
|
|
11
|
+
From a checkout with Python 3.10 or newer:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
python -m pip install -e ".[dev]"
|
|
15
|
+
revisionlab-check
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The check runs a small synthetic delayed-feedback example. It does not download weather data or replay the historical experiment.
|
|
19
|
+
|
|
20
|
+
## Minimal API
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
import numpy as np
|
|
24
|
+
from revisionlab import ResidualMemory
|
|
25
|
+
from revisionlab.replay import DelayedReplay
|
|
26
|
+
|
|
27
|
+
runner = DelayedReplay(ResidualMemory(2, rate=0.1), horizon=2)
|
|
28
|
+
ticket = runner.issue(0, 1.0, np.array([1.0, 0.0]))
|
|
29
|
+
error = runner.release(ticket.ticket_id, target=2.0, now_hour=2)
|
|
30
|
+
assert ticket.prediction == 1.0
|
|
31
|
+
assert error == 1.0
|
|
32
|
+
assert runner.memory.read(np.array([1.0, 0.0])) == 0.1
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See [examples/delayed_forecast.py](examples/delayed_forecast.py) for a complete replay example. `revisionlab.serialization.save_checkpoint(path, runner)` and `load_checkpoint(path)` preserve delayed-feedback runners using the four native built-in correctors. Custom correctors and the NumPy reference are not supported by these checkpoint helpers in v0.1.
|
|
36
|
+
|
|
37
|
+
## Contracts
|
|
38
|
+
|
|
39
|
+
| Boundary | Purpose |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| Prediction ticket | Keeps prediction-time key, baseline, actual forecast, maturity, and owner identity. |
|
|
42
|
+
| Released evidence | Rejects targets that have not matured and invalid timestamp/target fields. |
|
|
43
|
+
| Memory `read`/`write`/`snapshot` | Reads a correction, applies valid delayed evidence, and copies state. |
|
|
44
|
+
| `DelayedReplay` | Owns tickets, evaluates the issued forecast, and settles feedback exactly once. |
|
|
45
|
+
| Checkpoint | Preserves memory, replay owner, pending tickets, and settled identities for resume. |
|
|
46
|
+
| Local alignment | Compares a correction update with a local residual-loss reference direction. |
|
|
47
|
+
|
|
48
|
+
The NumPy reference and PyTorch-native implementations use fixed-capacity state. Negative controls are explicitly named; shuffled writes corrupt write addressing rather than demonstrating a new learning rule. A no-write control must preserve zero correction and perform no learning.
|
|
49
|
+
|
|
50
|
+
`ResidualMemory(slots, rate)` is the native normalized-delta corrector. `revisionlab.baselines` provides `RLS_Corrector(slots, forget)`, `NoWrite(slots)`, and `ShuffledWrite(slots, rate, seed=...)`. See [the method manifest](docs/methods.md) for equations and clipping. Low-level memory `write` applies each valid call; **exactly-once settlement is a `DelayedReplay` guarantee**, not a guarantee of direct memory writes. Tickets retain prediction-time keys and forecasts, and the runner rejects duplicate/foreign settlement.
|
|
51
|
+
|
|
52
|
+
Memory values have fixed capacity. Replay retains settled ticket identities for lifetime deduplication, so its total audit ledger grows with settled forecasts; report that overhead alongside pending tickets. Do not call the entire runner constant-memory.
|
|
53
|
+
|
|
54
|
+
## What the evidence means
|
|
55
|
+
|
|
56
|
+
Recovered v13 artifacts report the following historical mean joint MSE:
|
|
57
|
+
|
|
58
|
+
| Historical policy | Mean joint MSE |
|
|
59
|
+
| --- | ---: |
|
|
60
|
+
| Frozen baseline | 2.122014 |
|
|
61
|
+
| Native live residual | 2.092176 |
|
|
62
|
+
| Live RLS | 2.070044 |
|
|
63
|
+
|
|
64
|
+
These are prior-run receipts for one site and the first half of 2026, across five weight seeds. The residual method improved on the frozen baseline in that recorded setting, while RLS had the lower mean MSE. This release has not rerun the full weather experiment, established superiority over RLS, or demonstrated generalization to other climates. See [provenance](docs/provenance.md) and [historical evidence](docs/evidence/README.md).
|
|
65
|
+
|
|
66
|
+
The original shuffled-write policy used a fixed cyclic permutation. The release's seeded `ShuffledWrite` control is a distinct policy and does not reproduce that historical control automatically.
|
|
67
|
+
|
|
68
|
+
Local residual alignment `rho` is not full-model BPTT alignment. The delta primitive is differentiable, but that alone does not prove correct global credit assignment or causal memory capacity. Zero-norm directions have undefined alignment.
|
|
69
|
+
|
|
70
|
+
## Development and contribution
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
python -m ruff check .
|
|
74
|
+
python -m ruff format --check .
|
|
75
|
+
python -m mypy src/revisionlab
|
|
76
|
+
python -m pytest
|
|
77
|
+
python -m build
|
|
78
|
+
python -m twine check dist/*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) explains the five-minute corrector recipe. CI covers Python 3.10/3.11/3.12, lint/format, types, tests, `aot_eager` compile/serialization/gradcheck, and wheel installation outside the checkout. A CI definition is not a claim that hosted jobs have already passed; current receipts belong in [STATE.md](STATE.md).
|
|
82
|
+
|
|
83
|
+
See [release steps](docs/releasing.md) for TestPyPI/PyPI handoff and [the source audit](docs/source-audit.md) for adversarial regression requirements. No PyPI upload automation is configured. Licensed under [MIT](LICENSE); participation follows the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
84
|
+
|
|
85
|
+
Local v0.1.0 validation: **95 tests passed, 1 CUDA hardware skip**; lint/format, strict package types, and separate reviews passed. See [verification evidence](docs/verification.md) and [release notes](docs/release-notes-v0.1.0.md). Hosted and publication receipts are recorded separately.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# RevisionLab state
|
|
2
|
+
|
|
3
|
+
Updated: 2026-10-01 (Asia/Seoul).
|
|
4
|
+
|
|
5
|
+
## Completed local v0.1.0
|
|
6
|
+
|
|
7
|
+
- Release priority: delayed-feedback memory/state contracts, controls, diagnostics, and small reproducible examples. archcredit remains separate; CREDO and Cosmos v14/v10 refinement are deferred.
|
|
8
|
+
- Implemented native ResidualMemory/RLS, NumPy reference, differentiable delta primitive, immutable tickets, owner-bound exactly-once replay, negative controls, and built-in checkpoint resume.
|
|
9
|
+
- Native checkpoints preserve pending/settled ticket identities, owner, clock, model state, and issued-forecast evaluation. Custom correctors work through generic replay but are not supported by built-in checkpoint helpers.
|
|
10
|
+
- CLI, typed packaging, Python 3.10/3.11/3.12 CI, contributor recipe, MIT license, release guide, and provenance/evidence documentation are complete.
|
|
11
|
+
- Recovered v13 historical artifacts are byte-preserved; source/result hashes and audit findings are recorded in [provenance](docs/provenance.md). This release did not rerun the full weather experiment.
|
|
12
|
+
|
|
13
|
+
## Verification
|
|
14
|
+
|
|
15
|
+
- Final local suite: **95 passed, 1 CUDA hardware skip, 196.79 seconds**.
|
|
16
|
+
- Ruff lint/format passed for 21 formatted files; strict mypy passed for 8 source files.
|
|
17
|
+
- Separate independent code review: APPROVE with zero remaining issues. Scientific documentation review: ACCEPT.
|
|
18
|
+
- Regression tests cover maturity, immutable keys, foreign/duplicate settlement, atomic failed writes, checkpoint/resume, rate/config consistency, unsupported checkpoint dtypes, norm overflow, and seeded permutation consistency.
|
|
19
|
+
- CPU `aot_eager`/gradcheck, examples, literal installed CLI, build/Twine metadata 2.4, and outside-checkout installed-wheel checks passed. See [verification](docs/verification.md).
|
|
20
|
+
|
|
21
|
+
## Distribution receipts and next work
|
|
22
|
+
|
|
23
|
+
- GitHub repository created: https://github.com/cjw0076/revisionlab. Hosted workflow receipts belong in [Actions](https://github.com/cjw0076/revisionlab/actions/workflows/ci.yml); publication assets belong at [v0.1.0](https://github.com/cjw0076/revisionlab/releases/tag/v0.1.0) once published. Local validation does not claim those hosted/publication steps have already succeeded.
|
|
24
|
+
- The first hosted matrix failed on NumPy typing compatibility. Mypy now follows each runner's actual Python version with strict checks retained; an explicit float64 NumPy state annotation passes local mypy/format checks. Rebuilt artifacts and hosted rerun evidence are required before recording hosted all-green status.
|
|
25
|
+
- No PyPI upload or model training/pretrained release is recorded. Next distribution step is approved TestPyPI/PyPI handoff with trusted-publisher configuration.
|
|
26
|
+
- Next research step is controlled replay/generalization evidence across sites/regimes and matched correction budgets; v14 splitting requires separate preregistration and pending-ticket semantics.
|
|
27
|
+
|
|
28
|
+
Local residual alignment is not global BPTT alignment. The replay audit ledger grows with settled ticket IDs; fixed corrector capacity does not mean constant whole-runner memory. CPU smoke does not establish CUDA/Inductor compatibility or performance.
|