r/reinforcementlearning • • 12h ago

Robot Recovery Training

15 Upvotes

I’ve been training a whole-body recovery policy for the Asimov 1 humanoid in MuJoCo/mjlab. Each episode starts from a randomized supine, prone, or lateral pose with additional joint perturbations. The objective is to reach an upright configuration and remain stable.

The first policy achieved a high reward, but rollout inspection exposed several problems: some initial states intersected the floor, knee-standing received too much reward, and the robot occasionally used joint limits for support. We corrected the reset distribution using forward kinematics, rejected invalid configurations, separated genuine recovery episodes from standing initialization, and revised the reward around pelvis height, torso orientation, posture, flat foot contact, smooth actions, and ankle-limit avoidance.

We also replaced idealized actuators with DC motor torque-speed models, added randomized control delay of up to 25 ms, and applied external pushes during training. Under the earlier actuator model, the policy recovered and maintained its stance in roughly 97% of randomized evaluation episodes. That number is no longer directly comparable after changing the actuator dynamics, so the current policy is being retrained and evaluated under the harder model.

The video shows several rollouts at normal speed, followed by the same recoveries at 0.25×. Code and training setup:
https://github.com/TenPaths/cyclotron/tree/feature/mjlab-standup

For people working on humanoid recovery: which perturbations and evaluation metrics would you add before attempting sim-to-real transfer?


r/reinforcementlearning • • 7h ago

R If RL for reasoning only changes 1 to 3% of tokens, what does test-time training on a single problem change?

3 Upvotes

There's a paper going round claiming RL for reasoning only changes 1 to 3% of the tokens, and that the gains replicate without RL at a fraction of the compute. If that holds, what a small, targeted update actually moves becomes the question, and test-time training on a single problem is the sharpest case: one problem, one LoRA, updates driven by the problem's own verifier, a certified score at the end.

reef's TTT-Discover recipe checks its trajectories in and they're that shape, so I've been reading them. Qwen3-8B with thinking on, two B200s, each search step eight groups of 64 rollouts then one rank-32 LoRA update, one trajectory per task, so nothing here estimates variance across seeds. Erdős minimum overlap reached a certified C₅ upper bound of 0.38094 over the 25 steps shown; TTT-Discover's reported figure is 0.38093 and the target is 0.38080, lower is better. Packing 26 reached a certified sum of radii of 2.635983 over 50 steps, the same as TTT-Discover's reported 2.635983, against a target of 2.636, higher is better. I haven't run a baseline, so I'm not putting one next to those.

What I find useful, beside the paper: the update is an adapter aimed at one problem and the score is certified, so the size of the change and its effect are both on the record. Whether a rank-32 adapter's change has anything to do with the 1 to 3% of tokens the paper measures is the part I can't read off it. A token-level measurement of what a single-problem TTT run changes would bridge the two, and I haven't seen one.


r/reinforcementlearning • • 8h ago

Can we create a completely new form of AI intelligence without training a new LLM?

Thumbnail
0 Upvotes

r/reinforcementlearning • • 1d ago

A hybrid agent reaches dungeon level 9 in Diablo I - Ironman run (Part 4)

32 Upvotes

Hi everyone. Fourth update on the Diablo I RL project. Parts 1-3 are covered here:

  • Part 1 - from random walk to stair-finding
  • Part 2 - full exploration of the first dungeon level
  • Part 3 - monsters, potions, first real combat

This time the agent is running a full game. Ironman: no town returns, one life, dropped item stays on a floor, all 16 dungeon levels in sequence. Best result so far is dungeon level 9. Death distribution over 97 runs:

  level  2:   4 (  4.1%)  ####
  level  3:   6 (  6.2%)  ######
  level  4:  19 ( 19.6%)  ###################
  level  5:  19 ( 19.6%)  ###################
  level  6:  22 ( 22.7%)  ######################
  level  7:  15 ( 15.5%)  ###############
  level  8:   9 (  9.3%)  #########
  level  9:   3 (  3.1%)  ###

runs=97  min=2  max=9  mean=5.49  std=1.67

The video at the top shows one of those runs - the agent going from level 1 to level 9 where it dies. It is shortened: only a few combats are included, the walking between them is cut. Each clip was recorded from a checkpoint saved at the start of that level, so the fights you see are a live replay, not the original sequence. The agent makes the same decisions but the outcome can differ.

Why Ironman

