Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions .github/workflows/algernon-arg01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Algernon ARG-01 frozen recurrent algebraic gym
on:
push:
paths:
- 'research/algernon/algebraic_reasoning_gym/**'
- '.github/workflows/algernon-arg01.yml'
pull_request:
paths:
- 'research/algernon/algebraic_reasoning_gym/**'
- '.github/workflows/algernon-arg01.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
frozen-recurrent-and-exact:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: MoralityLabAI/EvalMath
ref: 88bb6cf8d2fe172e37d25964dfb2c285d9033841
path: .arg01_evalmath
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Independent EvalMath oracle exact tests
run: PYTHONPATH=.arg01_evalmath/src python -m unittest discover -s .arg01_evalmath/tests -p test_algebraic_reasoning_oracle.py -v
- name: Frozen checkpoint, interpreter independence and leakage audit
run: PYTHONPATH=.:.arg01_evalmath/src python -m unittest discover -s research/algernon/algebraic_reasoning_gym -p test_gym.py -v
- name: Full source-bound CPU replay
run: PYTHONPATH=.:.arg01_evalmath/src python -m research.algernon.algebraic_reasoning_gym.gym --check
13 changes: 13 additions & 0 deletions research/algernon/algebraic_reasoning_gym/PROTOCOL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ARG-01 execution protocol and failure gates

**Status:** CPU reference comparison with RRC-19 frozen checkpoint and independent EvalMath oracle. No Qwen3.5 or 27B model inference in the current results. This file was written during the implementation, not before the earlier RRC experiments.

1. Pin the EvalMath source SHA-256 locally, then its exact remote commit when merged, four RRC-19 checkpoint bytes and the deterministic generator seed. The EvalMath oracle is independent of the RRC model code. Refuse altered sources and unpinned responses.
2. Generate the reference 36-case calibration and 192-case test/control roster. Learned checkpoints are frozen; no test or calibration gradient updates, parameter selection or architecture changes. Test cases have unique public signatures apart from six explicitly duplicated future pairs.
3. Use RRC-18's certified finite-degree classes as the common neural-output decoder. A 6,240-weight balanced RRC-19 GRU and same-size skewed/shuffled GRUs, plus 6,235-weight feedforward control, rank classes from the public demos/topology. They perform **zero candidate interpreter previews**. Test up to twelve distinct class representatives; include the class-size prior under the same twelve-query budget and the complete-class and 64-syntax higher-resource baselines.
4. Every candidate query must run two independent exact demonstrations through coefficient 12. Only certified proposals count as accepted. Grade a new query's withheld coefficient-32 future afterward. Count the number of paid candidate checks, exact integer-loop proxy, model forward MACs, class compiler executions and wall time separately. Never equate the latter arithmetic proxies.
5. Reject all known negatives within the 64-program grammar. For each visible-equal future pair, every model must issue the same query trace. Full exact search must have exactly one incorrect future per pair; exact observed-prefix validity is not a theorem of infinite series equality.
6. Record by-family accepted and future-correct totals, paired differences, and separate known/novel source aggregates. A positive learned-recurrence claim requires improvements over feedforward, class-size ordering and complete exact search at comparable **total** compute; failure is a published result.
7. The optional external model path accepts depth 0/1/2/4/8 plus a pinned revision and input digest, and fails on missing/invalid model evidence. The JSONL model exchange supports actual locally run Qwen/looped checkpoints, while the evaluator never asserts that model-declared depths are physical recurrence until hooks/forward traces verify them.

All CI tests and replay run on CPU using standard-library Python plus the existing repository sources. The CI workflow checks out the full pinned EvalMath commit and verifies its oracle source hash. In source-only local snapshots, the Git commit field is explicitly unresolved until the EvalMath integration is merged. It does not train, download weights, request GPU instances, or score unprovided external-model answers. A future Qwen experiment must pin task split, checkpoint, inference implementation and causal intervention settings *before* looking at its held-out results.
11 changes: 11 additions & 0 deletions research/algernon/algebraic_reasoning_gym/QWEN_WORKORDER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ARG-02: Qwen / looped-layer execution workorder (unrun)

This is a prospective, optional GPU experiment. The current CPU run used the frozen 6,240-weight RRC-19 task-trained GRU. A Qwen graft cannot be asserted from that evidence.

