Remix.run Logo
▲ badsectoracula 3 hours ago

I did exactly the same thing with Qwen 3.8 27B but i also asked it something else: a couple years ago i wrote a simple upscaler[0] when i was learning about neural networks. The network is dead simple: it takes a 25 inputs for a 5x5 grid around a pixel and outputs the 2x2 pixel grid that the input pixel should be replaced for a (width2)x(height2) upscale. I trained it on a bunch of random images (in hindsight i should have trained it on game screenshots but w/e) and it looked quite nice.

So i asked Qwen 3.8 27B two things:

1. What it is this network all about? I only gave it the ann.c code that implemented a simple artificial neural network library in C and the setup code that specified the network's shape but not its purpose.

Qwen 3.8 27B tried a bunch of stuff, taking the layers one by one, proding numbers through it, etc and finally figured out it is some sort of 5x5 to 2x2 filter, most likely working with pixels (i never mentioned pixels or graphics), though it wasn't certain about the exact purpose. It did rule out a bunch of uses like being a downscaler or classifier, from its behavior.

2. After i revealed what it was, i asked it if it can improve it but keep it 100% compatible with the existing program that used the weights file. And sure enough, it did improve it. I gave it the original training C code and dataset. It made a few experiments (and wrote its own training C code because it found mine too slow :-P) and ended up improving the weights. The difference[1] is small, but it basically eliminated some small noise that was always there and made some transitions less "halo-y". Of course for the purpose i wanted it (use it to upscale games in realtime) it isn't that great (too heavy) but it was learning material anyway. Though one bonus thing i noticed is that it upscales my random doodles much better than any Krita filter[2] :-P.

The above isn't Qwen 3.8 27B observing the weights directly and making sense out of them (ok actually it did seem to make some sense of the weights in the "#1" but i didn't dump the entire network to it - though thinking about it, it is only around 16384 floats so it might work). It just used a bunch of scripts it wrote in Python (and later C) but i still found it interesting to watch it go at it.

[0] https://mastodon.gamedev.place/@badsector/113765818432603610

[1] http://runtimeterror.com/pages/iv/images/a3d94ea369ff95ecf05...

[2] http://runtimeterror.com/pages/iv/images/4e29d027a8aa6e89db5...

▲dotancohen 3 hours ago | parent | next [-]

  > the 2x2 pixel grid that the input pixel should be replaced for a (width2)x(height2) upscale.
Was it better than linear when repeating the process for 4x, 8x, and 16x upscale?
▲badsectoracula 2 hours ago | parent [-]

I hacked together a 4x (via applying it twice) scale once when i was modifying Gamescope to see how it'd look but it was both very slow and i didn't like the result so i only kept the 2x one[0].

Out of curiosity i did apply it twice to the drawing i posted in my previous comment with a 4x bilinear upscale made in Krita[1]. TBH i think a dedicated 4x network would do a better job though even then, there is only so much a network can hallucinate to fill in details :-P.

[0] https://github.com/badsectoracula/gamescope/tree/neural-netw...

[1] http://runtimeterror.com/pages/iv/images/20b9558400bcf26511d...

▲simonw 3 hours ago | parent | prev [-]

Which coding agent harness did you use with Qwen for that?

▲badsectoracula 2 hours ago | parent [-]

I've been using Pi though i'm currently doing the NIH thing and making a custom one in C++ with a web-based frontend :-P.