Partly because it sounds cool, partly because it is actually the easiest mode to implement. No town returns means no town navigation code to write. One life means there is no ambiguity about whether a run succeeded or failed. The hero goes down and keeps going down, and the agent never has to decide whether to backtrack. Fewer decisions to implement means fewer things to get wrong.

One important thing to mention: quests are disabled. In Diablo 1 some quests rewrite the dungeon layout in ways that block progression. For example Chamber of Bone (is on floor 6) or Halls of the Blind (is on floor 7), both generate rooms where a staircase is hidden behind a door you can only open by completing the quest. The Butcher and Skeleton King are in the same category: special rooms that require quest logic to navigate. An algorithm for that is doable, but it adds complexity. Disabling quests keeps the dungeon layout predictable: stairs are always reachable. Well, yeah, no Butcher does make the survival numbers look better - not going to pretend otherwise :)

The hybrid approach

The agent is not a pure RL model. The philosophy is: if something can be written as an algorithm, write it as an algorithm, and only send the genuinely hard parts to the neural network.

The supervisor is a state machine. Most of the time it runs in DUNGEON mode, where the RL model is in control. Once the per-level step budget runs out or enough monsters are killed, it switches to PATHFIND and navigates to the last seen staircase using BFS. The model itself never sees the staircase trigger - it is masked as a wall so the model does not accidentally walk into it mid-fight. The supervisor decides when to descend.

The RL model

The model handles all the dungeon decisions: where to move, when to attack, which unexplored corridor to try next, whether to open a door, a chest, or a sarcophagus, and when to pick up an item. Potions are also the model's call - it observes the current potion count (small, large, rejuvenation) and issues a restore-health or restore-mana command when it decides the moment is right; the engine patch translates that into an actual potion drink. A CNN processes the 21x21 local observation window and an LSTM carries memory across steps, so what the agent saw earlier affects what it does now.

As covered in Part 3, a plain CNN was not enough. Three attention blocks sit on top of it - SelfAttention, MemoryCrossAttention, and FiLM. The ablations from Part 3 showed that FiLM does almost all the work. The other two turned out to be dead weight in the trained model, which was a surprise.

Two separate models were trained: one for floors 1-4 (Cathedral) and one for floors 5-8 (Catacombs). The Cathedral and Catacombs have different geometry, different monster pools, and the hero's stats look different at those floors too. One model covering all of it was worse than two specialized ones. For floors 9 and beyond the agent falls back to the Cathedral model - it gets there in about 3% of runs, not enough to justify a dedicated training run. The model switches on every level transition and the LSTM state resets.

Stat strategy: dexterity rush

Every level-up gives 5 attribute points to spend. The agent uses dex-rush, a 30-year-old Diablo 1 player technique: put Dexterity first, everything else later. Dexterity feeds directly into the attack rating formula that decides whether hits land. On floors 1-4 enemies have low armor class, so stacking Dexterity means the Warrior hits more often. Fights end faster, which means less damage taken. It sounds simple and it is - that's why it works.

I tried strength-first and balanced splits as alternatives. Dex-rush won. The agent does not learn this - it is hardcoded and runs automatically on every level-up.

Gear management

This is the part that went through the most rewrites.

The first version scored items by a weighted sum of their stats - dexterity weighted higher than vitality, and so on. Simple, fast, and it worked okay on early floors. On deeper floors it started failing in ways that were hard to debug, because stat interactions in Diablo are not linear.

So the idea was to take the original code from the DevilutionX engine, where the game actually computes attack rating, damage, and armor class, then translate it all into Python. The result is a function that computes the hero's expected combat efficiency against the average monster on the current floor:

(hero_hp * hero_damage_per_hit * hero_hit_chance) / (monster_hp * monster_damage_per_hit * monster_hit_chance)

Per-floor average monster stats were measured from the actual engine across 200 seeds per floor. When a new item shows up in inventory the agent virtually equips it, recomputes that number, and compares to the current value. If it goes up, the item is worth equipping.

The reason this matters: a +10 Dexterity ring might be excellent or worthless depending on whether the hit chance is already capped at 95%, whether the hero has a shield, and what character level we are at. A weighted sum has no way to know. The full formula just handles it.

Gear degrades. The agent repairs algorithmically when durability drops below a threshold - no model involvement there.

Dropped items are immediately masked in the model's observation so the model does not walk back to pick them up.