1. Freeze model repository, exact resolved revision, quantization, tokenizer, software stack, device name/VRAM, source/adapter hashes and the actual recurrent computation site. `model_revision` in `external.py` must be the resolved 40-character git commit SHA or SHA-256 digest of local checkpoint bytes. Record the first/last forward activations and real loop count per case; a declared depth alone is metadata.
2. From the pinned EvalMath checkout, export the public 192-case test/control set. Train or tune only on the separate 36-case calibration roster or an independently generated training roster; record generator seed, contamination audit and total GPU-seconds. Hold out all test cases from learning, prompt tuning and early stopping. Treat prior RRC-19 tests as exposed development context.
3. Run Qwen/looped model with latent refinement depths 0,1,2,4,8. Keep the same problem text, output grammar, decoding temperature, exact candidate budget, and information access in each arm. Add a same-parameter feedforward control, shuffled latent state and equal-token text-CoT control. Include untouched base-skill retention tests.
4. Log JSONL proposals with `case_id`, `public_sha256`, `depth`, `program`, actual `model_revision`, `inference_ms`, `generated_tokens`, and `model_forward_calls`. Never include future coefficients, labels, verifier answers, or hidden source graph in a model prompt. Use the exact oracle only after each proposal and charge candidate checks; if any residual is fed back during an iterative run, record and account for it as extra compute.
5. Evaluate accepted exact programs, withheld future-correct predictions, bad/abstained outputs, p50/p95 wall time, total neural forward MACs or FLOPs, CPU verifier work, peak GPU memory, held-out source-family splits, paired success counts and retention drift. Genuine depth effects require causal ablation of intermediate states, beyond resubmitting a program to a host interpreter.

Stop on altered checkpoint hash, invalid decoder contract, source/test overlap, unverified hidden-state hooks, or changed test prompts. This workorder spends no rented GPU time automatically.
52 changes: 52 additions & 0 deletions research/algernon/algebraic_reasoning_gym/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Algernon Algebraic Reasoning Gym | ARG-01

A runnable CPU benchmark combining EvalMath's independent exact finite formal-series verifier with **frozen, previously trained** RRC-19 recurrent and feedforward class-ranking checkpoints. A separate JSONL interface accepts proposals from an external Qwen3.5 / looped transformer checkpoint, with its model revision and depth recorded.

**Executed evidence:** 6,240-parameter RRC-19 balanced GRU and skewed/shuffled controls, 6,235-parameter RRC-19 MLP, certified class-size ordering, and complete exhaustive exact search on a newly seeded EvalMath roster. This is a pretrained *task-specific* GRU, not a foundation-model Qwen graft. No new model training, GPU, internal Qwen recurrence, or hidden-state intervention occurs in ARG-01.

## Ownership and exact mathematical boundary

EvalMath owns `spiral_ln.algebraic_reasoning_oracle`, its tests, and a deterministic 228-case reference receipt. The `evalmath_pin.json` file locks the oracle source SHA-256 and, after upstream integration, its exact EvalMath Git commit. Source-only local runs explicitly record an unresolved commit rather than asserting a false pin. `gym.py` imports that module from a separate checkout at the pinned revision. It never vendors the EvalMath verifier or substitutes a neural predictor for an exact equality check.

Two public demonstrations give integer coefficients through degree 12, with a fresh query input. Graph programs contain three symbols from `I,N,S,R`, operating on four supplied graph topologies. One paid graph query computes both observed examples and records exact coefficient agreement and the first mismatching degree. A maximum of twelve candidates is allowed for each learned/static restricted policy. The complete certified class and 64-syntax searches receive explicitly larger budgets. Future degree-13–32 query output is held back until independent grading.

The 36-case calibration set is generated and receipt-hashed but unused in the benchmark model selection. The new 168-case positive roster spans seven source generators; rational, squared, sign-twisted product, and lacunary are test-only relative to the three RRC-19 training-family classes. Twelve inconsistent demo cases and six matched future-collision pairs provide negative controls. All source-family and topology labels remain absent from the learned feature encoder other than the public topology identity.

## Reproduce on CPU

Use the EvalMath revision in `evalmath_pin.json` in a sibling checkout. The bytewise oracle source SHA-256 is checked on every local run. A source-only package has an explicit unresolved-commit status until that revision is merged. From Compactification-Theory root:

