32 comments

[ 0.22 ms ] story [ 10.8 ms ] thread
In the last couple of days I wanted to try out the new definitive DeepSeek v4 releases. I gave it the repository of a semi-abandoned video compression codec and I told it to perform the usual benchmark -> profile -> verify -> research -> improve loop. I specifically chose this codec because the authors include a verifier for the bitstream to make sure you don't break stuff if you want to try your own implementation. I gave the agents access to the compiler's profiler and also Intel's VTune, which has fantastic output. In a couple of hours the LLM generated SSE and AVX implementations of the compression and decompression algorithms that almost doubled performance with a single core. Then I asked it to create a CUDA implementation using NVIDIA's NSIGHT profiler as a guide and it also started doing some good work.

Personally, I believe that LLMs should be treated like an advanced version of Prolog or linear programming: you give the constraints, you have a way of verifying correctness, and you give it a clear goal. If the LLM can verify itself and course-correct you can basically leave it on autopilot

Is Mojo programming language useful in the age of AI?
Had a similar experience with my Rust implementation for JSONLogic expression evaluation engine. As it has a full test suite with 1000s of cases and a benchmarking script, I was able to give some basic hints to try different optimization techniques and the end result was impressive. Reached from 1.6s to 200ms for a full benchmarking test. https://github.com/GoPlasmatic/datalogic-rs First 3 versions were hand written and maintained for 3yrs, and now 4th version came out in less than a month's time with impressive performance.
> Personally, I believe that LLMs should be treated like an advanced version of Prolog or linear programming: you give the constraints, you have a way of verifying correctness, and you give it a clear goal. If the LLM can verify itself and course-correct you can basically leave it on autopilot

This!

People keep measuring how good AI is by one-shotting a problem, but I e found that a back and fourth via the Superpowers SKILL.md is how the model builds these constraints… then when it has all the holes, it gets to work

It's very much how I've been using claude code in the past 5 month: brainstorm -> generate specs (constraints) -> generate exact plan -> implementation + review -> test / validate. The last stage is the most crucial one, and it's the most difficult to get it right for a complex solution (it's tough to cover every variation). But so far, it's been working great..
Damn! If a solo engineer can do this, it makes the most around OAI/Anthropic start to look pretty weak.
Yeah, but here's a dirty little secret that very few people are discussing:

You can't use Claude for this sort of thing if the goal is to make better AI systems. Anthropic finetunes Claude to dissuade people and the agent from using research that actually works. Anything that they use internally in their own models is poisoned, to protect their moat.

By proxy, that also means any openweights model that was distilled from Claude is equally useless for this purpose.

Thankfully, I don't believe OpenAI does this - they are far more honest and seem to care about their reputation. Anthropic is evil though.

Training material seems to be especially rich re GPU kernels and SIMD.

I wonder if there is extra effort put into this because they are useful for the researchers working on the models or just a sub-domain that language models are a great fit for and humans have trouble with?

This is really cool - I really like the beam search idea,
Every step here has an oracle: wall-clock, the profile, pass or fail from the verifier. I had an agent-built app audited task by task, 10 came back done and 7 worked, and the three misses were the ones needing a credential or a setting on someone else's dashboard. Nothing in the loop could tell the agent it had failed, so it said done and moved on.
some of these submissions seem to be omitting the actual rules. the #1 on edinh has a line that says "bypass ban check"
submission #2 by gau nernst is most numerically stable
People are always going to hate auto-research and "loop engineering". Because it's got 2 properties:

1) it's the only way to get something out of models (or people for that matter) that they don't know yet.

2) it's harder to do with an LLM than without. Not easier.

3) and when you fuck it up, half the time the LLM (or other ML technique) makes a fool out of you and you spent $1000 to find the quickest way to get a robot leg on the ground is just to crash it into the ground.

Isn't cholesky - used to substitute householder at a point - faster but less stable in some cases? I'm just recalling from memory since I had done a small project on qr decomposition with householder for an exam this year. I mean, if it is faster than the standard torch operation probably there are good reasons for which it is not the default standard torch operation. Might as well be wrong, I'm not sure
For once Cholesky is less general than QR: Cholesky only makes sense for positive matrices, while QR works for any matrix (including non square).

Also QR is a primitive for operations like finding eigenvalues, and I don't think Cholesky can be used there.

Meta commentary but it felt fresh to read a long wall of text that didn't seem to be AI generated. Thanks.
author here!

welcome! check out my featured section

How is this meta commentary when this or its negative version is present on literally every post.
It's been fascinating doing a custom variant for GFQL, the first OSS embeddable Cypher property graph query engine for CPU+GPU -

- accelerated launch of our new backends like polars, including a new lazy mode & planner, which are fundamentally new paths

- while we initially aimed for top GPU benchmark scores, we now also maintain top CPU scores too!

Long-term, more interesting to me is this opens rethinking what it means to be a query engine. Right now we are making it the fastest in general, especially on workloads from our own use, major industry benchmarks, and our users. At the same time, similar to jit and multistage computing, we're looking at new ahead-of-time optimization techniques users can do that are more interesting than plugging in custom indexes. Essentially, if our agents can do fast specializations, there should be safe hooks that we can expose to our user's agents too!

(comment deleted)
One thing worth to note in the competition is that 8 out of the 10 top solutions, which all happened to be optimized this way completely broke at any other input than the competition ones.

The only solutions that did not break when tested with OOD shapes were made by experts who know a lot about GPU programming and that did not create 25k lines of CUDA but followed and adjusted their solution in reasonable bounds.

The takeaway from this is that these approaches will always solve for specificity, but it's a much harder task to steer the model into making general solutions. So if you're an inference provider for some specific model shape, fantastic, go for it. If you are a maintainer of a open-source library, this is not useful.

(comment deleted)
Mirrors my experience: LLMs are really good at optimizing, better than most humans. But also, they tend to not reach absolute peak performance where people made an effort to optimize something.

Since most problems see fairly little optimization, that's still a big win most of the time.

I've had pretty good luck with the following process for performance optimization loops:

- Have an agent generate unit tests until it gets to 100% path (not just statement) coverage, with every numerical test asserting checks against golden values to prevent regressions

- Let it rip on a performance improvement loop, for the widest E2E representative test case you have. Have it generate flamegraphs along the way so you can check in and steer it as necessary.

- Optionally allow for 1 ULP changes in output values so that it doesn't kill itself getting bit-exact results.

- Have it flag correctness errors as it goes, since your code probably isn't bug free.

This is also how I've done language ports from python to rust, and having the ironclad test coverage protects you from drifting.

it is nice to see continued enthusiasm for kernel programming and optimization. however, it would be nice if they have more eyeballs at the rocm side of things. gpu mode does have some challenges for amd's platform, but it seems sparse in comparison.