Since there is no town and no shop, gold is useless and everything that cannot be equipped right now gets dropped. The inventory stays empty. Unidentified items are a special case though - the agent can still equip them using their visible stats (base armor class, raw damage range). The risk is that the item might be cursed, so when equipping an unidentified item, the previous item is kept as a backup in inventory. If the new item gets identified and reveals some cursed chars, the agent drops it and falls back to the backup, so the hero is never naked in a fight.

Reward shaping

I started with sparse reward - only terminal outcomes fire, the model figures out the rest. That got me pretty far. Then it stalled.

Shaping from there was mostly trial and error. After each training run I dump all the action events from the whole run into a table - attacks per episode, items collected, wasted actions, everything. It sounds simple but it is actually quite useful: if the model is spamming fireball on empty mana eight times per episode, the table tells you immediately and the fix is obvious. If wasted attacks go down after you raise the penalty, you know the shaping worked. If they don't, something else is going on.

Event frequency (86451711 total events, 512 files, 164452 all train episodes):
freq             per_ep       sum_R  label
---------------  ------  ----------  ------------------------------
48.3%(41767256)  253.98  -1253017.7  Movement penalty
21.7%(18780064)  114.20    939003.2  Explore tiles
14.5%(12541833)   76.26   1881274.9  Attack 1 monster(s)
 5.0%( 4311508)   26.22  -1221552.1  Damage taken
 4.9%( 4204562)   25.57    421077.9  Kill monster
 1.7%( 1471523)    8.95    117744.9  Collect item
 1.1%(  910983)    5.54     75545.4  Activate object
 0.9%(  738467)    4.49     14814.6  Open door
 0.8%(  676459)    4.11   -101468.8  Wasted primary
 0.5%(  410848)    2.50     20542.4  Correct restore HP
 0.2%(  188687)    1.15    -18868.7  No-potion restore HP
 ...

Some changes were effective, while others were not. Penalizing phasing when no monster was nearby worked. The crowd-fighting amplifier, which scaled damage in dense groups, was tested but eventually discarded. It turns out that reducing the hero's stats during training accomplishes the same goal without needing to adjust rewards: the hero naturally takes more damage and learns to lure effectively.

The challenging part was balancing the movement penalty against the exploration reward. I introduced an exploration bonus in version 16, but the per-step calculations still made standing still slightly optimal. I had to adjust both numbers before the agent actually started moving toward new tiles.

The last working environment version is 17. The event table and per-level outcome stats are what made it possible to iterate without going blind:

Per-level outcomes (164452 all train episodes, success: 50.4%):
 Level          Goal         Death     Escape       Stuck    Timeout
---------------------------------------------------------------------
     5  65.3%(26973)  31.1%(12841)  0.4%(148)  2.9%(1217)  0.3%(141)
     6  49.6%(20433)  46.8%(19273)  0.3%(109)  3.0%(1242)  0.3%(143)
     7  47.5%(19548)  49.6%(20420)  0.3%(134)   2.2%(891)  0.4%(177)
     8  39.2%(15959)  56.4%(22982)  0.4%(167)  3.4%(1381)  0.7%(273)

Each floor tracks goal/death/stuck/timeout split independently, so if level 6 drops from 50% clears to 40% after a reward change, something broke there specifically.

Monte Carlo simulation

Getting the training curriculum right required knowing what a real run actually looks like at each floor. How many XP does a Warrior earn on floors 1-4? What character level do they typically enter floor 5 at? What gear is realistically available?

I wrote a simulator (scripts/diablo-sim.py in the repo) that runs a Warrior through all 16 floors in a Markov loop: sample XP from monster kill counts measured from the real engine, apply the level-up formula, track gear carried forward. After enough simulations you get a distribution of hero state at each floor entry.

Training at the wrong character level produces an agent that works in training and falls apart in real runs. The simulator fixed that.

Discovered behaviors

The agent has discovered a solid strategy for staying alive: it lures everything into a narrow doorway and waits. Just stands there. The monsters walk over one by one and it picks them off. No reward shaping for that, no explicit training on this - just happened. Also, when it's being heavily pressured by a gathered crowd in an open space, it tries to flee or to find another doorway to fight back.

Low health with no potions is something else to watch. It gets genuinely scared. Hesitates in the corridors, takes a few steps forward, steps back, and if something does wander close it immediately turns and runs away. Obviously does not want to die :) Which is technically correct behavior but looks almost funny (poor guy).