```sh
PYTHONPATH=.:../EvalMath/src python -m unittest discover -s research/algernon/algebraic_reasoning_gym -p 'test_gym.py' -v
PYTHONPATH=.:../EvalMath/src python -m research.algernon.algebraic_reasoning_gym.gym --check
```

No inference model is downloaded: the four existing RRC-19 checkpoint JSON files under `research/rrc_compactification/results/` are used as frozen weights, with pinned SHA-256 verification. The RRC-18 exact class compiler is an explicit shared algorithmic dependency. `results/arg01_reference.json` is a source-hashed, deterministic receipt; timing lives in a separate machine-specific profile.

## External pretrained model protocol

ARG-01 can export test questions for a real Qwen or looped model, while keeping target programs and future coefficients inside EvalMath:

```sh
PYTHONPATH=.:../EvalMath/src python -m research.algernon.algebraic_reasoning_gym.external \
--export-public /tmp/arg01_public.jsonl
```

A model runner returns one JSON object per line with these mandatory fields:

```json
{"case_id":"signed:signed:00001","public_sha256":"<64-hex-input-sha256>","depth":2,"program":["I","R","N"],"model_revision":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
```

`depth` may be 0, 1, 2, 4, or 8. A null program is an explicit abstention; missing records are reported separately. Inference time and token/forward-call counts are optional extra fields. All records must refer to a single pinned model revision. Responses containing future labels or unrecognized fields fail closed. The scored receipt is **not** evidence of actual internal latent loops without an independently recorded model hook/forward-pass trace. A 5080 experiment should pin exact model weights, site, hook and decode settings separately before use.

```sh
PYTHONPATH=.:../EvalMath/src python -m research.algernon.algebraic_reasoning_gym.external \
--score-proposals /tmp/qwen_arg01.jsonl --out /tmp/qwen_arg01_scored.json
```

## Research interpretation

The primary signal is executable-program *future* accuracy per full measured computation, including class compilation, predictor inference and exact candidate verification. Aggregate correctness should be split by known/novel source family; source-family holdouts in RRC-19 itself are public, so ARG-01 is another deterministic research evaluation rather than an independently blind study. An RRC-19 GRU forward pass processes the thirteen coefficient steps of its input **once**; additional candidate-verifier calls are external computation, not new GRU refinement steps. A true recurrence-depth comparison requires the external checkpoint and actual latent forward traces.

A success claim about Algernon's joint processor requires a model advantage beyond the strongest exact symbolic control at comparable resources, causal loop-depth ablations, and retained base skills on a separate evaluation. ARG-01 establishes the interface for that experiment.
44 changes: 44 additions & 0 deletions research/algernon/algebraic_reasoning_gym/REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ARG-01: frozen recurrent algebraic coprocessor pilot

**Executed:** November 10, 2026, CPU-only. EvalMath supplies a separately implemented exact finite-series interpreter. The recurrent model is the **previously trained RRC-19 6,240-parameter GRU**, whose full JSON checkpoint is loaded without training or modification. It is a domain-specific model, rather than a pretrained Qwen or a latent-layer graft. No new GPU model executed in this pilot.

## Verified future predictions

The first 13 coefficients of two public demonstration pairs are the entire candidate-selection evidence; a separate degree-32 target scores extrapolation. All learned and static twelve-check arms have equal exact candidate budgets, though they differ in inference work. Complete certified-class and complete syntax searches are higher-budget references.

| Source family (24 cases) | Frozen GRU | Frozen FF | Class-size, 12 checks | Complete class search |
|---|---:|---:|---:|---:|
| Signed, seen generator | 22 | 19 | 14 | 24 |
| Partition product, seen | 24 | 23 | 11 | 24 |
| Sparse signed, seen | 15 | 14 | 13 | 19 |
| Rational reciprocal, novel | 15 | 13 | 16 | 23 |
| Convolution square, novel | 17 | 18 | 16 | 21 |
| Sign-twisted product, novel | 14 | 16 | 16 | 24 |
| Lacunary cubic substitution, novel | 22 | 19 | 16 | 24 |
| **All positives /168** | **129** | **122** | 102 | **159** |
| **Novel sources /96** | **68** | **66** | 64 | **92** |

The exact independent 64-syntax search recovers **157/168** correct future predictions, while verifying all 168 observed prefixes; the complete *certified-class* order recovers **159/168**. Different accepted programs can agree through degree 12 and diverge at degree 32, so exhaustive search is a finite **acceptance** upper control, not a universal future-prediction upper bound. The accepted programs are never treated as proofs of infinite identities.

