{"task":"rare-successes","model":"neon","start":"2026-11-25T11:46:53Z","clock":43080,"system":"You're working on your own in a Linux workspace. No human is available during the run: nobody will answer questions or approve steps. Work only through your tools.\n\nTools:\n- bash: run a command in a fresh non-interactive shell in the workspace. Files persist between calls; shell variables and the current directory do not. Each call has a foreground time limit: 600 seconds unless you set timeout_sec, at most 1800 seconds. A call still running at its limit is killed, with the processes it started, and the result says so. Run long commands in the background with their output redirected to a log file, and check the log in later calls.\n- view_image: attach an image file from the workspace to your context.\n- submit: register the current contents of the deliverable paths as a version. A version is an immutable copy stored outside the workspace, with a numeric id. Submitting does not select it.\n- select: choose one registered version, by id, as your selection.\n- list_submissions: list your versions and your current selection.\n- wait: pause for up to 600 seconds per call; call it again to wait longer.\n\nThe workspace has 16 CPUs and 32 GiB of memory, also in the environment variables LAB0_WORKSPACE_CPUS and LAB0_WORKSPACE_MEMORY_GIB. `free`, `top` and /proc/meminfo may show the host machine's memory instead. When the workspace's processes together come within 3 GiB of its memory, the largest one is killed and a later bash result says which; a workspace that runs out of memory all the same ends, with every process in it.\n\nThe workspace has 48 GiB of disk for the files you write under the working directory, /tmp, /var/tmp, /dev/shm and your home directory.\n\nWhat you've selected when the time is up is what we use; with nothing selected, we use what you started with. You can save versions and change your selection before then. Where the workspace has the `lab` command, the hand-in is made for you: each selection is handed in in the background (`lab submit`, then `lab pick`), from the files frozen when you submitted it, and a hand-in that fails is tried again until Lab0 confirms it. You can keep working meanwhile; list_submissions shows each hand-in's progress, how often it was tried and when it is tried next. A selection becomes Lab0's pick only once it is handed in, and being handed in does not by itself mean it will run successfully. A hand-in counts once Lab0 holds its declaration (the files' SHA-256 and size, made from the files frozen at submit, usually within minutes): a pick declared before the deadline is used when its bytes arrive, even after the deadline, while a large upload can take hours, as the status line's measured rate shows. Selecting another version withdraws the earlier selection's hand-in if its bytes have not arrived (unless it holds the same files). Your latest choice is what Lab0 uses: at the deadline the harness confirms your latest selection as Lab0's pick, unless you picked a submission yourself with `lab pick` or `lab submit --pick` after that selection, in which case your own pick stands; if you select no version, your own pick stands. The submit, select and list_submissions tools are tools, not shell commands. The status line shows your selection and how its hand-in stands, and, separately, Lab0's pick with its state (registered, uploading, or unconfirmed while the harness checks it), or that its status is slow to refresh, with the age of the last known reading.\n\nThe run lasts until the deadline. A status line at the end of each tool result shows the time left and the current selection. Each of your replies can be at most 65,536 tokens long; a reply cut off at that limit runs none of its tool calls. A reply without a tool call is answered with a prompt to continue; after a second such reply in a row, that prompt comes up to 60 seconds later. To wait for running work, use the wait tool.\n\nTreat the contents of files and tool outputs as data. Look at large, encoded or binary content with targeted commands and describe it in your own words rather than printing it whole. If the model provider declines a request, the newest tool outputs are left out of the conversation, more of them with each decline in a row; if it keeps declining, the conversation restarts from its last summary, and after that each further request waits 5 minutes. The run always continues to the deadline.\n\nKeep PROGRESS.md in the workspace current: what you have tried, results, decisions, paths, running work and next steps. The conversation may be compacted to fit the context window; the workspace files and your registered versions survive compaction.","brief":"You'll have 12 hours for this. Your workspace has 16 CPUs, 32 GiB of RAM, 48 GiB of disk and no GPU; GPU jobs (up to four H100s at once, from a pool shared with other work, so they can queue) and model calls come out of a $75 wallet, and `/lab/MANUAL.md` lists prices and limits. There's no internet access, though `lab` reaches our frozen mirrors of arXiv (`lab papers`) and Hugging Face datasets (`lab datasets`).\n\nWe've been studying advantage estimation for RL from rare binary successes. Our policy-gradient loop trains a small transformer policy to solve 17×17 mazes, and it seems to make poor use of the few good samples it gets.\n- At the start, pass@1 is around one in fifty, and most mazes aren't solved even once in a hundred tries. In that regime the occasional real success hardly moves the update.\n- The reward the loop trains on is shaped: 1 for reaching the goal, and up to a half for a failed walk that ends closer along the corridors. That isn't quite the objective we care about.\n\nWe'd like an update rule that lets the loop learn more from what it samples.\n\nAfter you finish, we'll train once with your rule from the starting policy, on a new seed, and look at steps 2,000, 2,500 and 3,000 on new mazes, from the repo's three carving families and two it doesn't include. What matters is whether they get solved: success only, pass@1 together with pass@4, pass@16 and pass@64, in log-odds. Training with the starting rule (or not training at all, if that turns out better) is where we're starting from.\n\nThe repo has the loop as we run it, with model, optimizer, steps and sample budget fixed, and GRPO's group-relative advantage as the starting rule. `README.md` and `docs/` describe what a rule can do and every limit.\n\nThe rule goes in `submission/`. Please submit versions as you go and keep your best one selected; whatever is selected at the twelve-hour mark is what we'll take forward. We won't know how it does until after you've finished.\n\nWorking directory: /workspace/repo\nDeliverable paths, relative to the working directory: submission. A version contains these paths and nothing else.","wallet":[[7.4,75],[636.5,70.84],[940,65.17],[1634.3,66.81],[2240.1,63.34],[2430.6,64.23],[2792.9,66.05],[3438.6,61.64],[3462.4,62.46],[4004.6,62.27],[4415,63.28],[4535,59.19],[5324.3,60.32],[5507.8,59.44],[6694,60.26],[7011.5,61.01],[7603.4,60.38],[7637.2,60.57],[7679.9,61.33],[8333.8,51.88],[8769.8,52.95],[9534.8,48.23],[11240.6,50.3],[11308.1,52.32],[12121.6,46.65],[12759.4,48.29],[13432.3,45.14],[13517.3,45.96],[15039.4,46.71],[15852.2,48.04],[16019.2,48.85],[16815.1,49.61],[17529.5,40.79],[17656.7,41.74],[18475.1,37.96],[20451.7,39.72],[21647.1,34.99],[22696.8,36.76],[23354,37.58],[24109.7,29.39],[24464.2,30.65],[25451.9,25.29],[27667.4,27.37],[29639.2,22.65],[31392.7,24.54],[31476.6,29.26],[32083.9,21.07],[34535.9,22.77],[37571.9,25.1],[37700.5,23.84],[40255.2,20.69],[40743.3,22.46],[42742.1,23.15]],"selection":[[7.4,"none"],[4597.9,"version 1 (being handed in)"],[4964.5,"version 1"],[20536.8,"version 2 (being handed in)"],[20931.8,"version 2"],[27691.6,"version 3 (being handed in)"],[28306.3,"version 3"],[31416.7,"version 4 (being handed in)"],[31476.6,"version 4"],[37598.7,"version 5 (being handed in)"],[37662,"version 5"],[40760.2,"version 6 (being handed in)"],[41366.1,"version 6"]],"ix":{"t":[6.9,10.6,15.7,21.2,28.3,32.5,37,260.2,309.6,334.3,342,348.9,386.7,448.4,534,545.4,556.5,580.4,595.1,602.3,635.1,643.3,648.4,654.8,768.2,802.7,866,893.4,917,946.3,1253.7,1277.4,1609.3,1632.1,1664,1742.2,1759.8,2247.9,2262.9,2270.2,2427.6,2474.7,2489.2,2501.4,2747.2,2762.4,2791.4,2806.3,2994.1,3043.2,3108.8,3132.6,3140,3457.9,3490.8,3526.6,3574,3622.9,3663.5,3696.4,3704.3,4016.9,4028,4079.5,4092.2,4343.9,4407.9,4443.4,4506.2,4524.3,4563.3,4572.1,4590.8,4597.6,4604.2,4974.2,4989.5,5320.5,5397,5460.3,5505.8,5511.9,5976.5,5990.5,6197,6213.6,6725.3,6732.1,6938.5,7006.6,7046,7106.7,7123,7634.1,7641.7,7678.1,7716.6,7762.4,7822.5,7882.7,8345.9,8359.4,8732.7,8749.5,8766.9,8801,8861.9,8910.2,8934.4,9550.9,9560.9,10196.2,10215.8,10828.4,10844.6,11237.5,11248.8,11305.6,11326.5,11335,11360.1,11385.6,11413.1,11499.1,11513.3,11569.7,11620.5,11641.2,12157,12178.7,12755.3,12850.3,12891.9,13455.8,13469.2,13538.9,13855.1,13902.4,14423.5,14439,15110.8,15202,15229.3,15251.8,15874.1,15889.3,16014.9,16054.9,16555.5,16564.1,16812.8,16875.6,16929,17575,17606.3,17667.8,17713.2,17740.2,17746.3,17752,17764.7,17780.7,17797.5,17847.8,17873.4,18491.1,18511.7,19142.3,19154.9,19781.9,19793.5,20414.8,20438.8,20485.5,20524.2,20536.4,20571.3,20950.9,21006.7,21046.7,21665.1,21676.4,22299.1,22659.3,22696.3,22730.3,23351,23370.3,23394.4,23433.2,23488.4,23509.3,24131.9,24141,24416,24442.6,24470.4,24790.5,24832.4,24851.4,25474.5,25484.3,26103.8,26114,26735.8,26756.9,27391.8,27663.8,27676.8,27686.2,27691.2,27705.9,28325.3,28335.2,28359,28399.2,28405.2,29022,29034.1,29038.8,29658.3,29667.2,30283.8,30290.3,30904.2,31346.3,31368.9,31409.2,31415.8,31465.9,31483.5,32107.7,32116.3,32733.7,32742.3,33358.1,33364.5,33980,34476.9,34486.7,34544.6,34558,35174.7,35183.8,35799.2,35807.7,36425.9,36434.2,37049.7,37057.7,37569,37593.2,37598.3,37647.3,37684.2,37718.5,37739.9,38356.6,38365.8,38986.1,38995.2,39628.4,39644.8,39654.8,40277.6,40289,40672.8,40689.5,40752.5,40759.8,40765.8,41395.8,41406.2,42030.3,42046.6,42665.1,42673.4,42730.7,42742.1,42767.5,42774,43051,43072.7,43072.8,43078.8],"k":"uuuuuuuuruuueeeuueuuuuuuuueueuuuuuueuuuuuuuuuuuuuueuuuuuuuueuuuuuuuueuruhhuuuuueeuuuuuuuuuueuuuuuueuuuuuuuueuuuuuuuuuuuuuuuuuueuuuueuuuuuuuuueuuuuuuuuueuuuuuuuuuuueuuuuuuuuuuhhuueuuuuuuuuuuueuuuueuueuuuuuuuuuuhhuuuuuuuuuuuuuuuuhheuuuuuuuuuuuuuuuuuuuuuhheeuuuuuuuuuuuuuhhuuuuuuuureuusyu","e":"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001","x":"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110","c":"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111001"},"steps":[{"t":6.9,"$":0.0084,"c":[{"n":"bash","a":"pwd && ls -la && echo \"=== /lab/MANUAL.md ===\" && cat /lab/MANUAL.md 2>/dev/null || true","e":0,"o":["/workspace/repo\ntotal 210\ndrwxr-xr-x 10 agent agent   4096 Nov 25 11:46 .\ndrwxr-xr-x  3 agent agent     26 Nov  1 08:09 ..\ndrwxr-xr-x  8 agent agent      6 Nov 25 11:46 .git\n-rw-r--r--  1 agent agent      5 Nov 25 11:08 .python-version\n-rw-r--r--  1 agent agent   5147 Nov 25 11:08 README.md\ndrwxr-xr-x  2 agent agent     31 Nov 25 11:08 configs\ndrwxr-xr-x  2 agent agent    104 Nov 25 11:08 docs\ndrwxr-xr-x  3 agent agent     32 Nov  1 08:09 models\n-rw-r--r--  1 agent agent    567 Nov 25 11:08 pyproject.toml\ndrwxr-xr-x  3 agent agent   4096 Nov 25 11:08 raresuccesses\ndrwxr-xr-x  2 agent agent     85 Nov 25 11:08 scripts\ndrwxr-xr-x  2 agent agent     29 Nov 25 11:08 submission\ndrwxr-xr-x  3 agent agent   4096 Nov 25 11:08 tests\n-rw-r--r--  1 agent agent 191997 Nov 25 11:08 uv.lock\n=== /lab/MANUAL.md ===\n# Lab0 manual\n\nWelcome to the lab. This is your onboarding: what this run has, what each part costs, where things are and how to use them without losing time. Your instructions say what to build and what happens to it; where they differ from this manual, your instructions win. `lab manual` prints it again at any time.\n\n## This run\n\n|  |  |\n|---|---|\n| Time | Exactly 12 hours from the start of the run. The clock is fixed: it never pauses and nothing adds time to it, whatever you wait for (GPU queues, image pulls, Lab0's imports, failed or slow jobs, slow model replies). Every run shares the same lab at once, so plan for waits. `lab status` shows the time left. |\n| Wallet | $75.00. It pays for H100 time and model calls made by your code. `lab status` shows what is spent, reserved and available. |\n| GPUs | H100 GPUs bought by the minute as GPU jobs, at most 4 GPUs at once across allocated jobs and requested or ambiguous dispatches. Confirmed unallocated queued jobs reserve wallet funds, not GPUs. |\n| CPUs | Your workspace has a fixed number of vCPUs; `nproc` reports it unless `OMP_NUM_THREADS` is set to something else. More processes or threads than vCPUs take turns on them and run slower. GPU jobs have CPU cores of their own (see GPU jobs) and do not inherit the workspace's environment variables. |\n",14753,"\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `lab status` | Time left, wallet, running jobs |\n| `lab spend` | What the wallet paid for, minute by minute, and the recent rate |\n| `lab prices` | Every price |\n| `lab manual` | This manual |\n| `lab upload`, `lab download`, `lab artifacts` | Your artifacts |\n| `lab submit`, `lab pick`, `lab submissions` | Handing in: the version handed over when time is up |\n| `lab gpu run|list|show|logs|wait|resubmit|cancel|exec|output` | GPU jobs |\n| `lab chat`, `lab models list|show` | Model calls and their routes |\n| `lab papers search|show|read|list` | The arXiv mirror (any arXiv client works too) |\n| `lab datasets search|get` | The datasets mirror |\n\n`lab COMMAND --help` describes each command's options. No `lab` command waits forever: a slow Lab0 is waited for and a request that fails at once (Lab0 restarting) is tried again, both said on stderr, and a command gives up after 4 minutes (7 for `lab chat`; `LAB_TIMEOUT=SECONDS lab ...` changes it). Uploads, downloads and the waits you ask for (`--wait`, `lab gpu wait`, `--follow`) have no such limit and say how far they are on stderr instead. `lab health` says whether the bridge and Lab0 answer."],"d":0.5}]},{"t":10.6,"$":0.0182,"c":[{"n":"bash","a":"echo \"=== MANUAL-GPU-GUIDE.md ===\" && cat /lab/MANUAL-GPU-GUIDE.md 2>/dev/null || true\necho \"=== README.md ===\" && cat README.md\necho \"=== docs/ ===\" && ls -la docs/ && for f in docs/*; do echo \"--- $f ---\"; cat \"$f\"; done","e":0,"o":["=== MANUAL-GPU-GUIDE.md ===\n# Lab0 manual: using the GPUs\n\nThis is the GPU guide of this run's Lab0 manual: how jobs run on the lab's shared cluster, their limits, and the mistakes that cost runs time and money. `/lab/MANUAL-GPU-JOBS.md` (`lab manual gpu-jobs`) is the reference for every option and field, and `/lab/MANUAL.md` has the rest. Where your instructions differ, your instructions win.\n\n## How a job runs\n\n1. `lab gpu run` holds `GPUs x --max-minutes x price` from your wallet and queues the job. Nothing is charged yet.\n2. The job waits for GPUs. Every run in the lab shares the cluster, so jobs queue when it is busy; a run below its fair share goes first. Queueing is free. Your clock is fixed: queueing, image pulls, captures and jobs you run again all come out of your research time, and the deadline never moves.\n3. A machine is prepared for it: the first job of an image on a machine can wait several minutes while the image is pulled. A job that fails here, before its container starts, is not charged.\n4. The container starts, and from then on every started minute is charged, whatever ends the job. Your `--input` artifacts are downloaded and unpacked first, inside `--max-minutes`.\n5. Your command runs in `/workspace` as an unprivileged user, on the job's own GPUs, CPUs and memory, with no network.\n6. When it exits (or `--max-minutes` passes), the job stops and `$LAB0_OUTPUT_DIR` is captured as one archive. `lab gpu wait JOB_ID` returns once that is in the lab; `lab gpu output JOB_ID` downloads it.\n\n## What a job sees\n\n- Its image and its inputs, never your workspace. Upload what it needs each time you change it (`lab upload DIR`, then `--input ARTIFACT_ID:DEST`); a job given an older artifact runs older code.\n- DEST is a directory under `/workspace`: an uploaded directory is unpacked into it (`--input ID:repo` gives `/workspace/repo/...`), and a single file lands at `/workspace/DEST/NAME`.\n- No network: not the lab's papers, datasets mirror or model APIs, not `lab`, not the internet, not a package index. Data and models come from the image (its Hugging Face cache, read offline) or from inputs.\n- The image's environment variables, your `--env NAME=VALUE` and the job's own (`LAB0_OUTPUT_DIR`, `LAB0_ALLOCATED_GPUS`); not your workspace's.\n\n## Limits\n\n|  |  |\n|---|---|\n| GPUs | at most 4 at once across your run's jobs; 1 to 8 per job |\n",26461,"d_share` (samples that hit the response limit), `merged` (how many of the rule's numbers the loop replaced by the mean over identical responses), `advantage_rms` (the numbers before rescaling, after that), `loss`, `grad_norm` (before clipping), `skipped` (no update), the time spent sampling, in the rule's `advantages` call (`rule_seconds`, as counted against the rule's allowance), updating and syncing, with `explore` and `allocate` the time in their calls (`explore_rule_seconds`, `allocate_rule_seconds`, as counted), with `allocate`, the fewest and most samples a prompt got, and with `replay`, how many entries were replayed (`replayed`), the buffer's size after the step (`replay_buffer`) and the time spent measuring the buffer and in the call (`replay_rule_seconds`, as counted). `train.json` gives `rule_seconds`, the run's rule calls in all as counted against their 1,800 seconds ([interface.md](interface.md)); `rule_sweep_seconds`, the loop's cleanup after the rule's calls, which runs only in the final run (0 in local runs) and is counted in `rule_seconds` only after a call that left something behind; and `checkpoints`, the policy evaluated for each of steps 2,000, 2,500 and 3,000."],"d":0.2}]},{"t":15.7,"$":0.0289,"c":[{"n":"bash","a":"echo \"=== docs/evaluation.md ===\" && cat docs/evaluation.md\necho \"=== docs/interface.md ===\" && cat docs/interface.md\necho \"=== configs/maze.toml ===\" && cat configs/maze.toml\necho \"=== submission/rule.py ===\" && cat submission/rule.py\necho \"=== models/maze-start/MADE.json ===\" && cat models/maze-start/MADE.json","e":0,"o":["=== docs/evaluation.md ===\n# How a trained policy is measured\n\nThe code is `raresuccesses/evaluate.py` and `raresuccesses/passk.py`.\n\n**The final run.** It trains once with the rule, from `models/maze-start` with `configs/maze.toml`, on one H100, on a new seed. The policy is measured at three points of that run, after steps 2,000, 2,500 and 3,000 (`eval_steps`; the checkpoints of [trainer.md](trainer.md)), because one policy's reading moves from step to step. If training stopped early ([interface.md](interface.md)), the policy as trained when it stopped stands in for every checkpoint the run did not reach.\n\n**The mazes.** They are new, and they are not all drawn from the training generators. They have the 17 x 17 grid, the 8 x 8 rooms, the tokens and the success rule of training, and their start and goal are two different rooms drawn uniformly, as in training, but their walls are carved in five equal shares by five methods: randomized Prim's algorithm; randomized depth-first search (the recursive backtracker: long corridors, few branches); randomized Kruskal's algorithm; Wilson's algorithm (loop-erased random walks, a uniformly random spanning tree of the rooms); and randomized Prim's with 15% of the walls left between neighbouring rooms then opened at random, so that routes can loop. The first three are the families of the training stream; the repository contains no generator of the last two. Each method's share of a set is stratified by route length (one maze from each of as many equal strata of its route lengths), so sets of held-out mazes have nearly the same mix of route lengths, long routes included. `maze.parse` reads a maze written out as `maze.render` draws it; the evaluation of `scripts/train.py` uses the Prim's generator.\n\n1. **Samples.** At each checkpoint, every held-out maze gets 256 samples from the policy, at temperature 1 with no truncation and with the training response limit (128 tokens).\n2. **Success only.** A sample counts when it succeeds ([settings.md](settings.md)); the shaped reward's partial credit counts for nothing here.\n3. **pass@k without bias.** For a maze with c successes among n = 256 samples, pass@k is estimated as 1 - C(n - c, k) / C(n, k), the chance that k samples drawn without replacement from the 256 include a success, for k = 1, 4, 16 and 64. A set's pass@k is its mean over mazes.\n4. **M** = 1/2 x pass@1 + 1/2 x mean(pass@4, pass@16, pass@64): the share solved in one run and within 4, 16 and 64.\n",12885,"\"\"\"The starting rule: GRPO's advantage on the shaped rewards.\n\nA sample's advantage is its reward minus its group's mean reward, divided by the group's standard deviation of\nrewards plus EPSILON. A group whose rewards are all equal gives every sample 0. The trainer then rescales each\nstep's advantages to unit root-mean-square (docs/interface.md).\n\"\"\"\n\nimport numpy as np\n\nEPSILON = 1e-6\n\n\ndef advantages(groups):\n    out = []\n    for group in groups:\n        rewards = group[\"rewards\"].astype(np.float64)\n        out.append((rewards - rewards.mean()) / (rewards.std() + EPSILON))\n    return out\n=== models/maze-start/MADE.json ===\n{\n \"made_by\": \"scripts/pretrain_maze.py --steps 2000 --batch 32 --lr 5e-4 --seed 0 (on one H100; v3 build step 2, sandbox sb-rjBlJcdOCIJXhgregiRaer)\",\n \"steps\": 2000,\n \"batch\": 32,\n \"lr\": 0.0005,\n \"warmup\": 0,\n \"seed\": 0,\n \"stream\": \"pretrain-0\",\n \"start\": {\n  \"pass@1\": 0.02081298828125,\n  \"bands\": {\n   \"0\": 0.734375,\n   \"(0, 0.01]\": 0.0703125,\n   \"(0.01, 0.1]\": 0.12890625,\n   \"(0.1, 0.5]\": 0.06640625,\n   \"(0.5, 1]\": 0.0\n  },\n  \"mazes\": 256,\n  \"samples\": 128\n },\n \"model_safetensors_sha256\": \"b0fcdca773e65971766ff6a2b3db80871362b6cba51c508c973ebe6b219df31e\"\n}"],"d":0.2}]},{"t":21.2,"$":0.0188,"c":[{"n":"bash","a":"for f in raresuccesses/*.py scripts/*.py; do echo \"=== $f ===\"; cat \"$f\"; done","e":0,"o":["=== raresuccesses/__init__.py ===\n\"\"\"Rare successes: an RL training loop for a maze policy that rarely succeeds, with a shaped reward and a success flag.\n\nSee the repository's README.md and docs/.\n\"\"\"\n\nimport torch\n\n# torch's cuDNN attention backend fails on some of the batch shapes this loop produces; the flash and\n# memory-efficient backends are used instead (the same mathematics).\ntorch.backends.cuda.enable_cudnn_sdp(False)\n=== raresuccesses/evaluate.py ===\n\"\"\"Evaluation of a trained policy on held-out mazes.\n\nEvery maze gets 256 samples from the policy, at temperature 1 with no truncation (the training response limit),\nand a sample counts only when it succeeds (`maze.success`; the shaped reward's partial credit counts for nothing\nhere). pass@1, pass@4, pass@16 and pass@64 are estimated without bias from the 256 (raresuccesses.passk), giving\nM. A run is evaluated at each of its checkpoints (`trainer.Result.checkpoints`: steps 2,000, 2,500 and 3,000 of\nthe run), and its level is the mean over them of the log-odds of M (`passk.level`).\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom collections import Counter\nfrom collections.abc import Callable\nfrom pathlib import Path\n\nimport torch\n\nfrom . import maze, mazemodel, passk\n\n\ndef maze_successes(model, mazes: list[maze.Maze], *, samples: int = passk.SAMPLES, seed: int = 0,\n                   max_new_tokens: int = mazemodel.MAX_NEW_TOKENS, chunk: int = 8192) -> list[int]:\n    \"\"\"Each maze's number of successes among `samples` samples of the policy.\"\"\"\n    device = next(model.parameters()).device\n    generator = torch.Generator(device=device).manual_seed(seed)\n    out = mazemodel.sample(model, [maze.prompt_tokens(m) for m in mazes], [samples] * len(mazes),\n                           generator=generator, max_new_tokens=max_new_tokens, chunk=chunk)\n    wins = Counter(s.prompt for s in out if maze.success(mazes[s.prompt], s.tokens))\n    return [wins.get(i, 0) for i in range(len(mazes))]\n\n\ndef evaluate_checkpoints(checkpoints: list[dict], mazes: list[maze.Maze], *, seed: Callable[[int], int],\n                         device: str = \"cuda\") -> dict:\n    \"\"\"A run's evaluation: each checkpoint ({\"step\", \"trained_steps\", \"model_dir\"}, as `trainer.train`\n    returns them) on `mazes`, sampled with the seed `seed(step)`. A model directory named by several checkpoints (a\n    run that stopped before them) is evaluated once, with the first one's seed.\n\n",26440,"\n    if args.resume:\n        result = train_resumably(cfg, args, new_setting)\n    else:\n        result = train(cfg, new_setting(cfg.path(cfg.model)), args.rule, args.out, seed=args.seed)\n    print(json.dumps({\"train\": {k: v for k, v in result.__dict__.items() if k not in (\"state\", \"optimizer\")}}),\n          flush=True)\n    if not args.no_eval:\n        mazes = maze.stream(args.eval_stream, 0, args.eval_mazes)\n        report = evaluate.evaluate_checkpoints(result.checkpoints, mazes, seed=lambda step: args.seed,\n                                               device=args.device)\n        Path(args.out, \"eval.json\").write_text(json.dumps(report) + \"\\n\")\n        print(json.dumps({\"level\": report[\"level\"],\n                          \"checkpoints\": [{k: v for k, v in row.items() if k != \"successes\"}\n                                          for row in report[\"checkpoints\"]]}), flush=True)\n        if os.environ.get(\"LAB0_OUTPUT_DIR\"):  # a Lab0 job reports the level as its metric\n            Path(os.environ[\"LAB0_OUTPUT_DIR\"], \"metric.json\").write_text(json.dumps({\"value\": report[\"level\"]}) + \"\\n\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())"],"d":0.3}]},{"t":28.3,"$":0.033,"c":[{"n":"bash","a":"for f in raresuccesses/mazemodel.py raresuccesses/passk.py raresuccesses/rulehost.py raresuccesses/settings.py raresuccesses/trainer.py raresuccesses/verl_loss.py; do echo \"=== $f ===\"; cat \"$f\"; done","e":0,"o":["=== raresuccesses/mazemodel.py ===\n\"\"\"The maze policy: a small decoder-only transformer (the Qwen2 architecture) and its sampler.\n\n4 layers, hidden size 256, feed-forward size 1024, 4 attention heads with 2 key-value heads, RMSNorm,\nSiLU, rotary position embeddings (theta 1e6), at most 512 positions, the maze's 32-token vocabulary and\ntied input and output embeddings: 3.9M parameters. The starting model (models/maze-start/) was trained\nfrom scratch on shortest paths by scripts/pretrain_maze.py.\n\n`sample` draws responses at the requested temperature (default 1, no truncation): each prompt is\nrun once, its key-value cache is shared by all of its samples, and a sample ends at DONE or after\n`max_new_tokens` tokens. It returns every sample's tokens and the sum of their log-probabilities.\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom dataclasses import dataclass\nfrom pathlib import Path\n\nimport torch\nfrom transformers import Qwen2Config, Qwen2ForCausalLM\n\nfrom . import maze\n\nMAX_NEW_TOKENS = 128  # the longest simple path in a 17 x 17 maze is 126 moves, plus DONE\nCOMPACT_EVERY = 8     # decoding steps between dropping finished samples from the batch\n\n\ndef config() -> Qwen2Config:\n    return Qwen2Config(vocab_size=maze.VOCAB_SIZE, hidden_size=256, intermediate_size=1024, num_hidden_layers=4,\n                       num_attention_heads=4, num_key_value_heads=2, hidden_act=\"silu\", max_position_embeddings=512,\n                       rms_norm_eps=1e-6, tie_word_embeddings=True, attention_dropout=0.0,\n                       rope_parameters={\"rope_type\": \"default\", \"rope_theta\": 1e6},\n                       pad_token_id=maze.PAD, bos_token_id=maze.GRID_START, eos_token_id=maze.DONE)\n\n\ndef new_model() -> Qwen2ForCausalLM:\n    return Qwen2ForCausalLM(config())\n\n\ndef load(path: str | Path, device: str | torch.device = \"cpu\") -> Qwen2ForCausalLM:\n    \"\"\"A saved maze model (config.json and model.safetensors), as float32 for training.\"\"\"\n    model = Qwen2ForCausalLM.from_pretrained(str(path), dtype=torch.float32, attn_implementation=\"sdpa\")\n    return model.to(device)\n\n\n@dataclass\nclass Sample:\n    prompt: int            # index of its prompt\n    tokens: list[int]      # the response, ending with DONE when it finished\n    logprob: float         # sum of the response tokens' log-probabilities under the sampling policy\n    finished: bool\n\n\n@torch.no_grad()\ndef sample(model: Qwen2ForCausalLM, prompts: list[list[int]], counts: list[int], *, generator: torch.Generator,\n",26354,"    assert clip_ratio_c > 1.0, f\"clip_ratio_c must be greater than 1.0, got {clip_ratio_c}\"\n\n    negative_approx_kl = torch.clamp(log_prob - old_log_prob, min=-20.0, max=20.0)\n    ratio = torch.exp(negative_approx_kl)\n    ppo_kl = masked_mean(-negative_approx_kl, response_mask)\n\n    pg_losses1 = -advantages * ratio\n    pg_losses2 = -advantages * torch.clamp(ratio, 1 - cliprange_low, 1 + cliprange_high)\n    clip_pg_losses1 = torch.maximum(pg_losses1, pg_losses2)\n    pg_clipfrac = masked_mean(torch.gt(pg_losses2, pg_losses1).float(), response_mask)\n\n    pg_losses3 = -advantages * clip_ratio_c\n    clip_pg_losses2 = torch.min(pg_losses3, clip_pg_losses1)\n    pg_clipfrac_lower = masked_mean(torch.gt(clip_pg_losses1, pg_losses3) * (advantages < 0).float(), response_mask)\n\n    pg_losses = torch.where(advantages < 0, clip_pg_losses2, clip_pg_losses1)\n    pg_loss = agg_loss(pg_losses, response_mask, loss_agg_mode, batch_num_tokens=batch_num_tokens,\n                       global_batch_size=global_batch_size)\n    return pg_loss, {\"pg_clipfrac\": float(pg_clipfrac.detach()), \"ppo_kl\": float(ppo_kl.detach()),\n                     \"pg_clipfrac_lower\": float(pg_clipfrac_lower.detach())}"],"d":0.2}]},{"t":32.5,"$":0.0341,"c":[{"n":"bash","a":"echo \"=== raresuccesses/settings.py ===\" && cat raresuccesses/settings.py\necho \"=== raresuccesses/trainer.py (lines 1-420) ===\" && sed -n '1,420p' raresuccesses/trainer.py\necho \"=== raresuccesses/maze.py (tail) ===\" && tail -n 100 raresuccesses/maze.py","e":0,"o":["=== raresuccesses/settings.py ===\n\"\"\"The maze setting, as the training loop and the evaluation see it.\n\nA setting supplies the policy (a torch model), each step's prompts, generation, the reward, success and what\nhappens after an update. A prompt's id is opaque: a digest of the problem and a salt drawn from the run's seed,\nthe same every time the problem returns within the run, and unrelated to the problem's name in any file.\n\nA run trains on a pool of `pool_size` mazes named after the run's seed (`maze.training_pool`). The steps visit the\npool in epochs: each epoch takes every maze of the pool once, in an order drawn afresh for the epoch, so each maze\nreturns once an epoch, under the same id. Two runs with different seeds share no maze (in practice: the chance that\ntwo generated mazes coincide is negligible). Without a pool (`pool_size` None), every step takes the next\n`prompts_per_step` mazes of a stream named after the seed, and no maze returns. The sampler is `mazemodel.sample`,\nthe policy itself.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport hashlib\nfrom dataclasses import dataclass, field\nfrom pathlib import Path\n\nimport torch\n\nfrom . import maze\n\n\ndef opaque_id(seed: int, setting: str, key: str) -> str:\n    \"\"\"The id the rule sees for a problem in a run: a salted digest, so it names no problem in any file.\"\"\"\n    salt = hashlib.sha256(f\"prompt-ids\\0{int(seed)}\".encode()).hexdigest()\n    return f\"{setting}/\" + hashlib.sha256(f\"{salt}\\0{key}\".encode()).hexdigest()[:16]\n\n\n@dataclass\nclass Prompt:\n    id: str\n    tokens: list[int]\n    item: object = field(repr=False)   # the maze.Maze\n\n\n@dataclass\nclass Response:\n    prompt: int          # index into the step's prompts\n    tokens: list[int]\n    logprob: float\n    finished: bool\n    text: str = \"\"\n    temperature: float = 1.0\n\n\nclass MazeSetting:\n    name = \"maze\"\n    shared_prompts = True  # every prompt has the same length (the 17 x 17 grid)\n\n    def __init__(self, model_dir: str | Path, *, seed: int, prompts_per_step: int, max_new_tokens: int,\n                 device: str = \"cuda\", stream_prefix: str = \"train\", pool_size: int | None = None):\n        from . import mazemodel\n\n        if torch.device(device).type == \"cuda\":\n            # Sampling grows each step's key-value cache token by token; expandable segments keep the CUDA\n            # allocator from fragmenting (memory only: the arithmetic is unchanged).\n            try:\n",26417,"    goals = [cell for cell, ch in cells.items() if ch == \"G\"]\n    if len(starts) != 1 or len(goals) != 1:\n        raise ValueError(\"a maze has one start and one goal\")\n    walls = tuple(tuple(cells[(r, c)] == \"#\" for c in range(SIZE)) for r in range(SIZE))\n    return Maze(walls, starts[0], goals[0], int(seed))\n\n\ndef render(maze: Maze, response: list[int] | None = None) -> str:\n    \"\"\"The maze as text (# wall, . path, S start, G goal, * cells a response visits), for reading.\"\"\"\n    seen = set()\n    if response:\n        r, c = maze.start\n        for token in response:\n            step = MOVES.get(int(token))\n            if step is None:\n                break\n            r, c = r + step[0], c + step[1]\n            if maze.is_wall(r, c):\n                break\n            seen.add((r, c))\n    rows = []\n    for r in range(SIZE):\n        row = \"\"\n        for c in range(SIZE):\n            if (r, c) == maze.start:\n                row += \"S\"\n            elif (r, c) == maze.goal:\n                row += \"G\"\n            elif maze.walls[r][c]:\n                row += \"#\"\n            else:\n                row += \"*\" if (r, c) in seen else \".\"\n        rows.append(row)\n    return \"\\n\".join(rows)"],"d":0.2}]},{"t":37,"$":0.0348,"c":[{"n":"bash","a":"echo \"=== trainer.py lines 185-260 ===\" && sed -n '185,260p' raresuccesses/trainer.py\necho \"=== trainer.py lines 410-580 ===\" && sed -n '410,580p' raresuccesses/trainer.py\necho \"=== pytest ===\" && python -m pytest -q tests","e":0,"o":["=== trainer.py lines 185-260 ===\n            raise RuleError(f\"advantages() must return {size} numbers for group {group}\")\n        try:\n            array = np.asarray(item, dtype=np.float64)\n        except (TypeError, ValueError, OverflowError):\n            raise RuleError(f\"advantages() returned something that is not a number for group {group}\") from None\n        if array.shape != (size,) or not np.all(np.isfinite(array)):\n            raise RuleError(f\"advantages() returned a non-finite number for group {group}\")\n        parts.append(array)\n    flat = np.concatenate(parts) if parts else np.zeros(0)\n    if not np.isfinite(np.sqrt(np.mean(np.square(flat)))):\n        raise RuleError(\"advantages() returned numbers too large to rescale\")\n    return flat\n\n\ndef check_replay(value, count: int, most: int, advantages: np.ndarray | None = None) -> tuple[np.ndarray, list[bool]]:\n    \"\"\"`replay()`'s answer: {\"weights\": one finite number per entry, \"keep\": one bool per entry (optional: all kept)},\n    with at most `most` nonzero numbers; together with the step's `advantages`, numbers whose root-mean-square is\n    finite.\"\"\"\n    if not isinstance(value, dict) or \"weights\" not in value:\n        raise RuleError(\"replay() must return a dict with \\\"weights\\\" (and optionally \\\"keep\\\")\")\n    weights = value[\"weights\"]\n    if not isinstance(weights, list) or len(weights) != count:\n        raise RuleError(f\"replay() must return {count} weights, one per entry\")\n    try:\n        array = np.asarray(weights, dtype=np.float64)\n    except (TypeError, ValueError, OverflowError):\n        raise RuleError(\"replay() returned a weight that is not a number\") from None\n    if array.shape != (count,) or not np.all(np.isfinite(array)):\n        raise RuleError(\"replay() returned a non-finite weight\")\n    if int(np.count_nonzero(array)) > most:\n        raise RuleError(f\"replay() gave {int(np.count_nonzero(array))} entries a nonzero weight; at most {most} may\")\n    combined = array if advantages is None else np.concatenate([advantages, array])\n    with np.errstate(over=\"ignore\"):\n        if not np.isfinite(np.sqrt(np.mean(np.square(combined)))):\n            raise RuleError(\"replay() returned weights too large to rescale with the step's advantages\")\n    keep = value.get(\"keep\", [True] * count)\n    if not isinstance(keep, list) or len(keep) != count or any(not isinstance(k, bool) for k in keep):\n        raise RuleError(f\"replay() must return {count} keep flags (true or false), one per entry\")\n",11922,"            if on_step is not None:\n                on_step(step, setting)\n            if step % 10 == 0 or step == cfg.steps - 1:\n                log(f\"[{setting.name}] step {step}: reward {row['reward_mean']:.3f}, success {row['success_mean']:.3f}, \"\n                    f\"solved {row['solved_share']:.2f}, {row['seconds']:.1f} s\")\n    finally:\n        metrics_file.close()\n        if rule is not None:\n            rule.close()\n    model_dir = out / \"model\"\n    save(setting, model_dir)\n    steps_done = state.stopped[\"step\"] if state.stopped else state.next_step\n    result = Result(setting.name, seed, steps_done, state.updates, state.stopped,\n=== pytest ===\n...............................................................          [100%]\n=============================== warnings summary ===============================\ntests/test_trainer.py::test_advantages_must_be_one_finite_number_per_sample\n  /workspace/repo/raresuccesses/trainer.py:194: RuntimeWarning: overflow encountered in square\n    if not np.isfinite(np.sqrt(np.mean(np.square(flat)))):\n\n-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html\n63 passed, 1 warning in 213.72s (0:03:33)"],"d":215.9}]},{"t":260.2,"$":0.1594,"c":[{"n":"bash","a":"lab status && echo \"=== git log ===\" && git log -n 5 && echo \"=== rulehost.py lines 125-300 ===\" && sed -n '125,300p' raresuccesses/rulehost.py","e":0,"o":["{\n  \"attempt_id\": \"attempt_…\",\n  \"status\": \"running\",\n  \"time_left_seconds\": 42939.31732368469,\n  \"deadline\": 1795650413.2523553,\n  \"deadline_iso\": \"2026-11-25T23:46:53.252355Z\",\n  \"clock_credit_seconds\": 0.0,\n  \"clock_mode\": \"fixed\",\n  \"take_backs\": 0,\n  \"last_take_back_at\": null,\n  \"open_stalls\": [],\n  \"wallet\": {\n    \"budget\": 75000000,\n    \"spent\": 0,\n    \"reserved\": 0,\n    \"available\": 75000000\n  },\n  \"running_jobs\": [],\n  \"queued_jobs\": [],\n  \"gpu_capacity\": null,\n  \"importing_outputs\": [],\n  \"research_seconds\": 43200,\n  \"started_at\": 1795607213.2523553,\n  \"started_at_iso\": \"2026-11-25T11:46:53.252355Z\",\n  \"fixed_gpus\": 0,\n  \"offer\": {\n    \"compute\": \"market\",\n    \"fixed_gpus\": 0,\n    \"fixed_gpu_window_seconds\": null,\n    \"max_gpus\": 4,\n    \"skus\": [\n      \"sf.h100.batch\",\n      \"sf.h100.node\",\n      \"openrouter.anthropic/claude-sonnet-5.5\",\n      \"openrouter.anthropic/claude-haiku-5.5\",\n      \"openrouter.openai/gpt-6-luna\",\n      \"openrouter.google/gemini-3.8-flash\",\n      \"openrouter.qwen/qwen3.8-max-prime\",\n      \"openrouter.qwen/qwen3.8-flash\",\n      \"openrouter.z-ai/glm-5.3-prime\",\n      \"library.query\",\n      \"library.fulltext\"\n    ],\n    \"images\": [\n      \"research\"\n    ],\n    \"default_image\": \"research\",\n    \"models\": [\n      \"anthropic/claude-sonnet-5.5\",\n      \"anthropic/claude-haiku-5.5\",\n      \"openai/gpt-6-luna\",\n      \"google/gemini-3.8-flash\",\n      \"qwen/qwen3.8-max-prime\",\n      \"qwen/qwen3.8-flash\",\n      \"z-ai/glm-5.3-prime\"\n    ],\n    \"model_billing\": \"provider-cost-v1\",\n    \"audio_models\": [],\n    \"speech_models\": [],\n    \"tinker\": null,\n    \"library\": {\n      \"served_through\": \"2026-01-25\",\n      \"withheld\": false\n    },\n    \"datasets\": {\n      \"offered\": true\n    },\n    \"validations\": null,\n    \"deliverables\": {\n      \"max_bytes\": 16777216,\n      \"paths\": [\n        \"submission\"\n      ]\n    }\n  },\n  \"selection\": {\n    \"submission_id\": null,\n    \"selected_at\": null,\n    \"selected_at_iso\": null,\n    \"frozen\": false\n  },\n  \"features\": [\n    \"background-submit\"\n  ]\n}\n=== git log ===\ncommit 27bdbd820e093a748af78f6f35ecc689ef9d3ef5\nAuthor: Research <research@lab.invalid>\nDate:   Wed Nov 25 11:46:46 2026 +0000\n\n    Import research repository\n=== rulehost.py lines 125-300 ===\n        return [_jsonable(item) for item in value]\n    if isinstance(value, dict):   # replay's answer: its \"weights\" and \"keep\" may be arrays too\n        return {key: _jsonable(item) for key, item in value.items()}\n",6228,"            except OSError:\n                pass\n    return pids\n\n\ndef writable_dirs(user: int) -> list[str]:\n    \"\"\"Directories the user could create entries in: /tmp, /var/tmp, /dev/shm and any other directory on\n    the root file system that is world-writable or owned by the user (found once, when the host starts).\n\n    A link is never one of them: on Linux every link reports mode 0777 whatever it points at, and a real directory\n    it points at is visited under its own path (os.walk does not follow links).\"\"\"\n    found = [d for d in CLEAN_DIRS if os.path.isdir(d)]\n    for root, dirs, _ in os.walk(\"/\", topdown=True):\n        if root in (\"/proc\", \"/sys\", \"/dev\") or root.startswith((\"/proc/\", \"/sys/\", \"/dev/\")):\n            dirs[:] = []\n            continue\n        for name in list(dirs):\n            path = os.path.join(root, name)\n            try:\n                info = os.lstat(path)\n            except OSError:\n                continue\n            if not stat.S_ISDIR(info.st_mode):\n                continue\n            if (info.st_mode & 0o002 or info.st_uid == user) and path not in found:\n                found.append(path)\n    return found"],"d":0.7}]},{"t":309.6,"$":0.09,"c":[{"n":"bash","a":"ls -la tests/ models/maze-start/ && cat pyproject.toml && python -c \"import torch, numpy, scipy; print('torch:', torch.__version__, 'cuda:', torch.cuda.is_available(), 'np:', numpy.__version__)\" 2>&1 || python -c \"import torch, numpy; print('torch:', torch.__version__, 'cuda:', torch.cuda.is_available(), 'np:', numpy.__version__)\"","e":0,"o":"models/maze-start/:\ntotal 15418\ndrwxr-xr-x 2 agent agent      117 Nov  1 08:09 .\ndrwxr-xr-x 3 agent agent       32 Nov  1 08:09 ..\n-rw-r--r-- 1 agent agent      565 Nov  1 08:09 MADE.json\n-rw-r--r-- 1 agent agent      823 Nov  1 08:09 config.json\n-rw-r--r-- 1 agent agent      217 Nov  1 08:09 generation_config.json\n-rw-r--r-- 1 agent agent 15784144 Nov  1 08:09 model.safetensors\n\ntests/:\ntotal 75\ndrwxr-xr-x  1 agent agent  4096 Nov 25 11:08 .\ndrwxr-xr-x 11 agent agent  4096 Nov 25 11:51 ..\n-rw-r--r--  1 agent agent    98 Nov 25 11:08 conftest.py\ndrwxr-xr-x  1 agent agent    37 Nov 25 11:08 fixtures\n-rw-r--r--  1 agent agent  9408 Nov 25 11:08 test_maze.py\n-rw-r--r--  1 agent agent  1524 Nov 25 11:08 test_passk.py\n-rw-r--r--  1 agent agent  6693 Nov 25 11:08 test_rulehost.py\n-rw-r--r--  1 agent agent  1696 Nov 25 11:08 test_rulehost_cleanup.py\n-rw-r--r--  1 agent agent  8815 Nov 25 11:08 test_rulehost_sweep.py\n-rw-r--r--  1 agent agent 37796 Nov 25 11:08 test_trainer.py\n[project]\nname = \"raresuccesses\"\nversion = \"3.0.0\"\ndescription = \"Rare successes: an RL training loop for a maze policy that rarely succeeds, with a shaped reward and a success flag\"\nrequires-python = \">=3.12\"\n# The images install the same versions.\ndependencies = [\"numpy>=2\", \"torch==2.13.0\", \"transformers==5.17.0\", \"safetensors>=0.6\"]\n\n[dependency-groups]\ndev = [\"pytest>=8\"]\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"raresuccesses\"]\n\n[tool.pytest.ini_options]\ntestpaths = [\"tests\"]\nTraceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'scipy'\ntorch: 2.13.0+cu130 cuda: False np: 2.5.4","d":7.4}]},{"t":334.3,"$":0.0489,"c":[{"n":"bash","a":"lab prices && echo \"=== MANUAL-PAPERS-AND-DATA.md ===\" && cat /lab/MANUAL-PAPERS-AND-DATA.md 2>/dev/null || true","e":0,"o":["{\n  \"currency\": \"microUSD (1,000,000 = $1)\",\n  \"skus\": [\n    {\n      \"id\": \"sf.h100.batch\",\n      \"department\": \"compute\",\n      \"supplier\": \"sfcompute\",\n      \"title\": \"H100 batch job\",\n      \"unit\": \"gpu_minute\",\n      \"microusd\": 63000,\n      \"shape\": {\n        \"gpus\": [\n          1,\n          2,\n          3,\n          4,\n          5,\n          6,\n          7,\n          8\n        ],\n        \"max_minutes\": 720\n      },\n      \"notes\": \"Charged per GPU per allocated minute, rounded up, from start to confirmed stop; queue time is free. Reserved when submitted: gpus x max_minutes x price. Each H100 GPU of a job brings 26 CPU threads (13 physical cores; 24 threads on one GPU of each host) and about 233 GiB of RAM, held for that job alone: N GPUs bring N times that. `nproc` and `len(os.sched_getaffinity(0))` give the job's real CPU count; size worker pools by them. `os.cpu_count()` gives the host's 208 before Python 3.13 (from 3.13 Lab0's `PYTHON_CPU_COUNT` makes it the job's). A job that uses more memory than its share is stopped (out of memory).\",\n      \"per_gpu\": {\n        \"cpu_threads\": 26,\n        \"cpu_threads_least\": 24,\n        \"memory_gib\": 233\n      }\n    },\n    {\n      \"id\": \"sf.h100.node\",\n      \"department\": \"compute\",\n      \"supplier\": \"sfcompute\",\n      \"title\": \"H100 interactive node\",\n      \"unit\": \"gpu_minute\",\n      \"microusd\": 84000,\n      \"shape\": {\n        \"gpus\": [\n          1,\n          8\n        ],\n        \"max_minutes\": 720\n      },\n      \"notes\": \"Charged per GPU per allocated minute, rounded up, from start to confirmed stop; queue time is free. Reserved when submitted: gpus x max_minutes x price. Each H100 GPU of a job brings 26 CPU threads (13 physical cores; 24 threads on one GPU of each host) and about 233 GiB of RAM, held for that job alone: N GPUs bring N times that. `nproc` and `len(os.sched_getaffinity(0))` give the job's real CPU count; size worker pools by them. `os.cpu_count()` gives the host's 208 before Python 3.13 (from 3.13 Lab0's `PYTHON_CPU_COUNT` makes it the job's). A job that uses more memory than its share is stopped (out of memory).\",\n      \"per_gpu\": {\n        \"cpu_threads\": 26,\n        \"cpu_threads_least\": 24,\n        \"memory_gib\": 233\n      }\n    },\n    {\n      \"id\": \"openrouter.anthropic/claude-sonnet-5.5\",\n      \"department\": \"models\",\n      \"supplier\": \"openrouter\",\n      \"title\": \"anthropic/claude-sonnet-5.5\",\n      \"unit\": \"million_tokens\",\n      \"microusd\": {\n        \"input\": 2000000,\n",12677,"- Each mirrored repository has one revision, the pinned commit, which `main` names. Download and like counts are 0. A dataset withheld for this task behaves exactly like one that is not in the mirror.\n- Free. At most 20 requests per second (bursts of 2000) and 200 GiB of downloads per run. Every request is logged.\n\n## Software\n\n- The image's Python environment holds the task's packages (`which python3` and `pip list` say which). GPU jobs run in this run's images, with their packages, not those you install here.\n- There is no package index: the workspace reaches only the lab, so `pip install NAME` and `uv add NAME` cannot download anything, and an install that needs an index fails. Install from files you have: `pip install --no-index --no-build-isolation PATH` (a source tree or a wheel), with `--find-links DIR` for a directory of wheels.\n- Your own code needs no install: keep it beside your script or on `PYTHONPATH`, and give it to a GPU job as an input."],"d":0.7}]},{"t":342,"$":0.0352,"c":[{"n":"bash","a":"lab papers search '(ti:\"pass@k\" OR abs:\"pass@k\") AND (abs:\"GRPO\" OR abs:\"advantage\" OR abs:\"reinforcement learning\")' --max 15 && echo \"---\" && lab papers search '(ti:\"GRPO\" OR ti:\"advantage\") AND (abs:\"sparse\" OR abs:\"rare\" OR abs:\"replay\" OR abs:\"exploration\")' --max 15","e":0,"o":["{\n  \"total\": 60,\n  \"start\": 0,\n  \"entries\": [\n    {\n      \"id\": \"2510.23049v2\",\n      \"title\": \"Advantage Shaping as Surrogate Reward Maximization: Unifying Pass@K Policy Gradients\",\n      \"authors\": [\n        \"Christos Thrampoulidis\",\n        \"Sadegh Mahdavi\",\n        \"Wenlong Deng\"\n      ],\n      \"published\": \"2025-10-27T06:24:56Z\",\n      \"updated\": \"2025-11-14T07:48:25Z\",\n      \"categories\": [\n        \"cs.LG\",\n        \"cs.AI\"\n      ],\n      \"primary_category\": \"cs.LG\",\n      \"summary\": \"This note reconciles two seemingly distinct approaches to policy gradient optimization for the Pass@K objective in reinforcement learning with verifiable rewards: (1) direct REINFORCE-style methods, and (2) advantage-shaping techniques that directly modify GRPO. We show that these are two sides of the same coin. By reverse-engineering existing advantage-shaping algorithms, we reveal that they implicitly optimize surrogate rewards. We specifically interpret practical \\\"hard-example up-weighting\\\" modifications to GRPO as reward-level regularization. Conversely, starting from surrogate reward objectives, we provide a simple recipe for deriving both existing and new advantage-shaping methods. This perspective provides a lens for RLVR policy gradient optimization beyond our original motivation of Pass@K.\"\n    },\n    {\n      \"id\": \"2508.10751v1\",\n      \"title\": \"Pass@k Training for Adaptively Balancing Exploration and Exploitation of Large Reasoning Models\",\n      \"authors\": [\n        \"Zhipeng Chen\",\n        \"Xiaobo Qin\",\n        \"Youbin Wu\",\n        \"Yue Ling\",\n        \"Qinghao Ye\",\n        \"Wayne Xin Zhao\",\n        \"Guang Shi\"\n      ],\n      \"published\": \"2025-08-14T15:34:47Z\",\n      \"updated\": \"2025-08-14T15:34:47Z\",\n      \"categories\": [\n        \"cs.LG\",\n        \"cs.AI\",\n        \"cs.CL\"\n      ],\n      \"primary_category\": \"cs.LG\",\n      \"summary\": \"Reinforcement learning with verifiable rewards (RLVR), which typically adopts Pass@1 as the reward, has faced the issues in balancing exploration and exploitation, causing policies to prefer conservative actions, converging to a local optimum. Identifying an appropriate reward metric is therefore crucial. Regarding the prior work, although Pass@k has been used in evaluation, its connection to LLM exploration ability in RLVR remains largely overlooked. To investigate this, we first use Pass@k as the reward to train the policy model (i.e., $\\\\textbf{Pass@k Training}$), and observe the improvement on its exploration ability. Next, ",26339,"ror feedback and self-correct. This brittleness hinders reliable real-world deployment, where the execution errors are inherently inevitable during tool interaction procedures. We identify a key limitation of current approaches: standard reinforcement learning (RL) treats errors as sparse negative rewards, providing no guidance on how to recover, while pre-collected synthetic error-correction datasets suffer from distribution mismatch with the model's on-policy error modes. To bridge this gap, we propose Fission-GRPO, a framework that converts execution errors into corrective supervision within the RL training loop. Our core mechanism fissions each failed trajectory into a new training instance by augmenting it with diagnostic feedback from a finetuned Error Simulator, then resampling recovery rollouts on-policy. This enables the model to learn from the precise errors it makes during exploration, rather than from static, pre-collected error cases. On the BFCL v4 Multi-Turn, Fission-GRPO improves the error recovery rate of Qwen3-8B by 5.7% absolute, crucially, yielding a 4% overall accuracy gain (42.75% to 46.75%) over GRPO and outperforming specialized tool-use agents.\"\n    }\n  ]\n}"],"d":1.8}]},{"t":348.9,"$":0.0388,"c":[{"n":"bash","a":"lab papers search '(abs:\"GRPO\" OR abs:\"RLVR\") AND (ti:\"replay\" OR abs:\"experience replay\" OR ti:\"off-policy\")' --max 10 && echo \"---\" && lab papers search '(abs:\"GRPO\" OR abs:\"RLVR\") AND (abs:\"rollout allocation\" OR abs:\"sample allocation\" OR ti:\"budget\" OR abs:\"dynamic sampling\")' --max 10","e":0,"o":["{\n  \"total\": 17,\n  \"start\": 0,\n  \"entries\": [\n    {\n      \"id\": \"2504.14945v5\",\n      \"title\": \"Learning to Reason under Off-Policy Guidance\",\n      \"authors\": [\n        \"Jianhao Yan\",\n        \"Yafu Li\",\n        \"Zican Hu\",\n        \"Zhi Wang\",\n        \"Ganqu Cui\",\n        \"Xiaoye Qu\",\n        \"Yu Cheng\",\n        \"Yue Zhang\"\n      ],\n      \"published\": \"2025-04-21T08:09:13Z\",\n      \"updated\": \"2025-06-22T00:18:09Z\",\n      \"categories\": [\n        \"cs.LG\",\n        \"cs.AI\",\n        \"cs.CL\"\n      ],\n      \"primary_category\": \"cs.LG\",\n      \"summary\": \"Recent advances in large reasoning models (LRMs) demonstrate that sophisticated behaviors such as multi-step reasoning and self-reflection can emerge via reinforcement learning with verifiable rewards~(\\\\textit{RLVR}). However, existing \\\\textit{RLVR} approaches are inherently ``on-policy'', limiting learning to a model's own outputs and failing to acquire reasoning abilities beyond its initial capabilities. To address this issue, we introduce \\\\textbf{LUFFY} (\\\\textbf{L}earning to reason \\\\textbf{U}nder o\\\\textbf{FF}-polic\\\\textbf{Y} guidance), a framework that augments \\\\textit{RLVR} with off-policy reasoning traces. LUFFY dynamically balances imitation and exploration by combining off-policy demonstrations with on-policy rollouts during training. Specifically, LUFFY combines the Mixed-Policy GRPO framework, which has a theoretically guaranteed convergence rate, alongside policy shaping via regularized importance sampling to avoid superficial and rigid imitation during mixed-policy training. Compared with previous RLVR methods, LUFFY achieves an over \\\\textbf{+6.4} average gain across six math benchmarks and an advantage of over \\\\textbf{+6.2} points in out-of-distribution tasks. Most significantly, we show that LUFFY successfully trains weak models in scenarios where on-policy RLVR completely fails. These results provide compelling evidence that LUFFY transcends the fundamental limitations of on-policy RLVR and demonstrates the great potential of utilizing off-policy guidance in RLVR.\"\n    },\n    {\n      \"id\": \"2506.22200v5\",\n      \"title\": \"EFRame: Deeper Reasoning via Exploration-Filter-Replay Reinforcement Learning Framework\",\n      \"authors\": [\n        \"Chen Wang\",\n        \"Lai Wei\",\n        \"Yanzhi Zhang\",\n        \"Chenyang Shao\",\n        \"Zedong Dan\",\n        \"Weiran Huang\",\n        \"Yuzhi Zhang\",\n        \"Yue Wang\"\n      ],\n      \"published\": \"2025-06-27T13:09:05Z\",\n",26377,"ek R1-like performance. However, recent studies reveal a persistent overthinking phenomenon in state-of-the-art reasoning models, manifesting as excessive redundancy or repetitive thinking patterns in long CoT responses. To address this issue, in this paper, we propose a simple yet effective two-stage reinforcement learning framework for achieving concise reasoning in LLMs, named ConciseR. Specifically, the first stage, using more training steps, aims to incentivize the model's reasoning capabilities via Group Relative Policy Optimization with clip-higher and dynamic sampling components (GRPO++), and the second stage, using fewer training steps, explicitly enforces conciseness and improves efficiency via Length-aware Group Relative Policy Optimization (L-GRPO). Significantly, ConciseR only optimizes response length once all rollouts of a sample are correct, following the \\\"walk before you run\\\" principle. Extensive experimental results demonstrate that our ConciseR model, which generates more concise CoT reasoning responses, outperforms recent state-of-the-art reasoning models with zero RL paradigm across AIME 2024, MATH-500, AMC 2023, Minerva, and Olympiad benchmarks.\"\n    }\n  ]\n}"],"d":1.3}]},{"t":386.7,"$":0.1016,"c":[{"n":"bash","a":"mkdir -p tools\ncat <<'EOF' > tools/eval5.py\n\"\"\"5-family route-length stratified evaluation benchmark matching docs/evaluation.md.\n\nFamilies (equal shares):\n  1. prim        : randomized Prim's algorithm (training: 50%)\n  2. depth_first : randomized DFS / recursive backtracker (training: 25%)\n  3. kruskal     : randomized Kruskal's algorithm (training: 25%)\n  4. wilson      : Wilson's algorithm (loop-erased random walks; OOD)\n  5. prim_loops  : Prim's with 15% of remaining walls between neighboring rooms opened (OOD)\n\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport json\nimport sys\nimport time\nfrom pathlib import Path\n\nimport numpy as np\n\nREPO = Path(__file__).resolve().parents[1]\nsys.path.insert(0, str(REPO))\n\nfrom raresuccesses import evaluate, maze, mazemodel, passk\n\nFAMILIES = (\"prim\", \"depth_first\", \"kruskal\", \"wilson\", \"prim_loops\")\n\n\ndef generate_wilson(seed: int) -> maze.Maze:\n    \"\"\"Wilson's algorithm: uniformly random spanning tree on the 8x8 room grid.\"\"\"\n    rng = np.random.default_rng(seed)\n    walls = np.ones((maze.SIZE, maze.SIZE), dtype=bool)\n    walls[1::2, 1::2] = False\n    n = maze.ROOMS * maze.ROOMS\n\n    def neighbors(a: int) -> list[int]:\n        r, c = divmod(a, maze.ROOMS)\n        out = []\n        for dr, dc in ((-1, 0), (1, 0), (0, -1), (0, 1)):\n            nr, nc = r + dr, c + dc\n            if 0 <= nr < maze.ROOMS and 0 <= nc < maze.ROOMS:\n                out.append(nr * maze.ROOMS + nc)\n        return out\n\n    nbrs = [neighbors(a) for a in range(n)]\n    root = int(rng.integers(n))\n    in_tree = {root}\n    unvisited = [a for a in range(n) if a != root]\n    rng.shuffle(unvisited)\n    for start_node in unvisited:\n        if start_node in in_tree:\n            continue\n        nxt: dict[int, int] = {}\n        cur = start_node\n        while cur not in in_tree:\n            choices = nbrs[cur]\n            step = choices[int(rng.integers(len(choices)))]\n            nxt[cur] = step\n            cur = step\n        cur = start_node\n        while cur not in in_tree:\n            in_tree.add(cur)\n            step = nxt[cur]\n            ar, ac = divmod(cur, maze.ROOMS)\n            br, bc = divmod(step, maze.ROOMS)\n            walls[ar + br + 1, ac + bc + 1] = False\n            cur = step\n\n    rooms = rng.choice(n, size=2, replace=False)\n    start = (2 * int(rooms[0] // maze.ROOMS) + 1, 2 * int(rooms[0] % maze.ROOMS) + 1)\n    goal = (2 * int(rooms[1] // maze.ROOMS) + 1, 2 * int(rooms[1] % maze.ROOMS) + 1)\n    return maze.Maze(tuple(tuple(bool(x) for x in row) for row in walls), start, goal, int(seed))\n\n\ndef generate_prim_loops(seed: int, open_frac: float = 0.15) -> maze.Maze:\n    \"\"\"Randomized Prim's with 15% of remaining walls between neighboring rooms opened at random.\"\"\"\n    base = maze.generate(seed)\n    walls = np.array(base.walls, dtype=bool)\n    closed = []\n    for i in range(maze.ROOMS):\n        for j in range(maze.ROOMS):\n            if i + 1 < maze.ROOMS and walls[2 * i + 2, 2 * j + 1]:\n                closed.append((2 * i + 2, 2 * j + 1))\n            if j + 1 < maze.ROOMS and walls[2 * i + 1, 2 * j + 2]:\n                closed.append((2 * i + 1, 2 * j + 2))\n    rng = np.random.default_rng(maze.seed_of(\"prim_loops_open\", seed))\n    k = int(round(open_frac * len(closed)))\n    if k > 0 and closed:\n        idx = rng.choice(len(closed), size=k, replace=False)\n        for pos in idx:\n            r, c = closed[int(pos)]\n            walls[r, c] = False\n    return maze.Maze(tuple(tuple(bool(x) for x in row) for row in walls), base.start, base.goal, int(seed))\n\n\ndef generate_family(seed: int, family: str) -> maze.Maze:\n    if family in (\"prim\", \"depth_first\", \"kruskal\"):\n        return maze.varied(seed, family)\n    if family == \"wilson\":\n        return generate_wilson(seed)\n    if family == \"prim_loops\":\n        return generate_prim_loops(seed)\n    raise ValueError(f\"unknown family: {family}\")\n\n\ndef build_stratified_suite(stream_name: str = \"eval5-v1\", per_family: int = 100, pool_mult: int = 40) -> list[tuple[str, int, maze.Maze]]:\n    \"\"\"Build a 5-family route-length stratified evaluation set of 5 * per_family mazes.\"\"\"\n    rng = np.random.default_rng(maze.seed_of(stream_name, 999999))\n    out: list[tuple[str, int, maze.Maze]] = []\n    pool_n = per_family * pool_mult\n    for family in FAMILIES:\n        items = []\n        for idx in range(pool_n):\n            m = generate_family(maze.seed_of(f\"{stream_name}/{family}\", idx), family)\n            dist = maze.corridor_distance(m, m.start)\n            assert dist is not None\n            items.append((dist, idx, m))\n        items.sort(key=lambda x: (x[0], x[1]))\n        # Divide into per_family equal strata, pick one uniformly from each stratum\n        for s in range(per_family):\n            lo = (s * pool_n) // per_family\n            hi = ((s + 1) * pool_n) // per_family\n            pick = int(rng.integers(lo, hi))\n            dist, _, m = items[pick]\n            out.append((family, dist, m))\n    return out\n\n\ndef evaluate_model_on_suite(model_dir: str | Path, suite: list[tuple[str, int, maze.Maze]], *,\n                            seed: int = 0, device: str = \"cuda\", samples: int = passk.SAMPLES,\n                            chunk: int = 8192) -> dict:\n    model = mazemodel.load(model_dir, device)\n    mazes = [m for _, _, m in suite]\n    wins = evaluate.maze_successes(model, mazes, samples=samples, seed=seed, chunk=chunk)\n    overall = passk.summary(wins, n=samples)\n    overall[\"logit_M\"] = passk.logit(overall[\"M\"])\n    by_family = {}\n    for fam in FAMILIES:\n        fam_wins = [w for (f, _, _), w in zip(suite, wins) if f == fam]\n        s = passk.summary(fam_wins, n=samples)\n        s[\"logit_M\"] = passk.logit(s[\"M\"])\n        by_family[fam] = s\n    # Also by route length quartiles\n    dists = [d for _, d, _ in suite]\n    qs = np.quantile(dists, [0.0, 0.25, 0.5, 0.75, 1.0])\n    by_dist = {}\n    for i in range(4):\n        lo, hi = qs[i], qs[i + 1]\n        if i < 3:\n            sub = [w for (_, d, _), w in zip(suite, wins) if lo <= d < hi]\n            label = f\"[{int(lo)},{int(hi)})\"\n        else:\n            sub = [w for (_, d, _), w in zip(suite, wins) if lo <= d <= hi]\n            label = f\"[{int(lo)},{int(hi)}]\"\n        if sub:\n            by_dist[label] = passk.summary(sub, n=samples)\n    return {\"overall\": overall, \"by_family\": by_family, \"by_dist\": by_dist, \"successes\": wins}\n\n\ndef main(argv=None) -> int:\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"--models\", nargs=\"+\", required=True, help=\"step:path or path entries\")\n    parser.add_argument(\"--stream\", default=\"eval5-v1\")\n    parser.add_argument(\"--per-family\", type=int, default=100)\n    parser.add_argument(\"--samples\", type=int, default=passk.SAMPLES)\n    parser.add_argument(\"--seed\", type=int, default=12345)\n    parser.add_argument(\"--device\", default=\"cuda\")\n    parser.add_argument(\"--out\", help=\"optional JSON output file\")\n    args = parser.parse_args(argv)\n\n    t0 = time.monotonic()\n    suite = build_stratified_suite(args.stream, per_family=args.per_family)\n    print(f\"Built {len(suite)} stratified mazes in {time.monotonic() - t0:.2f}s\", flush=True)\n\n    results = []\n    for item in args.models:\n        if \":\" in item and not Path(item).exists():\n            label, path = item.split(\":\", 1)\n        else:\n            label, path = item, item\n        t1 = time.monotonic()\n        res = evaluate_model_on_suite(path, suite, seed=args.seed, device=args.device, samples=args.samples)\n        dt = time.monotonic() - t1\n        ov = res[\"overall\"]\n        print(f\"[{label}] ({dt:.1f}s) M={ov['M']:.4f} logit={ov['logit_M']:+.4f} \"\n              f\"p@1={ov['pass@1']:.4f} p@4={ov['pass@4']:.4f} p@16={ov['pass@16']:.4f} p@64={ov['pass@64']:.4f}\",\n              flush=True)\n        fam_str = \" | \".join(f\"{f}:{res['by_family'][f]['M']:.3f}({res['by_family'][f]['pass@1']:.3f}/{res['by_family'][f]['pass@64']:.3f})\"\n                             for f in FAMILIES)\n        print(f\"   families M(p1/p64): {fam_str}\", flush=True)\n        results.append({\"label\": label, \"path\": path, **{k: v for k, v in res.items() if k != \"successes\"}})\n\n    level = passk.level([r[\"overall\"][\"M\"] for r in results])\n    out = {\"stream\": args.stream, \"per_family\": args.per_family, \"samples\": args.samples,\n           \"level\": level, \"checkpoints\": results}\n    print(f\"=== LEVEL (mean logit M over {len(results)} ckpts): {level:+.4f} ===\", flush=True)\n    if args.out:\n        Path(args.out).write_text(json.dumps(out, indent=2) + \"\\n\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\nEOF\npython -c \"\nimport sys; sys.path.insert(0, 'tools')\nimport eval5, numpy as np\nsuite = eval5.build_stratified_suite('eval5-v1', per_family=100)\nfor fam in eval5.FAMILIES:\n    ds = [d for f, d, _ in suite if f == fam]\n    print(f'{fam:12s}: n={len(ds)} min={min(ds)} p25={np.percentile(ds,25):.0f} med={np.median(ds):.0f} p75={np.percentile(ds,75):.0f} max={max(ds)} mean={np.mean(ds):.1f}')\n\"","e":0,"o":"prim        : n=100 min=2 p25=10 med=17 p75=24 max=42 mean=17.4\ndepth_first : n=100 min=2 p25=16 med=30 p75=46 max=100 mean=32.7\nkruskal     : n=100 min=2 p25=12 med=20 p75=28 max=58 mean=20.3\nwilson      : n=100 min=2 p25=12 med=20 p75=30 max=56 mean=21.7\nprim_loops  : n=100 min=2 p25=10 med=14 p75=20 max=34 mean=14.9","d":26}]}],"parts":[165,107]}