The demoscene is a subculture focused on pushing the limits of computer graphics and audio within strict technical constraints, such as small file sizes or limited hardware. A recent project by a developer on the platform Datavorous explores this space by using machine learning to navigate the 'productive' nature of programming languages. By treating the peculiar, golfed syntax of Dweets—140-character JavaScript demos hosted on Dwitter.net—as a linguistic system, the author sought to use an autoregressive model to sample plausible continuations of unfinished code, effectively creating an 'autocomplete' for creative coding.
To achieve this, the developer used Qwen2.5-Code-7B as a base model. Because Dweets rely heavily on mathematical shorthand and code-golfing tricks that differ from standard programming, the base model initially struggled with the syntax. The author performed continued pretraining (CPT) on a dataset of 25,000 Dweets retrieved via the Dwitter API. This process significantly reduced the model's 'surprisal'—the negative log probability assigned to a token—and lowered the perplexity of held-out Dweets from 28.63 to 8.57. This indicated that the model had successfully internalized the specific idioms and structures of the Dwitter ecosystem.

This figure illustrates the significant reduction in perplexity and surprisal achieved through continued pretraining on the Dweets dataset.
To move beyond mere syntactic correctness toward aesthetic quality, the author implemented a curriculum training strategy. Using Dwitter's internal 'awesomeness' scores, the training process progressively weighted higher-ranked programs, eventually favoring the top 1,000 most-liked Dweets for approximately 67% of the sampling probability. This was followed by Reinforcement Learning from Human Feedback (RLHF) using the GRPO algorithm. The author acted as the reward function, manually inspecting and ranking approximately 40,000 animations to refine the model's policy. The final result is a tool that allows users to generate multiple visual continuations from a single code prefix, providing a way to branch off and explore different artistic directions in the demoscene space.

The chart visualizes how the training strategy influenced the model's ability to generate high-quality code across various popularity tiers.
While the model successfully improved the likelihood of 'beautiful' code, the author noted that the gains were spread across all awesomeness ranks, including those never seen during the curriculum phase. The project highlights a shift from purely functional code generation to aesthetic-driven synthesis, where the model serves as a collaborative partner in the creative process. The author has released the 'Demoscener-7B' model and the associated dataset on HuggingFace for further exploration.
One limitation of this approach is the subjective nature of the reward function. While the author's personal taste was injected into the model via RLHF, the results of a blind preference test by a third party confirmed that the model's outputs were favorable, but the 'correct' aesthetic remains a moving target. Additionally, the model's reliance on the specific quirks of Dwitter's JavaScript environment means its creative output is currently tethered to that specific platform's constraints and capabilities.

This chart provides evidence that the human-in-the-loop feedback and curriculum training successfully steered the model toward preferred aesthetics.
Ultimately, the project demonstrates how specialized datasets and human-in-the-loop feedback can steer large language models toward niche, highly-constrained creative domains. By treating code as a productive language, the author turned a technical challenge—finishing a complex, golfed demo—into an exploratory process where the AI suggests the next possible visual branch, allowing the human creator to curate and refine the final output.