All twelve selected invalid demonstration cases fail complete finite-DSL search. Six paired late-future mutants preserve identical observed inputs and candidate traces, producing six unavoidable future errors under complete search. Reusing the same frozen GRU on source-family shifts yields only a 2-case gain over feedforward on the 96 novel examples. That is a small exploratory sample; no robust generalization or internal-loop advantage is claimed.

## Computation

The pretrained GRU contributes 6,240 FP32 parameters and a 32-number recurrent state, with an estimated 53,216 dense multiply-accumulates per query (13 coefficient timesteps). The FF has 6,235 FP32 parameters and an estimated 6,120 MACs. The neural method makes zero unsampled candidate-graph executions before proposing an order. Each paid exact query then executes both public demonstrations and charges a separate integer-loop work proxy. The 12-check GRU executes 909 exact two-demo queries across the 168 positive cases, compared with 1,017 for the FF and 1,242 for the twelve-check certified class-size order.

**Observed host profile (one single-process warm pass):** the GRU uses ~582 ms across all 168 positive cases (inference plus exact verification), the FF ~90 ms, the restricted class-size order ~58 ms and the complete certified class search ~69 ms. These are machine-specific Python 3.13 wall-clock measurements, excluding independent future grading, prior training, and cold setup. The same run measured ~189 ms to build the exact four-topology class map and ~7 ms to deserialize and pin the four checkpoints. Shared compiler initialization and model loading are recorded separately.

The model remains slower than complete symbolic search on this CPU while recovering fewer correct futures. The ongoing benefit of the architecture is a falsifiable model-to-exact-verifier interface and a reproducible set of model baseline numbers, not a demonstrated compute-efficient reasoner.

## Checks and provenance

- EvalMath oracle: 12 tests, source-hashed deterministic 228-case reference manifest.
- Algernon harness: 13 tests, source-hashed receipt, exact budget and negative/collision tests.
- Cross-check: EvalMath's independent arithmetic agrees with the existing RRC interpreter on 512 randomly generated graph/topology/input cases.
- Frozen model: checkpoint SHA-256 is verified for four RRC-19 arms before deserialization. No gradient training or model selection occurred.
- Tests explicitly replace the hidden graph/future while holding visible demonstrations fixed, ensuring the model's proposed class order remains invariant.
- Timing measurements are stored in `results/arg01_reference_profile.json`; the deterministic receipt in `results/arg01_reference.json` excludes elapsed time.

## Next executed-model gate

Provide a local Qwen3.5-0.8B (or pinned LOTUS/looped checkpoint) and inference implementation with inspectable per-loop latent/forward traces. The included `external.py` can export public prompts and score records at depths `0/1/2/4/8`, requiring a resolved checkpoint revision, actual loop timing and a separately fixed test roster. Compare against the frozen 6,240-weight GRU, 6,235-weight FF, 12-check class-size prior and complete symbolic search. All candidate operations must still be verified independently by EvalMath; a model-written explanation is optional and carries no correctness credit.
15 changes: 15 additions & 0 deletions research/algernon/algebraic_reasoning_gym/evalmath_pin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"checkpoint_origin": "MoralityLabAI/Compactification-Theory RRC-19 committed frozen training artifacts",
"checkpoint_sha256": {
"frozen_ff": "a40cc30ccb93550edbaca1ba6660f24ca0adde37bf910fe4a05f55bbbe20a001",
"frozen_gru": "fa610d639243c96d40ebde2d75c2b852c3d0881b65db07736c0a1c4590a161d8",
"shuffled_gru": "9178aaf0fea14f9beb026e797b6186c1cba0a134afb5e3de63602a5f8e77f834",
"skewed_gru": "72e5baf944e1f1851e0d296a7e53ac314cd7d679294d5bed372b1c46e90b6b01"
},
"evalmath_commit_sha": "88bb6cf8d2fe172e37d25964dfb2c285d9033841",
"evalmath_repository": "MoralityLabAI/EvalMath",
"oracle_source_sha256": "c0df77faae6351e522f35d36fa6031d6270ecced2fd92d0477cb5e08992ccb0b",
"oracle_version": "arg01.oracle.v1",
"revision_state": "GitHub-merged exact EvalMath oracle commit and source SHA lock",
"schema": "algernon.arg01.pin.v1"
}
Loading
Loading