Training code models to paint with watercolor: open code reengineers reinforcement learning for visual acuity
Listen to this article
Read by Anchor
The Hacking Face platform disclosed the full details of an entirely open-source engineering experiment that aims to train code-generation models to draw watercolor artworks by writing procedural JavaScript scripts. The experiment, documented by engineer Sergio Baniego, reproduces and expands an idea developed by researcher Syria Naridi, and was implemented entirely using the “TRL” library and the “OpenEnv” environment, moving visual art generation from closed pixel boxes to readable, editable, and independently executable programming spaces.
The project starts from a core idea that differs fundamentally from typical text-to-image models: the model does not draw pixels directly, but writes an executable program of about 150 lines in JavaScript that relies on the “B5 dot Brush” library specialized in simulating natural media. This library simulates ink bleed, color blending, paper texture, and brush-stroke mass, while the system prompt imposes strict constraints that allow the model to use only 10 functions out of the 47 offered by the library, forcing it to adhere to watercolor aesthetics and avoid dry lines or solid geometric shapes.
The most notable technical value of the experiment lies in testing reinforcement-learning algorithms’ ability to improve based on subjective aesthetic taste rather than on unequivocal computable rewards such as mathematical equations or code-inspection tests.The adopted reward function consists of four main components: an operational test gate weighted at five percent to ensure code executability and prevent cheating, a slight incentive for code length also weighted at five percent, the open-source aesthetic preference model HPS version three with seven billion parameters to assess overall visual appeal, and a binary visual judgment based on the Qwen-3-VL model with thirty billion parameters to compare the generated painting with four reference images drawn from a manually curated dataset.
To build a taste benchmark, the researcher created a reference set of 178 manually classified paintings divided into two quality levels, which were previously generated using four open-weight model families, GLM 5.2, Cemi K 3, Qwen 3 Coder Next, and Qwen 3.5, based on real hibiscus flower photos. The training employed the Qwen 3.5 model with thirty-five billion parameters, built on a mixture-of-experts architecture, applying low-rank alignment by training all linear layers to overcome reward-curve stability issues and to activate the model’s layers efficiently on H200 chips.
This approach carries clear operational implications for software-engineering teams and digital development and design studios in the Gulf, Egypt, and the Arab region; relying on training open-source, medium-size models to generate editable procedural code reduces inference cost and dependence on major cloud API interfaces, and enables developers to build generation pipelines for visual assets and engineering or decorative designs derived from local heritage through custom reference sets, without requiring massive computing infrastructure or huge training investments.
The success of a taste-based reward function demonstrates that shaping intelligent model behavior is no longer limited to strict digital metrics, but has become a flexible tool for transferring a developer’s preferences and style into the model’s operational policy through open interactive environments.