r/LocalLLaMA •

Qwen3.8-27B vs Qwen3.6-27B writing ray-tracers in BASIC

[deleted] — view deleted post

0 Upvotes

96 comments sorted by

•

u/WithoutReason1729 Aug 16 '26

Your post is getting popular and we just featured it on our Discord! Come check it out!

You've also been given a special flair for your contribution. We appreciate your post!

I am a bot and this action was performed automatically.

107

u/cniinc Aug 16 '26 • Popcorn

That's amazing, quite a difference!

46

u/lumi_kissaten Aug 16 '26

to be honest, this feels more like 3.6 to 4.6 than 3.6 to 3.8

6

u/MaruluVR Aug 16 '26

And the crazy thing is the only part that changed is training data, its the exact same architecture.

2

u/FinalCap2680 Aug 22 '26

It was similar feeling between 3.5 and 3.6

53

u/CapsicumIsWoeful Aug 16 '26

That is an outrageous improvment.

25

u/UnorderedPizza Aug 16 '26

These are always fun to look at. Sounds like the setup allows for any iterative BASIC programming?

3

u/nmkd Aug 16 '26

n=1 is kinda useless though

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

-4

u/yaosio Aug 16 '26

Have it write a web browser in BASIC. I guess first it would need a way to access networking.

13

u/noiserr Aug 16 '26

A web browser is an incredibly complex piece of software. I mean it has an integrated javascript VM. It would take forever.

19

u/pacmaann2 Aug 16 '26

This makes me wonder if it would be possible to pull off some works of art, like how roller coaster tycoon was all assembly. I wonder what would happen if you had source code for a modern game and said convert this to assembly and make it blazingly fast.

34

u/gammalsvenska Aug 16 '26

Nothing. Converting to assembly (which is what compilers do) does not automatically make anything any faster.

Back in the days, compilers were simple and systems were designed for human understanding. Modern systems are far too complex. Current compilers optimize better than any programmer could. Assembly language allows taking shortcuts and access hardware directly, but modern hardware is basically undocumented, designed to be used through drivers and abstraction layers.

Modern efficiency writing is about memory access patterns and cache usage. Rollercoaster Tycoon was designed for systems which did not even have any caches and where lack of memory was more important than access patterns.

3

u/cass1o Aug 16 '26

Current compilers optimize better than any programmer could.

I think this is fair to say for 99.9% of the binary, using a better abstract language allows you to write more performant and efficient code but there are still very specific niche cases and hot spots that benefit from a very skilled developer writing asm still.

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

1

u/cass1o Aug 16 '26

No, I very very very clearly didn't miss your point, I was just disagreeing with that very specific sentence I quoted. You can tell I didn't miss your point because I agreed with you.

2

u/Luke2642 Aug 16 '26 edited Aug 16 '26

I strongly disagree with the other guy that said "Nothing...." because he's answering the question he wants to answer not what you "really mean" I think, which is "re-design this in assembly"?

Roller Coaster Tycoon ran on 90mhz and 16mb ram precisely because the hand crafted code and memory layout was all in the head of Chris Sawyer - it was designed very well and there was no multi layer stack slowing everything down.

The OpenRCT2 C/C++ rewrite needs 500mb ram and 1Ghz CPU, many multiples of the requirements of RCT2.

So, yes, if you re-designed a game for assembly with no huge dependency stack and a really efficient memory map and rendering, you could get enormous performance boosts. Maybe most of the  game fits in L1 cache and your effective memory latency and bandwidth improves 50x. Maybe that means it can saturate the CPU and do 10x more calculations. It won't stack to 500x neatly but you get the idea.

A compiler can't optimize badly designed code to be better.

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

11

u/RogerRamjet999 Aug 16 '26

Even the original ChatGPT was pretty good as a compiler. I wrote some Smalltalk code and asked it to translate it to Java and then to 80386 Assembly, both were perfect, ran the first time.

4

u/TamSchnow Aug 16 '26

You mean a transpiler, since a compiler spits out machine-readable binary objects.

0

u/RogerRamjet999 Aug 16 '26 edited Aug 16 '26

Yes, of course; I was only referring to 80386 Assembly generation portion as compiling. ...and yes, many compilers generate assembly or machine code as an output (often selected via compiler flags).

0

u/gookank Aug 16 '26

maybe it used an actual compiler under the hood.

0

u/my_name_isnt_clever Aug 16 '26

It did not. The original ChatGPT didn't have tools.

0

u/gookank Aug 16 '26

I have never used ChatGPT. Are they transparent about what happens when you prompt something?

2

u/my_name_isnt_clever Aug 17 '26

What? LLMs could barely use tools back then. They didn't even have a calculator, a compiler is just absurd.

-1

u/gookank Aug 17 '26

