Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1957cc9
Wire feedback weights into ESN forward pass
claude Oct 8, 2026
81c670d
Document end-to-end ESN pipeline
claude Oct 8, 2026
3b89b7a
Make ESN end-to-end inference actually work
claude Oct 8, 2026
ec54463
ESN: unroll the recurrence per token in llm_build_esn
claude Oct 8, 2026
f6d1c9f
ESN: real byte-level tokenizer + enough graph nodes for the unrolled …
claude Oct 8, 2026
9bd61fd
ESN: real text training-data loader + verified predictive output
claude Oct 8, 2026
46be38b
ESN: clarify W_out initialization comment
claude Oct 8, 2026
1bbc3fc
tests: add held-out byte-level perplexity benchmark for ESN
claude Oct 8, 2026
3e387e2
docs: pin ESN completion contract (criteria + evidence)
claude Oct 8, 2026
00dca0d
tests+docs: harden inference asserts; broaden perplexity evidence
claude Oct 8, 2026
dee2e1d
docs: scope-fence future-work; anchor contract to upstream pattern
claude Oct 8, 2026
e47429a
Merge remote-tracking branch 'origin/master' into claude/esn-implemen…
Copilot Oct 9, 2026
31610ca
ESN: calibrated readout, faster training, F16 reservoir, O(n log n) p…
claude Oct 19, 2026
ff30811
Merge remote branch history of merged PR #3 (no file changes)
claude Oct 19, 2026
8826f99
esn_training.py: use logging instead of print to pass flake8 Lint
claude Oct 19, 2026
f688a26
Fix msys2 CLANG64 build; type ESN weight attributes for pyright
claude Oct 19, 2026
2ab1907
Include <cstdlib> where getenv/atoi/rand/EXIT_FAILURE are used
claude Oct 19, 2026
15f295a
server tests: expect 248 tokens in ctx-shift-disabled short-prompt case
claude Oct 19, 2026
8585da4
mtmd-audio: include <functional> for std::cref/std::ref
claude Oct 19, 2026
2954f6c
server: mark completion truncated when it stops at the context limit
claude Oct 19, 2026
7f3fe16
ci: stop reusing -march=native ccache objects across runner CPUs
claude Oct 19, 2026
586dead
esn: make output feedback and bidirectional training match inference
claude Oct 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ jobs:
id: cmake_build
run: |
cmake -B build \
-DGGML_NATIVE=OFF \
-DLLAMA_FATAL_WARNINGS=ON \
-DGGML_RPC=ON
cmake --build build --config Release -j $(nproc)
Expand Down Expand Up @@ -301,6 +302,7 @@ jobs:
run: |
cmake -B build \
-DLLAMA_FATAL_WARNINGS=ON \
-DGGML_NATIVE=OFF \
-DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
Expand All @@ -311,6 +313,7 @@ jobs:
run: |
cmake -B build \
-DLLAMA_FATAL_WARNINGS=ON \
-DGGML_NATIVE=OFF \
-DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DGGML_OPENMP=OFF
Expand Down Expand Up @@ -1314,10 +1317,17 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: CPU fingerprint
id: cpu
# ci/run.sh builds with -march=native, and ccache 4.5 hashes that flag
# literally, so key the cache on the runner's CPU features to never
# reuse objects built for a different CPU
run: echo "fingerprint=$(grep -E '^(model name|flags|CPU part|Features)' /proc/cpuinfo | sort -u | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

- name: ccache
uses: ggml-org/ccache-action@v1.2.16
with:
key: ggml-ci-x64-cpu-low-perf
key: ggml-ci-x64-cpu-low-perf-${{ steps.cpu.outputs.fingerprint }}
evict-old-files: 1d

- name: Dependencies
Expand All @@ -1339,10 +1349,17 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: CPU fingerprint
id: cpu
# ci/run.sh builds with -march=native, and ccache 4.5 hashes that flag
# literally, so key the cache on the runner's CPU features to never
# reuse objects built for a different CPU
run: echo "fingerprint=$(grep -E '^(model name|flags|CPU part|Features)' /proc/cpuinfo | sort -u | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

- name: ccache
uses: ggml-org/ccache-action@v1.2.16
with:
key: ggml-ci-arm64-cpu-low-perf
key: ggml-ci-arm64-cpu-low-perf-${{ steps.cpu.outputs.fingerprint }}
evict-old-files: 1d

- name: Dependencies
Expand All @@ -1364,10 +1381,17 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: CPU fingerprint
id: cpu
# ci/run.sh builds with -march=native, and ccache 4.5 hashes that flag
# literally, so key the cache on the runner's CPU features to never
# reuse objects built for a different CPU
run: echo "fingerprint=$(grep -E '^(model name|flags|CPU part|Features)' /proc/cpuinfo | sort -u | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

- name: ccache
uses: ggml-org/ccache-action@v1.2.16
with:
key: ggml-ci-x64-cpu-high-perf
key: ggml-ci-x64-cpu-high-perf-${{ steps.cpu.outputs.fingerprint }}
evict-old-files: 1d

- name: Dependencies
Expand All @@ -1389,10 +1413,17 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: CPU fingerprint
id: cpu
# ci/run.sh builds with -march=native, and ccache 4.5 hashes that flag
# literally, so key the cache on the runner's CPU features to never
# reuse objects built for a different CPU
run: echo "fingerprint=$(grep -E '^(model name|flags|CPU part|Features)' /proc/cpuinfo | sort -u | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

- name: ccache
uses: ggml-org/ccache-action@v1.2.16
with:
key: ggml-ci-arm64-cpu-high-perf
key: ggml-ci-arm64-cpu-high-perf-${{ steps.cpu.outputs.fingerprint }}
evict-old-files: 1d

