# compsearch A model proposes online learning algorithms; each one is scored by how well it compresses text it has never seen; the best survive and are improved again. ## How a candidate is scored A candidate is one Python file with a `Learner` class. For every byte of the stream it must first give its belief about the next byte (`predict`), and only then is told the answer (`update`). The score is the bits needed to encode the stream under those predictions, plus the compressed size of the candidate's own source, per byte. Lower is better. Because every byte is predicted before it is seen, the score measures generalisation directly and there is no test set to leak. ## Run it python make_data.py # once: builds data/search.bin and data/holdout.bin python -m compsearch.search --run runs/first --generations 5 python -m compsearch.report --run runs/first --holdout data/holdout.bin python -m unittest discover -s tests # the test suite The search calls Claude Opus 5.5 through the `claude` command, so that command must be logged in (`claude`, then `/login`). Each generation makes `--parallel` model calls (default 4), which count against your Claude usage. Stop with Ctrl+C at any time and run the same command to resume. ## Limits it keeps | Resource | Default | Flag | |---|---|---| | RAM per candidate (hard cap) | 1024 MB | `--mem-mb` | | Candidates at once | 4 | `--parallel` | | Time per candidate, one core | 300 s | `--seconds` | | Free disk it will not go below | 5 GB | `--min-free-disk-gb` | | Size of the run folder | 500 MB | `--max-run-mb` | It refuses to start a generation if the workers together could use more than half of the RAM that is free at that moment. It never uses the GPU. ## Safety Candidates are written by a model and run on this machine, behind three layers: 1. A static check: a short allowlist of imports, no file access, no `eval`/`exec`, no underscore-prefixed attributes, no interpreter internals. 2. Separation: the candidate runs in its own process that is never given the data file, its path, or the score. It receives one byte at a time, each only after it has committed to a prediction. All scoring happens in the search process, so a candidate cannot forge or tamper with its result. 3. Confinement: that process has a hard memory cap, a time limit, an empty working folder, discarded output, and (on Windows) may not start other processes. This is still not a full operating-system sandbox: a candidate that defeated the static check could read files your user account can read. Do not point the search at a model you do not trust. The byte-at-a-time handshake costs about 40 seconds per megabyte of stream on top of the candidate's own work; that is the price of the separation. ## Layout - `seeds/sponge.py`: the starting learner (diary lookup, sparse context memory, learning by addition, gated mixing, gates that divide). `seeds/order0.py` is a bare baseline. - `compsearch/prompt.py`: the idea bank the proposer draws on. Add ideas there. - `compsearch/evaluate.py`, `runner.py`: trusted scoring. `host.py`: the confined process a candidate runs in. `safety.py`, `limits.py`: the static check and resource guards. - `compsearch/search.py`: the loop. `compsearch/report.py`: leaderboard. - `runs//cands//`: every candidate tried, with its source and result.