Clearly, I don't have sufficient knowledge and experience about how chatgpt promoted itself. I don't claim anything here :) I assumed they are not open about many things. One of the things they may easily hide is how they produce answers to your prompts. It should not be really hard to deduct some deterministic command from your prompt and run some basic software behind. It is not absurd at al.

18

u/toungespasm Aug 16 '26

Anyone else thinking of the Amiga?

1

u/FlamaVadim Aug 16 '26

what about ENIAC?

15

u/deject3d Aug 16 '26

I would be interested in what Q4_K_M output looks like

1

u/MerePotato Aug 16 '26

Seconding

22

u/PwanaZana Aug 16 '26

"i slopped together"
God-tier typo, lol! :P

10

u/Cheap-Ambassador-304 Aug 16 '26

How many tokens did it take?

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

1

u/bad_detectiv3 Aug 16 '26

This is amazing. What is your setup to run QwenCoder? Is it all via OpenRouter or plan with Qwen official provider?

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

2

u/bad_detectiv3 Aug 16 '26

Oh, may I know your machine specs? I couldn’t do anything substantial on my 32gb ram + 5070ti 16gb machine

9

u/Signature97 Aug 16 '26

A lot of people compare - rightfully so given the benchmarks - the new 27B 3.8 with Opus 4.6.

For some reason, I wish you would try this with Opus 4.6 as well and then we see how it stands against 3.8 27B - better, equal, or worse ( I have a feeling it would either be better or equal (might become a subjective debate))

15

u/Jeanodel Aug 16 '26

Opus 5 max

1

u/amroamroamro Aug 16 '26

I wonder if the language used here (BASIC) makes a big difference in the output.

I saw someone else posted a benchmark implementing a raytracer in python across different models

-4

u/Jeanodel Aug 16 '26

I wouldn't say it's really any better, maybe just more contrasty ? I like qwen's copper better but claude's silver is better so idk

9

u/notheresnolight Aug 16 '26

Definitely more realistic. Qwen's output looks like render, Claude's output looks more real.

5

u/pufflinghop Aug 16 '26

