▲ 19 r/reinforcementlearning+1 crossposts

I built a reinforcement learning environment around Pokelike! Try to beat it!

Hey everyone!

I'm a data scientist and I've been pretty fascinated by reinforcement learning for a while. A few days ago my friends showed me Pokelike, a small Pokémon roguelike that runs in the browser. The first thing I thought was that it could be pretty fun to turn it into an RL environment.

So I did.

The repo is here:

https://github.com/pierpierpy/pokelike.xyz.bot

The idea is to run the actual game locally and expose its state and actions to an agent. There is no image processing involved. The bot gets the game state directly and decides what to do next. The agent has to make the decisions around the battles, like where to go on the map, which Pokémon to catch, which items to take, when to swap Pokémon and which moves to learn.

One thing I found interesting is that the map forces you to make some decisions quite early. Once you choose a node, the other nodes on that layer are gone, so deciding where to go can matter quite a bit later in the run. There is also a lot of information in the state that could potentially be useful, but I'm still not sure what the best way to represent it is.

I've already implemented a few basic RL agents. There is currently a Dyna-Q agent and two linear SARSA agents in the repo. The results are not amazing yet. On the current benchmark, random gets around 0.56 badges, Dyna-Q gets around 0.62, while the two SARSA agents get around 1.30 and 1.36. The two SARSA agents mainly differ in their state representation, with the better one using 100 hand-designed features instead of 81.

This is probably the part I'm most interested in at the moment. Finding a good state representation seems to make a pretty big difference, and the environment has some properties that make it a bit more interesting than I initially expected. The reward is fairly sparse, the action space depends on the current state, and some decisions only become useful several steps later.

At the same time, the environment is completely reproducible. With the same seed and the same actions you get exactly the same run. For the current leaderboard I'm using 50 fixed seeds, so different agents can be compared on the same games.

The interface is also intentionally pretty simple. You can basically implement a bot that takes the current state and returns an action. It doesn't have to be a specific RL algorithm either. You could try DQN, PPO, search, a hand-written policy, or pretty much anything else.

I'm still experimenting with the environment and the agents, so I'd be really curious to see what other people would try. In particular I'd love to see if someone can get significantly better results with a better state representation or a different reward function.

you can experiment with the environment with no efforts, just follow the guide and readme, setup the enrinvonment, experiment a bit and then if you like the result, you can create a pull request to the repo with your bot in the bots/ folder (everything is clearly explained in the GUIDE.md)

If you want to try it, everything is in the repo

https://github.com/pierpierpy/pokelike.xyz.bot

If you find bugs or have ideas for the environment, please let me know. I'm happy to make changes if there are things that would make it more useful for experimenting with RL.

The whole thing also runs offline. During setup it downloads the game and the required assets, and after that everything runs locally.

I originally started this because I thought it would be a fun little RL project, so I'm mostly curious to see how far people can push it.

u/Logical_Delivery8331 — 19 hours ago

Ho trasformato Pokelike in un benchmark per LLM e agenti RL

https://reddit.com/link/1vsj5sv/video/sbqumbt6dbkh1/player

Ciao a tutti! Sono un data scientist e da un po’ di tempo sono abbastanza fissato con il reinforcement learning.

A Ferragosto i miei amici mi hanno fatto scoprire https://pokelike.xyz/ e, ovviamente, la prima cosa che ho pensato è stata: “ok, posso prendere questo gioco e costruirci intorno un harness per farci giocare dei bot”.

La prima idea era abbastanza semplice: creare un environment per allenare agenti con reinforcement learning.

Quello l’ho fatto. Ho anche già qualche bot che gioca, anche se per ora fa abbastanza schifo ahah.

Se vi interessa provare, nella repo è tutto documentato e dovrebbe essere relativamente semplice costruirsi il proprio agente e farlo giocare.

Poi, parlando del progetto con un mio amico, ci siamo posti un’altra domanda: e se provassimo a usare Pokelike come benchmark per LLM?

Da lì ho costruito l’harness per far giocare anche i modelli linguistici.

L’idea è abbastanza flessibile: il bot riceve un system prompt, un set di tools, un certo numero di turni precedenti, lo stato del gioco e altri input che si possono configurare.

Potete quindi cambiare praticamente tutto quello che riguarda il modo in cui il modello vede e gioca al gioco:

  • il system prompt e quindi la strategia;
  • il formato con cui viene rappresentato lo stato;
  • i tools disponibili;
  • il modello LLM utilizzato.