Interestingly, while most monsters can usually be lured, meaning the agent just has to stand and they'll come, there are some that don't react at all unless you get very close. I watched the agent open a door, see a room full of Gargoyles, and then... wait. The Gargoyles were dormant, motionless. This went on for tens of seconds. Nothing happened on either side. The agent was clearly expecting them to come over like everyone else does. They did not. It has not seen enough of these monsters in training and just assumed the usual rules apply. Fixing this would mean making sure those types show up more often during training.

The video at the top has most of these behaviors, very interesting to watch, especially seen on deeper levels.

What is next

Honestly, I am stuck. For the last couple of months I have been trying to push survival on floors 5-8 and the training curve just flattens. Nothing I have tried moves it. I do not know yet whether this is a ceiling for the current architecture or just something I am missing. The Catacombs are the bottleneck - reaching floor 9 in 3% of runs is a consequence of floors 5-8 being hard, not floors 9-12 being impossible.

The obvious workaround is to allow town returns and trading. Better gear and more healing potions would help a lot. But that means writing town navigation and trading code, and it feels like giving up on the Ironman idea. The goal was still to kill Diablo in one unassisted run. Whether that is reachable with this approach, I do not know yet.

The repo is here: https://github.com/rouming/DevilutionX-AI


r/reinforcementlearning • • 1d ago

Rocket League RL w/ CUDA-Accelerated Simulation!

Thumbnail
github.com
40 Upvotes

Hi folks! I wanted to share a project I've been doing off and on for the better part of 2 years, and in recent months I've gotten the time to make more significant progress.

I was inspired by PureJaxRL a while ago to build my own massively-parallel environment for a task that interested me personally, which is Rocket League. RocketSim, a highly performant CPU-resident simulator, already exists and is baked into RLGym for the purposes of RL training, but I figured it would be valuable to port the physics logic to run in a parallel fashion on-device via CUDA. I learned a lot about GPU programming and optimization, and I still have a lot more to learn so I'm all ears for any advice!

The environment I created is called CARL - CUDA-Accelerated Rocket League. It keeps all simulation state information on the GPU, which during training entirely eliminates host-device transfer overhead. Many thousands of games can be run and controlled in parallel, leading to significant reductions in training wall clock time (as was observed in the original PureJaxRL post).

I've been doing some training of Rocket League bots with it and they transfer seamlessly to the actual game, so the physics appear to be at parity. More work can be done on parity assessments, benchmarking, etc. but I figured now that it's "feature complete" that it would be cool to open it up to the community and see what people think!

As a bit of proof so you know I'm not a liar and a scoundrel, here's a plot from a recent training run that shows marked improvement in aerial control over ~20B decision steps using 8192 parallel environments on a single RTX 4090 (frameskip=4, so 80B ticks total, ~21 years), taking just over 21 hours in wall time.

The method of training as hinted at by the run name is a generative imitation learning approach that (ideally) transfers behavior style from expert demonstrations, which I've obtained from ballchasing.com

Here is an example of the capability it was able to reach in that amount of time. Pretty impressive, although I would have totally saved it if I were trying even a single iota...

https://reddit.com/link/1x77aan/video/ynwh0bbhgrvh1/player

I plan to post a follow up with demonstrations as I round out the functionality. On my TODOs are:

  • Built-in training pack API for targeted training
  • Benchmarks for speed and parity comparisons
  • Tests and other best practices
  • Eventual jax & tf integration(?)

Thanks for reading if you did!

P.S. I've been having trouble with the image & video in this post (hence the multiple attempts so sorry if you've already seen this post) so let me know if they're broken please and thank you :)


r/reinforcementlearning • • 1d ago

MemScope: an agent reads its failure traces and patches one line of its memory code instead of rewriting it (arXiv 2610.21170, my 80 s explainer)

2 Upvotes

I made a short explainer of this preprint. Summary for people who don't want to watch:

Agents that keep notes in a memory system usually get improved from a score or a short summary of failures. A score alone can't say which part of the memory code failed, so earlier approaches often rewrite large parts of it.

MemScope adds a Patch Agent that reads the step-by-step trace of a failed question and makes a small in-place edit to the memory code. In one recorded case the trace showed zero steps and no notes, and the paper's proposed cause was one early-return line that may stop the search too soon.

Results from the authors' own small GAIA test (public research questions; one number per setting, no spread reported):