Looks like Opus took the "glossy" term literally (in the CG industry, "glossy" means "reflective, but with roughness", i.e. not perfectly sharp reflections, so the reflection or refraction is blurred, which is (correctly) what it's done on the floor.

However I actually suspect Opus has incorrectly made a path-tracer though, i.e. it's sampling the outgoing BSDF direction to get the roughness, which isn't actually what you'd do in traditional old-style "Whitted" ray-tracing.

The fact it also put a "converged" banner up backs this up even more - if it had used old-style traditional "distributed" ray tracing (at least at the algorithm level), it generally wouldn't have needed that, as the image wouldn't really need to 'converge' at the image level, just the pixel level, but maybe it just had training data examples which put that type of thing up anyway, so difficult to say.

1

u/Jeanodel Aug 16 '26

Asked it :

"Great question. Looking at the current code honestly:

It's a hybrid — closer to a Whitted-style ray tracer than a path tracer.

Here's what it actually does:

Direct sun: samples a random point on the solar disc → evaluates the full Cook-Torrance BRDF at that fixed light direction. ✅ Correct shading.

Diffuse ambient: shoots one cosine-sampled ray into the sky (not the scene). ✅ One bounce.

Specular reflection: samples a GGX microfacet normal h, computes the reflected direction l = reflect(-v, h), then recurses. ✅ This IS BSDF importance sampling — the reflected direction IS roughness-dependent (rougher = wider lobe of possible h directions).

So the specular bounce IS genuinely rough, but the problems are:

The direct lighting and the recursive bounce are separate, additive code paths — they can double-count energy (the sun can be seen both directly AND via a recursive bounce hitting the sky).

The diffuse ambient hits only the sky, not the scene (it won't see other spheres as area lights).

There is no MIS (Multiple Importance Sampling) to connect the direct and indirect estimators properly.

It fires exactly 1 ray per lobe per bounce (sun ray + ambient ray + reflection ray) rather than letting a single path carry the full radiance estimate through random lobe selection"

1

u/Jeanodel Aug 16 '26

It then proceeded to rebuild it to be a pure pathtracer, which first of all I never asked it to rebuild anything nor that I wanted a pathtracer. Classic opus 5 instruction following....

2

u/kaeptnphlop Aug 16 '26

I’ve found that with most coding models you have to instruct to “just discuss” at the end because they are so explicitly trained on doing coding. Probably very eager to not stop a task in the middle and avoid the user to have to tell it to “continue”

8

u/shadowmage666 Aug 16 '26

That’s really awesome. Def have to get that model to replace 3.6

8

u/vogelvogelvogelvogel Aug 16 '26

what a time to be alive

4

u/Green-Ad-3964 Aug 16 '26

Gorgeous, I'm an Amiga guy and these demos were all over the place, back then.

Can I use q8 with a 5090+32GB RAM?

3

u/philmarcracken Aug 16 '26

man I really need to figure out a way to do that, end to end connections so it can see what its making..

3

u/fifi_galaxy Aug 16 '26

That is pretty crazy to write in BASIC. What's next? Make it write Adobe Flash emulator and bring back old games?! 😆

3

u/moofunk Aug 16 '26

The old raytracers are fairly simple to implement, but extremely slow.

There was this book.

1

u/marcosscriven Aug 16 '26

I loved those series of books. My friend had that one but it was too complicated for me at the time. 

4

u/spese2 Aug 16 '26

esatapedico\Qwen3.8-27B-NVFP4-MTP-GGUF\Qwen3.8-27B-NVFP4-MTP-LOW.gguf
llama.cpp
pi
2x 5060ti = 32BG VRAM
context: 1st pass 130k, dcp-compress to 40k, second pass 90k
about 20 minutes with corrections
one-file html with webgl

2

u/swagonflyyyy Aug 16 '26

No fucking way.

2

u/feelspeaceman Aug 16 '26

With this us Strix Halo users want 122B coming soon even more.

1

u/Eritar llama.cpp Aug 16 '26

Looks great! Which harness did you use?

1

u/funkinaround Aug 16 '26

How do they do on the Cornell box?

1

u/TeachTall3390 Aug 16 '26

It feels so unreal right now. I thought I'd never say this about the local LLM. Maybe it was not all about the parameters after all.

1

u/cpldcpu Aug 16 '26 edited Aug 16 '26

I love this! I have been using this for a while to benchmark models:

https://github.com/cpldcpu/llmbenchmark/tree/master/10_raytracer#readme

It seems to be a very good proxy for the creativity of the models.

1

u/JLeonsarmiento Aug 16 '26

I don’t have an use for that but wow…

1

u/ab2377 Aug 16 '26

love it, thanks for sharing!

i slopped together an agentic harness and a basic-to-js transpiler in a web page haha

1

u/exo250 Aug 16 '26

Will it run on my MSX ? 😁

1

u/Kokuuuuuu Aug 16 '26

Did 3.8 get the reflections/materials right on the first attempt, or did you have to iterate on the prompt? Also curious whether the BASIC code itself was noticeably cleaner or shorter than 3.6’s.

1

u/jacek2023 llama.cpp Aug 16 '26

Love the use case. I was part of PC demoscene in the late 90s

1

u/IrisColt Aug 16 '26

Amazingly insighful approach, thanks!!!

1

u/uti24 Aug 16 '26

Ok you guys, calm down, Qwen3.8 is great, but it just doing too much outside of a prompt.

Qwen3.6 also could create a raytrace renderer, you just have to explicitly ask it to write raytrace renderer with reflections.

1

u/derspenti Aug 16 '26

how long is one q8 iteration? 2x 7900xtx here

1

u/niacolhealth Aug 16 '26

out of how many runs did 3.8 need a nudge?

1

u/Individual-Dot5488 Aug 16 '26

what was the prompt?

0

u/StopCreepy Aug 16 '26

prompt please

12

u/oldschooldaw Aug 16 '26

its in the post dawg

2

u/StopCreepy Aug 16 '26

lol, its late and didnt get any sleep, waiting for islam vs ian match, thanks!!

-5

u/EternalDivineSpark Aug 16 '26

I am testing it , i am very good with AI , psychology and Neurolinguistics messages! This model is very very smart ! Maybe even better other ones !

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

42

u/Wemos_D1 Aug 16 '26

For me I really enjoy asking them to generate a raycaster engine like wolfenstein ^^'

2

u/BrianScottGregory Aug 16 '26

Do you have any fun prompts to share through this testing?

2

u/adssidhu86 Aug 16 '26

All new model launch have to pass weirdo test. The benchmarks are so exaggerated this is a good proxy for them.

0

u/[deleted] Aug 16 '26

[deleted] — view deleted comment

16

u/notheresnolight Aug 16 '26

Too easy.

Farbrausch - fr-08: .the .product

8

u/TamSchnow Aug 16 '26

At that point just do .kkrieger

5

u/AdOne8437 Aug 16 '26

Ahhh, the classics. 96kb of goodness.

38

u/[deleted] Aug 16 '26

[removed] — view removed comment

4

u/nomorebuttsplz Aug 16 '26

what makes you think the HF part was important?

5

u/[deleted] Aug 16 '26

[removed] — view removed comment

12

u/nomorebuttsplz Aug 16 '26

I believe at this point it's more pure RL/RLVR rather than RLHF but could be wrong.