- name: Dependencies
Expand All @@ -1414,10 +1445,17 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: CPU fingerprint
id: cpu
# ci/run.sh builds with -march=native, and ccache 4.5 hashes that flag
# literally, so key the cache on the runner's CPU features to never
# reuse objects built for a different CPU
run: echo "fingerprint=$(grep -E '^(model name|flags|CPU part|Features)' /proc/cpuinfo | sort -u | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

- name: ccache
uses: ggml-org/ccache-action@v1.2.16
with:
key: ggml-ci-arm64-cpu-high-perf-sve
key: ggml-ci-arm64-cpu-high-perf-sve-${{ steps.cpu.outputs.fingerprint }}
evict-old-files: 1d

- name: Dependencies
Expand Down
12 changes: 10 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ x(t+1) = (1-α) * x(t) + α * tanh(W_res * x(t) + W_in * u(t))
| `esn_feedback_scaling` | 0.0 | Output-to-reservoir feedback (0 = disabled) |
| `esn_noise_level` | 0.0 | Noise injection for regularization |
| `esn_activation_type` | 0 | Activation: 0=tanh, 1=sigmoid, 2=leaky_relu |
| `esn_bidirectional` | false | Bidirectional reservoir processing |
| `esn_bidirectional` | false | Not supported (inference is forward-only) |

### Tensor Layout

Expand All @@ -47,7 +47,7 @@ esn_input_weights.weight [reservoir_size, n_embd]
esn_reservoir_weights.weight [reservoir_size, reservoir_size]
output_norm.weight [reservoir_size]
esn_output_weights.weight [n_vocab, reservoir_size]
esn_feedback_weights.weight [reservoir_size, n_vocab] (optional)
esn_feedback_weights.weight [n_vocab, reservoir_size] (optional, row per fed-back token)
esn_input_bias.weight [reservoir_size] (optional)
esn_reservoir_bias.weight [reservoir_size] (optional)
```
Expand Down Expand Up @@ -118,8 +118,16 @@ python scripts/esn_training.py --config config.json

# Initialize only (no training)
python scripts/esn_training.py --init-only --output untrained.gguf

# Large reservoir: pick λ on held-out data, store W_res as F16
python scripts/esn_training.py --reservoir-size 8192 --reg-grid 1,10,100,1000 \
--outtype f16 --train-data corpus.txt --output model.gguf
```

Batch training holds out `--val-fraction` (default 10%) of the sequences to
pick λ from `--reg-grid` and to fit a softmax temperature that is folded into
`W_out` (disable with `--no-calibrate`).

## Common Tasks

### Debugging ESN Issues
Expand Down
16 changes: 12 additions & 4 deletions docs/esn-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ sign off on criteria 1–4, 6, 7 by inspection of the file set; criterion
| Feedback path is wired | `src/llama-model.cpp` | `W_fb · y(t-1)` added when `esn_feedback_scaling != 0` |
| Logits are produced | `src/llama-model.cpp` | `W_out · x(t)` emitted as `result_output` |

**Verified by**: `bin/test-esn-inference` runs assertions A–I against the
**Verified by**: `bin/test-esn-inference` runs assertions A–J against the
C API: load (A), context init (B), multi-token prompt decode (C),
single-token step (D), all-finite logits (E), **determinism — same prompt
in a fresh context yields bit-identical logits (F)**, **prompt sensitivity
— different prompts yield different logits (G)**, **state advancement —
different input bytes yield different logits (H)**, and softmax well-
definedness (I). These are numerical runtime properties, not smoke
different input bytes yield different logits (H)**, softmax well-
definedness (I), and **batch consistency — a multi-token batch with every
position as an output, alone or alongside a second sequence, matches
token-by-token decoding (J)**. These are numerical runtime properties, not smoke
checks. Passes on two independently-trained models (R=2048 and R=1024,
different seeds and hyperparameters).

Expand Down Expand Up @@ -117,6 +119,12 @@ trained models with different seeds, reservoir sizes, embedding dims,
spectral radii, leaking rates, and sparsities. The forward pass is
numerically correct, not luck.

These models predate readout calibration. With the calibrated readout and
held-out λ selection now in `scripts/esn_training.py`, held-out entropy on a
9 602-byte held-out file is 5.77 bits/byte at R=2048 and 5.65 bits/byte at
R=8192, at equal or better argmax accuracy; see "Measured Effect of the Training
and Inference Optimizations" in `docs/esn.md`.

### 6. Documentation describes what's shipped

| Requirement | Satisfied by | Evidence |
Expand Down Expand Up @@ -152,7 +160,7 @@ work. Their absence does not block this contract:

- [x] Arch registry (criterion 1) — `ctest -R test-esn` 8/8
- [x] Model loading (criterion 2) — two independently-trained GGUFs load
- [x] Forward pass single + multi-token (criterion 3) — `test-esn-inference` PASSED (A..I, incl. determinism, prompt sensitivity, state advancement)
- [x] Forward pass single + multi-token (criterion 3) — `test-esn-inference` PASSED (A..J, incl. determinism, prompt sensitivity, state advancement, batch consistency)
- [x] Training produces usable models (criterion 4) — ridge acc 0.5216 (R=2048), two independently-trained models
- [x] Beats uniform on real text (criterion 5) — 7.77 bits/byte on full held-out, confirmed on both models
- [x] Docs cover shipped functionality (criterion 6) — `docs/esn.md`, `CLAUDE.md`, this file
Expand Down
Loading
Loading