- Patch Agent given only a short summary: 63%

- Patch Agent given the traces plus the saved notes: 87% (best setting tried)

- Full MemScope with patch history: 83%

In the paper's recorded code changes, the median change touched one function, and the median change ratio was 4.4%.

Paper: https://arxiv.org/abs/2610.21170

Curious whether anyone has tried trace-driven patching on their own agent memory, and whether small patches hold up over many rounds.


r/reinforcementlearning • • 1d ago

D Two result shapes for an agent that learns during a run

0 Upvotes

"Please publish the benchmarks" is the right demand for anything that claims to learn during a run. What I'd argue about first is the shape of the answer, because a single score hides the two things you'd want to know.

reef-eval defines two shapes. An autoresearch task, where the optimal score is unknown, so the result is the best score reached and how long it took to get there, or how many evaluations. And a task stream, where one agent works through an ordered list of tasks, each in its own fresh container and scored on its own, with the agent's memory directory carried from task to task and a snapshot kept at every step. In both, the question is whether the state the agent picked up during the run changed what it scores.

What one number loses: on an open problem, two runs can end on the same best score, one after a handful of evaluations and one after hundreds, and a leaderboard that reports the score alone calls them equal. On a stream, average the per-task scores and you lose whether a late task went better because of what the agent carried forward from the early ones, which is the only thing the stream was built to measure.

Its task sets are the public ones plus six of its own, and it publishes no results, so before the numbers exist the argument is the two shapes: best score and time for open problems, per-task scores with carried state for streams, and an A-vs-A control beside both.


r/reinforcementlearning • • 2d ago

Robot Duckling (15cm)

10 Upvotes

Training pre build


r/reinforcementlearning • • 2d ago

My robots can't walk until they've practised for 93 hours. First trailer for Bitbots

10 Upvotes

r/reinforcementlearning • • 2d ago

I built a simulator with a PPO agent to beat TempleRun on a phone

11 Upvotes

https://reddit.com/link/1x6i6v5/video/h22absbdylvh1/player

I wanted to get my head around RL so I thought of learning it by teaching an AI how to play one of my favorite childhood games : TempleRun.

The agent reads game state directly from memory via a Frida gadget and acts through the game’s own methods. Training happens in a headless simulator I built with Claude from the game’s internals and calibrated on measurements from the real phone, with a C++ version that does 10M steps in about 6 minutes.

Results on the device: median 4,736 m, best 16,782 m over 14 runs.

👨‍💻 Github: https://github.com/matthieucs/TempleRun-RL/tree/main

Happy to answer any question.

And if you want to try it, the score to beat is 16,782 m.


r/reinforcementlearning • • 2d ago

R PCEI – On-device embodied AI combining BitNet 1.58b, Mamba, and FastKAN

2 Upvotes

Hey everyone,

I've open-sourced PCEI (Physically Constrained Emergent Intelligence), an experimental architecture designed to run on consumer hardware (Mac Apple Silicon and Linux/CUDA) without the memory explosion of standard transformers:

  • BitNet 1.58b Quantization: 24 layers of ternary weights {-1, 0, +1} reducing parameter memory by ~4x compared to FP16.
  • Mamba State Spaces: Linear-time sequence modeling with constant O(1)O(1) inference memory (no ballooning KV cache).
  • FastKAN Spline Manifolds: Kolmogorov-Arnold B-splines applied to continuous motor control across 4 streams in MuJoCo physics.
  • Empirical Telemetry: 11 companion research papers, including an evaluation of continuous latent buffers proving an irrecoverable Shannon information loss factor of LL.

The full framework, training pipelines, and evaluation suites are open under MIT-NC: https://github.com/MtnMCG/PCEI

Feedback and critiques are very welcome!


r/reinforcementlearning • • 2d ago

Has anyone experimented with AI agents for AutoCAD or Revit?

Thumbnail
0 Upvotes

r/reinforcementlearning • • 3d ago

Asymmetric multi-head AlphaZero in C++: two kamikaze drones learn a pincer attack via self-play (new in Metis-Core v0.4.0-alpha)

49 Upvotes

Hi, I’d like to announce that I have released Metis-Core v0.4.0-alpha

What’s new? I have implemented an “Asymmetric Multi-Head AlphaZero” algorithm in Metis-Core, along with an example in C++ (Visual Studio 2022): KamikazeDroneSwarm.exe.