Nella repo ci sono già diverse implementazioni di bot, quindi potete partire da quelle e provare il modello che preferite.

La cosa che mi sta sorprendendo è che è molto più difficile di quanto pensassi.

Ho fatto qualche prova con diversi modelli e, almeno con le strategie che ho usato finora, GLM 5.2 arriva al massimo alla seconda mappa. Anche Opus si ferma più o meno lì.

A questo punto non so se il limite sia il modello, il prompt, le informazioni che gli passo o semplicemente la strategia.

Ed è proprio questa la parte che trovo interessante: capire se qualcuno riesce a farli andare più avanti cambiando il modo in cui il modello ragiona sul gioco, ottimizzando il prompt o progettando meglio i tools.

In parallelo sto facendo girare anche agenti RL più classici, quindi per ora nella leaderboard ci sono sia LLM che modelli RL.

Mi piacerebbe vedere cosa riescono a tirarci fuori altre persone. In particolare sono curioso di vedere quanto lontano si riesca ad arrivare con modelli relativamente piccoli, se si riesce a compensare con prompt, tools e una buona rappresentazione dello stato.

Per ora al progetto stiamo lavorando io, un mio amico e Claude Code 😅

Se qualcuno vuole provare, contribuire, costruire un bot diverso o semplicemente trova qualche bug, scrivetemi pure. Anche idee e feedback sono super benvenuti.

Repo:
https://github.com/pierpierpy/pokelike.xyz.bot

Ah, ultima cosa: il bot non usa internet e non interagisce con il gioco online. È tutto offline. Durante il setup viene scaricato il gioco completo insieme a buona parte degli assets, e poi le simulazioni vengono eseguite localmente.

è ancora tutto molto in fase di sviluppo ma usarlo dovrebbe essere già abastanza semplice e immediato. ho reso tutto molto agentic friendly, così che se avete una idea e volete svilupparla senza dover mettere mano al codice potete farlo senza troppi problemi!

have fun!!

reddit.com
u/Logical_Delivery8331 — 20 hours ago
▲ 16 r/Pokelike+5 crossposts

how to SIMULATE a function calling dataset!

hi everyone!

i want to share with you a little project i created a few months ago to solve a problem i was having with function calling. whenever i needed a good quality and specific dataset to train my models on function calling i couldn't find a good repo for generation. i wanted a dataset that teaches the model not only how to call the tool but also when, in different contexts. i also wanted to have maniacal control on the results, i wanted to control how many tools in each convo, when the tool is called, errors in tool callings and in particular i wanted something that was flexible enought to include *PERSONALIZED* tools with personalized mock answers!!!

for example you can find some tools i made for the sample below in the repo under

>synthfc/tools/eng

and

>synthfc/tools/ita

i also wanted a way to check the results and auto-correct the pieces of data that have problems. here is the repo:

https://github.com/pierpierpy/FC-synth

here some examples i created with an open source model:

https://huggingface.co/datasets/pierjoe/function-calling-synthetic-2000

hope you find it useful!

happy tool calling!

u/Logical_Delivery8331 — 2 days ago

how to SIMULATE a function calling dataset!

https://preview.redd.it/yf33gupr7h6h1.png?width=1366&format=png&auto=webp&s=1d2451385016f6d2db9423ed2f011dd632cf5c2b

hi everyone!

i want to share with you a little project i created a few months ago to solve a problem i was having with function calling. whenever i needed a good quality and specific dataset to train my models on function calling i couldn't find a good repo for generation. i wanted a dataset that teaches the model not only how to call the tool but also when, in different contexts. i also wanted to have maniacal control on the results, i wanted to control how many tools in each convo, when the tool is called, errors in tool callings and in particular i wanted something that was flexible enought to include *PERSONALIZED* tools with personalized mock answers!!!

for example you can find some tools i made for the sample below in the repo under synthfc/tools/eng and synthfc/tools/ita

i also wanted a way to check the results and auto-correct the pieces of data that have problems. here is the repo:

https://github.com/pierpierpy/FC-synth

here some examples i created with an open source model:

https://huggingface.co/datasets/pierjoe/function-calling-synthetic-2000

hope you find it useful!

happy tool calling!

if you want to contribute just text me in private!

reddit.com
u/Logical_Delivery8331 — 2 months ago