Efficient Validation for
LLM‑Generated Rendering Optimizations

Paper (soon) Video Scenes

An LLM rewrites shaders to run faster. We check that every rewrite still looks right, with 47–85% fewer test renders.

OriginalOptimizedFLIP error

TL;DR

Problem

An LLM-driven search proposes hundreds of faster shader variants. Most are approximations, and each must look right for every camera, time and light the app can produce — which can only be sampled.

Idea

Sample those conditions from a unit cube, render original and candidate, and stop a Bayesian test as soon as it is sure. Edits that resemble ones already proven safe may stop earlier.

Result

Up to 2.19× faster Shadertoy shaders, 1.89× on MaterialX, 1.70× on a Godot render pass, with 47–85% fewer validation frames.

Read the full abstract

LLM-driven evolutionary search can propose many rendering-code optimizations, but each approximate candidate must still be validated across dynamic viewing, lighting, material, and temporal conditions. We use a backend-specific Primary Render Parameters Space (PRPS) to sample rendering conditions, and formulate candidate acceptance as a Bayesian sequential test over the rate at which FLIP error exceeds a user threshold. To reduce rendering work, the validator adapts an empirical SAFE decision threshold: globally from the observed distribution of rejected candidates, and per candidate from LLM-derived mutation embeddings compared with previously validated neighbors. Rendered evidence remains the acceptance basis; previous candidates only modulate how strict the sampled-evidence threshold must be before acceptance. Across Shadertoy shaders, MaterialX-generated GLSL materials, and two Godot shader settings, the pipeline finds 1.12×–2.28× speedups under stated error thresholds, while replay and live-pipeline studies reduce validation frames by 47–85% relative to conservative validation with few disagreements against conservative replay labels. The resulting contribution is an efficient sampled-validation mechanism for open-ended rendering optimizers, with guarantees defined over sampled PRPS evidence.

Method

The search loop follows FunSearch and AlphaEvolve: an LLM proposes patches, and an island-based evolution keeps the fast ones. For rendering, correctness is perceptual, depends on viewing conditions, and can only be sampled. So we build the system around the validator.

Render program shader / pass Evolutionary search island 0 island 1 island 2 island 3 pick a parent + prior programs, their times and errors LLM mutator proposes a code patch optionally prompted with few-shot patches profiling context Bayesian sequential validator (ours) sample r ∈ [0,1]D reference candidate FLIP error > ε ? exceedance τ posterior over rate p undecided: sample and render the next batch SAFE → accept P(p<τ) ≥ γsafe(i) BAD → reject P(p<τ) ≤ 0.01 budget out → reject Profiler timing for SAFE candidates only Trust-guided threshold (ours) diff LLM views vs. safe / bad low trust · 99% high trust · early γsafe(i) sets γsafe(i) per candidate exceedance rates patch renders, timings GPU render farm up to 64 × RTX 3060 rented on Vast.ai accepted program, with its render time and error, joins an island; repeat every generation

1Render-parameter space

Every dynamic input the application exposes (camera, time, lights, material inputs, environment) becomes one coordinate of a unit cube r ∈ [0,1]D. The validator samples the cube; a small adapter maps points to renderer state. D ranges from 1 to 34.

2Sequential Bayesian test

A frame is an exceedance if its FLIP error exceeds ε. With k exceedances in n frames, the rate p ~ Beta(1+k, 1+n−k). Accept when P(p < τ) ≥ γsafe, reject when it falls below 1−γhigh.

3Trust-guided threshold

How much clean evidence acceptance needs is set per candidate. Mutations whose LLM embeddings resemble validated safe edits may stop early; risky ones stay at the conservative 99%. Rejection is never relaxed.

Buoy render OriginalOurs|Error| ×20

Where validation time goes, and how trust cuts it

Bad candidates are rejected within tens of frames. The expensive ones are the safe ones: under one fixed 99% threshold, each needs 916 renders before it can be accepted. Try it:

Try itChange the trust or the candidate.

1Each square is one sampled condition, rendered by the original and the candidate: FLIP within ε or an exceedance

2Counts give a belief about the rate p:

3Stop once P(p < τ) crosses a threshold

Trust lowers that bar per candidate. An edit whose LLM description resembles edits already proven safe may stop after a few renders; unfamiliar or risky edits keep the full 99%:

Candidate diff - for (i<200; i++) + for (i<180; i++) float t = ...; - c = a / b; + c = a * inv_b; ... new mutation i LLM describes it mechanismwhat computation changed guardwhich conditions are at risk visualwhat a viewer would see mechcalcalibrated on neighbors one embedding per view Contrast with history nearest safe vs. 3 nearest bad (rate-weighted) RCv = bad_scorev − safe_maxv Fuse and rank s(i) = Σv wv RCv KTA-learned weights rank among N candidates trust = exp(−rank / N) SAFE threshold γhigh = 0.99 trust 0: 916 renders γlow (learned) trust 1: few renders γeff = γhigh + (γlow − γhigh) · trustp

At full trust, the learned thresholds accept a clean candidate after 34–140 renders instead of 916, depending on the session.

Results

Eleven Shadertoy shaders, three MaterialX materials compiled to GLSL, and two Godot workloads, one of them an engine-internal render pass. All results use τ = 1%.

(a) Speedup of the best accepted program

(b) Validation frames vs. conservative, session replay

(c) Validation samples per candidate, live runs

Level of detail

Optimized render
optimized
FLIP error map
FLIP

What the LLM actually changes

cos 6θ = T6(cos θ)
Lighthouse stripes example from the paper
// stripe pattern around the lighthouse-  cos(atan(pos.x, pos.z) * 6.0)+  float r_inv = inversesqrt(dot(pos.xz, pos.xz));+  float c = pos.z * r_inv, c2 = c*c, c4 = c2*c2;+  32.*c4*c2 - 48.*c4 + 18.*c2 - 1.;   // T_6(c)

Exact math, not an approximation: cos 6θ is the Chebyshev polynomial T6(cos θ), so atan and cos disappear.

One run, as a search tree

Hover any dot to trace its ancestors (dashed).

Per-scene results

Best accepted program per scene, with what the whole optimization session cost: LLM API calls and rented GPU time for rendering and validation.

Acknowledgements

We thank Johannes Schudeiske for taking part in the discussions that shaped this project, our student Ilia Bozhinov for the early studies, Kirill Bazhenov for his help in connecting us with industry, and Angelo Pesce, Brian Karis, Anton Kaplanyan, Max Strakhov and Harold Westlund for sharing their industry expertise and feedback.

We are especially grateful to Inigo Quilez, who kindly granted us permission to use his shaders in this work, and to all Shadertoy, Godot and MaterialX authors whose work we build on. All shaders remain the property of their authors; their licenses are listed below.

Shadertoy

Shadertoy shaders without an explicit license fall under Shadertoy's default CC BY-NC-SA 3.0 Unported.

Godot

MaterialX

  • Linen, Bricks, Car Paint: Standard Surface example materials from MaterialX (Apache 2.0, © Contributors to the MaterialX Project); the generated GLSL includes OSL-derived code (BSD-3-Clause, © Sony Pictures Imageworks).