https://github.com/felixromo314/METIS-Core/

KamikazeDroneSwarm uses the asymmetric multi-head AlphaZero implemented in Metis-Core:

An Imperial Shuttle freighter loaded with beskar, armed with a rotating laser turret, must reach the Death Star.

Two Rebel kamikaze drones try to intercept it before it gets there.

Without being programmed to do so, the drones learn a coordinated pincer attack on their own to split the turret’s attention.

You can play by controlling the turret yourself (human in the loop) against the trained drones.

The framework allows you to create two teams, Blue and Red, and add to each team as many agents as your problem requires.

I’m sure there will be bugs and a lot of things to fix, so just let me know and I will try to fix them.

I hope you find this new feature useful.

Thanks!

You can find more information in this tutorial:

https://github.com/felixromo314/METIS-Core/blob/main/tutorial/Tutorial-AlphaGoZeroAsymmetric.md

Metis-Core is distributed as binaries (.dll / .lib / .h), but the full source code of the example is included, so you can see exactly how the framework is used and build your own environments on top of it.

Note on training: the drones are not scripted, but I do use a small material heuristic to speed up training (setMaterialHeuristicWeight(0.3)). It blends a hand-crafted position evaluation (approach, separation between drones, turret exposure) with the network’s value head during MCTS. The terminal reward is still +1/-1/0, and the pincer manoeuvre itself is not explicitly encoded. But you can set via setMaterialHeuristicWeight the value you wanted, 0.2, 0.1, or if you don not call to this function the heuristic is not activate.


r/reinforcementlearning • • 2d ago

R HarnessDev: feedback and held-out agreed on 34 of 64 switches

1 Upvotes

HarnessDev (this month) is the first paper I've seen that measures the loop of letting an agent revise its own harness, keeping the revision when the feedback says so, and repeating. Across 64 adjacent version switches, the feedback score and the held-out score moved in the same direction 34 times, 53.1%. Only 2 of 9 lineages ended on their held-out-best version. Mean gain across the evolution stage was +3.11 points. Executor dependence was severe: one harness scored 69.3 under one model and 33.0 under another.

So a gate that decides on feedback alone is, by their measurement, a coin flip on whether the gain generalises, and that's a selection-policy problem more than a proposer problem.

Two things I'd do differently from the paper's loop, and can set in reef, which I run. Selection: by default a candidate publishes when it wins more task comparisons than it loses, past a noise floor you set, and the Pareto policy in the method guide publishes only when no task regressed and at least one improved. That rule can only refuse on the list the gate runs, and the moment you select on a list it is your feedback score, not a held-out one, so it doesn't recover the paper's 30 by itself; what it does is stop a candidate that lost anywhere on the list from shipping on a net win. The held-out check has to be a list the proposer never sees, and that's on you. Memory of rejections: the proposer can receive the recent rejected proposals with their verdict reasons and the previous step's failure manifest, so it can stop re-proposing the switch that lost.

What none of it fixes is the task list. It's short because it's the cost of every step, and the whole paper is a warning that a short in-distribution list gets gamed by the feedback loop. Whether no-regression on held-out tasks is the right acceptance rule or too conservative to ever move is the open question; the paper's 30 bad switches make me lean towards conservative.


r/reinforcementlearning • • 1d ago

Small experiment: filtering training data for "good outcomes" taught a model the bad habits anyway

Post image
0 Upvotes

r/reinforcementlearning • • 2d ago

Can World Models absorb Simulation Stack as some people claim?

Thumbnail
3 Upvotes

r/reinforcementlearning • • 2d ago

I trained an AI car to tow a vault and fight police cars (PPO in Unreal Engine 5), and it learned to set traps first

1 Upvotes

Hi everyone,

I wanted to share a small reinforcement learning project I've been working on in Unreal Engine 5, inspired by the vault chase scene in Fast & Furious 5. I'd really appreciate any feedback.

**Setup*\*

- Two cars on a looping track with many sharp turns, defined by a spline

- A police car trained with PPO to patrol along the road (then frozen as a fixed opponent). It was never taught to dodge, so it simply plows into whatever is in its way

- A race car towing a one-ton vault, trained with PPO to flip police cars

- Both agents use the same action space: throttle, brake, steering

- Training: neural network on GPU, physics simulation on CPU (the CPU is the bottleneck)

**Reward function for the race car*\*

- Large reward: flipping a police car, or steering the vault into one

- Small reward: staying on the road and driving in the right direction

- Small penalty: getting hit by the police car, or driving the wrong way

- Large penalty: leaving the track, or being stuck for more than 3 seconds

**What happened*\*

  1. **Bullied.** Early on, the car just lay still and took the hits. Being hit was cheap, while moving the vault usually threw the car off the track, which was expensive. This looks like a classic local optimum.
  2. **Trap.** After a while, it started dragging the vault onto the police patrol route, waiting, and swerving away at the last moment so the police car hit the vault. This technically satisfies "vault hits police car", so it's a nice example of reward hacking / specification gaming. It wasn't what I had in mind.
  3. **Hero.** I increased the penalty for standing still, moving slowly, or getting stuck (reward shaping). The trap disappeared, and the car started charging at the police car, timing its speed and angle to launch it, and sometimes dodging at the last second so the police car hits the vault behind it.

I turned this into a video that explains the basics (observation/action/reward, PPO, local optima, reward hacking) in a light-hearted way, mainly for people who are new to RL:

https://youtu.be/UUoUOKSQ8FQ

I'd love to hear your thoughts, especially:

- Is there a better way to discourage the "wait and trap" strategy than penalizing idle time?

- Any suggestions for making training with a towed object more stable?

Thanks for reading, and I'm happy to answer questions about the setup.


r/reinforcementlearning • • 3d ago

Markov Decision Process (MDP) Interactive pixel-art simulator to learn Markov decision processes and reinforcement learning: Bellman, value/policy iteration, Q-learning and SARSA. ES/EN.

Post image
39 Upvotes

Hello, community!

I recently launched a website to experiment with and better understand reinforcement learning, particularly Markov decision processes.

It’s completely free, public, hosted on Vercel, and the repository is also available.

Hosted at: https://markov-kingdom.vercel.app/

Repo: https://github.com/xavendano/markov-kingdom

I’d appreciate any comments and/or feedback.
Thanks!!!


r/reinforcementlearning • • 2d ago

I built Agent Praxis: 6 adversarial environments to test how LLM agents handle traps, metric gaming, and fake authority

Thumbnail
0 Upvotes

r/reinforcementlearning • • 3d ago

Can a varying size rollout-buffer destabilize training in PPO ?

2 Upvotes

Hey all,

I wasn’t very familiar with PPO when I implemented it and I mainly used the original paper as a reference. However, after comparing my code with some common implementations, I noticed an important difference.

I run a large number of environments in parallel. For each PPO iteration, I reset every environment once and let each one run until it either finishes or reaches the maximum horizon (tasks are episodic and rewards are only assigned to the goal state). Environments that finish early are masked while the others continue. Once all environments have finished, I perform the PPO updates.

Therefore, I always collect the same number of episodes, but not the same number of transitions. As the policy improves and finishes episodes faster, the rollout buffer becomes smaller. In contrast, the SpinningUp implementation from OpenAi seems to fix the buffer size and collect a fixed number of transitions.

I compute and normalize the advantages over all transitions, shuffle them, and then perform several PPO epochs using a fixed (relatively high) minibatch size. This means that the number of optimizer steps per rollout changes also depending on the size of the buffer. Since i can not really control the number of transitions, the final minibatch can also be smaller than the others while still receiving a normal optimizer step.

It seems to work fine on some simple custom problems, but i wonder if this could have any consequences that i might be missing (e.g. on long horizon problems).

Can the changing number of optimizer steps lead to problems ? Is the (potentially) small final minibatch a concern like noisy gradients ?


r/reinforcementlearning • • 3d ago

How to come up with research ideas

0 Upvotes

In rl how can someone do research , mine most of the time is getting to know which problem to work on and in which method there is research gap and all

Can you tell me what are the methods to come up with a research gap

Like by doing/ implementing the research paper from scratch and then see what are the limitations of the paper and then we get the another research paper that explores that specific idea and this go on

And we can't find any problem to work on.

Any researchers or students here who produced research papers can tell what worked for you when you were searching for a problem to work on

I am doing rl for robotics and now exploring world models and searching for a research gap in this field...


r/reinforcementlearning • • 4d ago

I trained a 4-player squad for a 2D battle royale (survev) with MAPPO — 40s clip and what bit me.

3 Upvotes

I've been training 4-agent squads to play survev (an open-source surviv.io clone) on a local, unmodified game server.

every player in it is a bot. yotube clip: https://www.youtube.com/shorts/PPAVNHRAb7k
you can find more videos on my channel.

https://reddit.com/link/1x55w7l/video/3erybs5vaavh1/player

Setup
- MAPPO with a centralized critic. One actor network is shared by the four squad members (agent id as input). The actor only sees what a real game client receives; privileged state goes to the critic only, so the same network can run from a browser extension.

- Actor input: ~1.4k features, two 24x24 local grids and a minimap through small CNNs, a set encoder over up to 12 visible enemies, then a GRU (256).

- Hierarchical actions: the policy picks an intent (loot, explore, take cover, peek, retreat, regroup, push, go to zone...), a target, and what to use (gun, melee, grenade, smoke, heal).

- One team reward shared by the squad: damage dealt and taken, knocks and kills, placement, plus small teamwork terms (focus fire, crossfire, revive).

I'm not releasing the code or the full details: a bot like this could be abused as a cheat on public servers. Happy to answer high-level questions.


r/reinforcementlearning • • 4d ago

Robot Tired of waiting 3 hours to see the results. How do you scale up the number of RL robots training simultaneously using PPO?

8 Upvotes

Hello scientists! Is there a formula for adjusting hyperparameters for PPO based on the number of agents you're training simultaneously?

I'm using ML-Agents and Unity engine to train robots.

After extensive tuning, I finally got my quadruped robot to walk really well. However, training is extremely slow because I'm only training 10 robots simultaneously. If I increase the number to 100 or 1,000, the training performance deteriorates and the training graphs look terrible.

How can I overcome this? My hardware is capable of handling up to 10,000 robots training simultaneously, but I don't understand which parameters I need to adjust to make this work.

Is there some kind of formula for scaling hyperparameters based on the number of parallel agents?

Most of my initial hyperparameters were taken from the quadruped robot examples provided with ML-Agents.

Hyperparameters for 10 agents:

max steps per agent life: 5000

Observation space: 123

Action space: 12

        trainer_type:   ppo
        hyperparameters:
          batch_size:   2048
          buffer_size:  20480
          learning_rate:        0.0003
          beta: 0.005
          epsilon:      0.2
          lambd:        0.95
          num_epoch:    3
          shared_critic:        False
          learning_rate_schedule:       linear
          beta_schedule:        linear
          epsilon_schedule:     linear
        checkpoint_interval:    500000
        network_settings:
          normalize:    True
          hidden_units: 512
          num_layers:   3
          vis_encode_type:      simple
          memory:       None
          goal_conditioning_type:       hyper
          deterministic:        False
        reward_signals:
          extrinsic:
            gamma:      0.995
            strength:   1.0
            network_settings:
              normalize:        False
              hidden_units:     128
              num_layers:       2
              vis_encode_type:  simple
              memory:   None
              goal_conditioning_type:   hyper
              deterministic:    False
        init_path:      None
        keep_checkpoints:       10
        even_checkpoints:       False
        max_steps:      30000000
        time_horizon:   1000
        summary_freq:   30000
        threaded:       False
        self_play:      None
        behavioral_cloning:     None

r/reinforcementlearning • • 3d ago

The algorithm that trains reasoning LLMs can't teach a robot to walk

Thumbnail sreejithb.com
0 Upvotes

Follow-up to an earlier write-up on the REINFORCE → PPO → GRPO lineage. That one ended with GRPO as "PPO minus the critic, plus a group-mean baseline", which raises an obvious question: if it's cheaper and good enough for DeepSeek's reasoning models, why does nobody use it for control?

Two reasons, and they're different kinds of problem - presence of bias and a common feedback applied uniformally to each step. The latter is REINFORCE's original credit-assignment problem, back because the critic is gone. An LLM gets away with it (one terminal reward, quiet environment, replayable start state, pretrained prior). A robot doesn't.

De Oliveira et al. (2511.03527) ran critic-free methods vs PPO on five classic control tasks. PPO won everywhere except CartPole, and GRPO's group weighting did no better than a plain batch mean.

Write-up with interactive figures: https://sreejithb.com/grpo_dissect/single Disclosure: the argument and the script are mine; Claude helped with polish and the visuals.


r/reinforcementlearning • • 4d ago

Hermes Reinforcement Learning optional skill: Any Advice?

Thumbnail
1 Upvotes