Training a coding model to paint watercolours with TRL and OpenEnv Hugging Face engineers reproduced a viral AI art project in which a language model trained with reinforcement learning writes JavaScript to paint watercolours, publishing all artifacts openly. The project, led by Surya Narreddi's original idea, uses TRL and OpenEnv to train a Qwen model to generate p5.brush code, with the full pipeline running on Hugging Face and the training recipe available as a single command. Reinforcement Learning • Updated Training a coding model to paint watercolours with TRL and OpenEnv Update on GitHub https://github.com/huggingface/blog/blob/main/train-to-paint-with-code.md On 23 August, Surya Narreddi https://x.com/kickingkeys/status/2091570990048276897 posted a beautiful video of watercolours painted by a language model. The model writes JavaScript through p5.brush https://github.com/acamposuribe/p5.brush , a library that "adds natural drawing tools to p5.js". The video went viral fast, over 1.5M views at the time of writing. The video came with a blog post https://surya.website/rling-qwen-to-paint-with-code explaining the training behind an earlier and narrower stage of the project, close-up flowers rather than the full compositions in the video, sadly without open artifacts yet. His site says a full technical report is coming, so ensure you follow him. The original idea is his, coming from the art and design side, where his skills are way beyond mine https://x.com/kickingkeys/status/2094901433149612118 . My attempt is on the engineering side, reproducing the recipe in the open with every piece published. Note:for the context behind the project, told by Surya himself, watch this video of his thesis . In this article I try and reproduce his idea with TRL https://huggingface.co/docs/trl and OpenEnv https://github.com/huggingface/OpenEnv . The reference pool dataset, the RL environment, the training scripts and the trained models, all open. The whole pipeline runs on Hugging Face, end to end: - training on Jobs https://huggingface.co/docs/huggingface hub/guides/jobs - the RL environment and the scorer model as Spaces https://huggingface.co/docs/hub/spaces - the pairwise judge through Inference Providers https://huggingface.co/docs/inference-providers - and every artifact on the Hub, gathered in one collection https://huggingface.co/collections/HuggingEnvs/paint-with-code-6a955b79d63f67f1631d9be6 Once the two Spaces are up, the recipe is one command. Duplicate the environment https://huggingface.co/spaces/HuggingEnvs/watercolour-env and the scorer model https://huggingface.co/spaces/HuggingEnvs/watercolour-hpsv3 , set two environment variables for the reward mix, and launch: hf jobs uv run train/watercolour grpo.py --flavor h200 --timeout 48h --secrets HF TOKEN -- \ --env-url https://