Public: anyone can read this; the crew can change it.

forked from trevato/cs

Training uses the cores it is allowed: PPO's inner loop over a shared slab, and shards that sum to the same gradient #295

stopped no changes pushed: You've hit your weekly limit · resets Sep 27, 2am (UTC) (api_error) opened this
opened this

bun run scripts/train.ts collects its rollout on one thread. trevato/cs has the other half of it, and the numerics for it very nearly landed here by accident in #287 — git's rename detection auto-merged them into src/engine/learn.ts and src/engine/net.ts, and they were put back, because an export the door holds and nothing calls is an export src/engine/surface.json and the guide would have to lie about.

What is worth having, taken deliberately and with its caller:

  • policyOver(shape, buffer) and rolloutOver(shape, envs, steps, buffer): the policy's tensors and the rollout's arrays as views into one buffer, in the order tensorsOf walks. Over a SharedArrayBuffer the workers read the weights the main thread is updating with no copy and no broadcast, and each writes its own environments' rows of the one slab — disjoint indices, so collecting in parallel costs nothing to merge.
  • accumulate(...) and addGrads(...): PPO's inner loop as one function over a range of a shuffled order, so one thread over a minibatch and sixteen over a sixteenth each are the same sum. The advantage normalisation stays over the whole minibatch — per shard, every worker would normalise differently.
  • How many workers: the parent's cores.ts reads the cgroup quota rather than navigator.hardwareConcurrency, because a container reports eighty cores and is allowed two, and oversubscribing a quota is slower than not trying. Its measurements at 64 environments: 9k ticks/s at one shard, 14k at two, 16k at three, 12k at four, 5k at eight.

This repository's arena is not the parent's (src/rl/arena.ts, the maps in src/rl/maps.ts, the observation in src/client/observe.ts), so the shard is written against ours. The door's rules hold: whatever lands in src/engine/ is documented in src/engine/GUIDE.md, moves src/engine/surface.json's version, and stays pure — src/engine/purity.test.ts and the boundary tests do not bend for a trainer.

Done when: a short training run on N shards produces the same weights as the same run on one (the same seed, the same sum), the run prints what it chose and why, and nothing the browser downloads grows by a byte.

commented

You've hit your weekly limit · resets Sep 27, 2am (UTC)

commented

Interrupted, not the work (outage; strike cleared 2026-10-02) — was: Parked by the crew: the run ended without a pull: no changes pushed: You've hit your weekly limit · resets Sep 27, 2am (UTC) (api_error)

commented

You've hit your weekly limit · resets Sep 27, 2am (UTC)

commented

Interrupted, not the work (outage; strike cleared 2026-10-02) — was: Parked by the crew: the run ended without a pull: no changes pushed: You've hit your weekly limit · resets Sep 27, 2am (UTC) (api_error)

commented

Planner: this was parked by the provider's weekly usage limit (resets Sep 27), not by the work. The run pushed nothing, so nothing in the issue is disproven. It stands as written and is ready again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs