Maxwell: A new kind of model that sits between code and hardware
Posted by laginimaineb 3 days ago
Hi HN, I'm Gal from doubleAI. We've built Maxwell, a new kind of frontier model we call a Code Execution Model.
It sits between your code and the hardware. No humans in the loop! Maxwell makes the code run faster as it runs, without ever changing a single line.
Maxwell sees programs from the inside: traces, profiling information, and the data flowing through them. It adapts dynamically to the environment, including the hardware, what else is running, and what the inputs look like.
Code execution models change the way we approach coding. Today, Claude/Codex (and humans) keep re-optimising code for every different use-case hardware and data flow (think of LLM inference engines, like vLLM!). Our bet is that this is unnecessary, suboptimal, and that it does not scale. Instead, we think the right answer is to make code a living, thinking, thing.
Early access is open at heymaxwell.ai. Happy to answer questions here.
Comments
Comment by epsylon 2 days ago
How was the formalization of Python accomplished? What formal proof framework do you use?
How do you reproduce the optimizations across several instances / runs of the program? (since the source code doesn't change... assuming you don't redo the same work over and over?)
What visibility, tracking and logging is there into the actual code running? Debugging is an extremely important part of building software, especially if there's a demon switching out binary code constantly underneath. Even if the recompiler is perfect (it won't be), user code never is.
Why is the superoptimization and visibility into the data not surfaced back to the level of the source code? This seems like a waste.
Comment by laginimaineb 2 days ago
Comment by calgoo 2 days ago
Comment by laginimaineb 2 days ago
If you don't use Maxwell everything works as is.
Maxwell does swaps in memory during runtime, not on disk.
And we of course sign every output and do externalise the proof of equivalence.
Comment by calgoo 2 days ago
Thanks!!!
Comment by fc417fc802 2 days ago
To the extent that a formal proof is a black box ... ?
Which leads to an intriguing thought. If our languages and other infrastructure supported formal proofs that compiler output matched input it would obviate the motivation for reproducible builds.
Comment by mccoyb 2 days ago
- verification
- superoptimization specialized to a particular piece of hardware
- patching binaries while they are running
all great
That being said, I'm getting some weird vibes from the prose on this site. Little phrases and claims that seem intended for the purposes of marketing, but conflate things with clear technical meaning in confusing ways.
For instance: I watched the video ("a code execution model has to be right every time") which implicitly communicates something like "the model cannot hallucinate" ... of course, the agentic LM is still probabilistic, but it is wrapped with verification tools (to reason about semantic equivalence), and is likely post-trained to be good at using those tools.
This strikes me as a conflation between the model and the harness which is intended to strike a marketing point (like: "it doesn't hallucinate") but which is clearly a ridiculous claim to make (falling down the slope: any harness which does error correction for improper tool calls might also be a "model which makes no mistakes")
Also: "self-improving code"
that's not really it, is it? Self-improving code would be code that runs itself and improves itself. This is code I run, which Maxwell watches and improves ... no?
Related: I dislike the usage of the word "model" in the above discussions on the site. Do we want to call everything a "model" now? Can anyone invent a new frontier "model" by post training an agentic LM with tools?
Also, let's say you are optimizing kernels on GPUs. This can be subtly fraught: for instance, it was well-known for awhile that one should only use certain pieces of software (vLLM, for instance) to reproduce papers (which used vLLM) there are non-deterministic sources of randomness (including, of course, floating point) that would prevent one from recovering the performance claimed in a paper ...
Comment by gavinray 2 days ago
> Self-improving code would be code that runs itself and improves itself.
I don't find the description any less accurate than saying that a JIT'ed application is self-improving code.Comment by mccoyb 2 days ago
But people who write JITs don't call the overall process (original code, JIT) "self-improving code", do they?
What is the "self" in (original code, JIT)? Is it the entire process? But the JIT doesn't make itself better as it runs? Is all code that runs in a managed runtime with dynamic analysis self-improving?
A much better term might be "dynamically-improving code"
But related and to the point of my original message: the phrase "self-improving" has been used in vogue by AI research / labs ... and this is another example of something which is not a clear term, and seems intended for marketing
Comment by luckystarr 1 day ago
Comment by krmmalik 2 days ago
Maybe it means both but perhaps the emphasis is on speed.
Comment by f0e4c2f7 2 days ago
Comment by laginimaineb 2 days ago
We need proofs of equivalence (including for code with side effects!) between original code, and new code, possibly in some other language. Say Python and a raw SIMD implementation. To do this we have a full 'embedding' of said languages in the same formal framework. It also requires modeling exactly what 'state' means in dynamic high level languages.
Comment by krmmalik 2 days ago
Comment by laginimaineb 2 days ago
Comment by gavinray 2 days ago
The homepage does not do a very good job of explaining what we're looking at:
It appears to be a combination of two things:
1) A formalization of the Python language
2) An LLM which hooks into running programs and hot-swaps code with verifiably-equivalent behavior but better runtime performance, found via superoptimization and then verified via the formalization rules
This is brilliant, and in hindsight one of those "I can't believe nobody had thought of this yet" sort of things.
Comment by amelius 2 days ago
Please speak for yourself. We've seen many such ideas here even putting an LLM into a CPU to do branch predictions. Using it to write a (jit) compiler with correctness preserving transformations is not something that didn't occur to most compiler folks.
Comment by amelius 1 day ago
Comment by levineyoav 2 days ago
Comment by alirezaxdehghan 2 days ago
Comment by netdevphoenix 1 day ago
Comment by the_sleaze_ 1 day ago
Comment by pfg_ 1 day ago
Comment by Revanche1367 2 days ago
Comment by laginimaineb 2 days ago
Comment by Revanche1367 1 day ago
Comment by julesrms 2 days ago
Comment by laginimaineb 2 days ago
(a) Scope: Maxwell can optimise portions of both your own code, but also of underlying libraries too (think libc), according to your data flow and env. These aren't places where you necessarily have source code or an easy way to replace it.
(b) It's dynamic: like a JIT, if your data flow _changes_, Maxwell detects new bottlenecks and reoptimises. A good example is an inference pipeline where e.g. the concurrency or seqlens can change suddenly (depending on what your users do). If you reoptimise for each such case, you'll do so forever (and there are many different operational points, each requiring their own algorithmic approach).
Comment by julesrms 1 day ago
You say "think libc" - are you suggesting they could dynamically recompile bits of libc and do better than LLVM's link time optimiser already did it??
What I assumed was that you'd run this thing on some test runs, as a profiler step, and create an optimised binary. But you say they expect to run your code through an LLM all the time!?
The idea that you could run your code through an LLM (which must surely slow it down 100x at least), and then find enough missed optimisation opportunities to make up for that slowdown is nuts! (Or I've just misunderstood the whole premise!)
Honestly, the places in programs where you can get meaningful performance gain (that isn't already handled by your compiler) is all at the high-level big-O level, and that doesn't require runtime inspection.
Comment by mccoyb 1 day ago
The binary is running. Maxwell is watching it: presumably there is some cost to the watching, but the LLM is not running in the binary process. Maxwell also has dynamic information about the running environment. Maxwell can then try and superoptimize the running binary using the dynamic information it has, but to do so, it needs to create semantics-preserving patches to the running binary.
What should be clear here: dynamic information is strictly more information than what a static AOT compiler has access to.
So that's the problem: we're going to patch the binary while it is running, and we need the patches to preserve the semantics as expressed by the high-level program, possibly assuming that the compiler was semantics preserving, etc. I'm assuming they have custom compilers or something for all of this.
Getting this to work probably involves creating some sort of source map, perhaps a custom linker, etc (just guessing) from high-level program to binary -- but assuming you handle all of that, then the job of Maxwell is just the job of a normal superoptimizer: propose semantics-preserving patches, see how they do, etc.
In theory, you could propose terrible patches frequently - superoptimization normally discards these, but you with bad proposals you might spend a long time searching for good patches. But LLMs are good proposers now, so you'd probably mostly get good patches (to a limit).
Authors, correct me if I'm wrong.
Comment by julesrms 1 day ago
But if:
- we're talking about compiled code, where the compiler has already squeezed out all the low hanging fruit in terms of performance
- it's running some kind of external process somehow watching the data flow around in memory, and is figuring out what code is doing what. This is at best incredibly expensive, even if happening in parallel
..then the chances of actually finding useful micro-optimisations that are also safe to patch while running without changing the memory layout and messing up.. is surely pretty close to zero.
I can only assume that it's not actually native code, and they've built some kind of python JIT engine which is finding efficient replacements for chunks of common python, where it starts off so slow that even the massive amount of effort required manages to pay off in a long enough run.
Comment by mccoyb 1 day ago
Comment by sfink 1 day ago
It's refreshing to read human prose about something like this. There's so much you can get about the author's state of mind -- pride at what they've accomplished and how they like to conceptualize it, traces of how they learned things and what those things mean to them... for me, it's a reminder of what we've lost in giving over so much of our writing to AI.
But it's understandable that the writeup would trigger defensiveness. It claims a lot of originality and novelty that seem overreaching. AIUI, it's an optimizing JIT with a superoptimizer and a shared cache, with the search procedure guided by AI. And the equivalence model that the superoptimizer is based on includes all of Python and can handle both CPU and GPU code. It's quite impressive, really.
It's hard to tell what of it is new. Superoptimizers are not, JITs are not, caching JIT code is not, using machine learning to speculate or search is not. Constraining an LLM to produce correct output is no newer than forcing semantically valid JSON output. (You could think them as different type systems.) Different JITs have handled different kinds and amounts of runtime information -- tracing JITs, runtime type inference like SpiderMonkey used to use, speculative compilation and invalidation (global or just in time like inline caches)....
But none of that takes away from Maxwell. There isn't really enough information to compare it to other systems. Random example: many JITs work really hard to balance compilation time with execution time, and the post doesn't talk about that. Is it only for long-running code? Does it reach a steady state, and if so how much overhead is there at that time? What does it make slower or bigger?
At any rate, it seems like there's a lot of interesting work in Maxwell, and it's worth checking out.
Comment by brainless 2 days ago
It looks interesting but I am really unable to see what is so different from a couple days of prompts and digging into a software to optimize it using LLMs.
Comment by enduku 1 day ago
Comment by claytonjy 1 day ago
How many Maxwells do I need? Maxwell isn’t free; when is it worth it vs when are the gains not enough to justify? How well can we estimate that up front?
Does Maxwell only look at one container, or each of them individually? Do they all get the same patches or are they all treated independently?
Does the profiling or patching cause temporary delays? If so how much, how might it compare to a GC pause or similar?
Comment by nickdothutton 2 days ago
Comment by gus_massa 2 days ago
Comment by Ohentis 2 days ago
Comment by fhn 2 days ago
Comment by laginimaineb 2 days ago
Comment by tomxor 2 days ago
It's not clear to me from the article if the comparison is with locally compiled binaries, that would be the fair comparison.
I would expect this to be better all rounder in theory, but it would be interesting to see what the difference is from a locally compiled baseline, and therefore if the complexity, obscurity and cost is worth it (again probably application and hardware dependant question).
Comment by levineyoav 2 days ago
Comment by falsemyrmidon 2 days ago
Comment by gordon28 2 days ago
Comment by Dan_Elkis 2 days ago
Comment by nadavsch 2 days ago
Comment by laginimaineb 2 days ago
Comment by addaon 2 days ago
Comment by leopoldcongo 2 days ago
Comment by nadavsch 2 days ago
Comment by fhn 2 days ago
Comment by leopoldcongo 2 days ago
Nobody is afraid of Israel anymore go scare some Americans instead
Comment by Dan_Elkis 2 days ago
Comment by Moomoomoo309 2 days ago
Comment by nerfyink 1 day ago
Comment by ImPostingOnHN 1 day ago
as a jew, I'll thank you for not conflating the two again, because claiming all jews are a part of what israel is doing is tantamount to a jewish blood libel
it is also ignorant, like picking a random african country and suggesting it represents all black people
Comment by nerfyink 1 day ago
This guy is responding to an innocent post about a product with accusations against it for being Israeli. Do you think it’s ok to make accusations against someone just because they are Israeli?
It might not technically be classical antisemitism, or implemented the same way, but is still bigotry of the same root.
Would you be ok with someone making accusations against anyone who is from an African country?
Comment by ImPostingOnHN 1 day ago
Yes, just like conflating me and my judaism with israel's actions is targeting me for being jewish and attacking me.
> Would you be ok with someone making accusations against anyone who is from an African country?
Would you be ok with someone making accusations against anyone who is jewish? Because that is what is happening here, just like making accusations against someone for being black.
Maybe you're upset because someone else said something else, but that doesn't excuse the post I responded to, which attempted to conflate all jews with israel, and in so doing, ascribed horrific torture, killing, and crimes against humanity to all jews. That's literally a blood libel. "We" didn't do that. All jews/semites did not do that. israel did. Don't use us jews as human shields against criticism of israel, please.
Comment by nerfyink 1 day ago
OP: look at this cool product I made.
leopoldcongo: This is an African product, you can’t trust them.
Dan_Elkis: Racism is not cool anymore.
You: African != black. As a black person, I'll thank you for not conflating the two again, because claiming all blacks are African is tantamount to racism.
You see what’s happening here? You are ascribing horrific accusations against every Israeli for being Israeli.
Saying it’s ok to do this for only one group in the world, that happens to be Jewish is antisemitism. You don’t have to include every Jew in your accusations to be an antisemite. The Nazis had Kapos too.
Comment by ImPostingOnHN 1 day ago
> African != black. As a black person, I'll thank you for not conflating the two again, because claiming all blacks are African is tantamount to racism.
Yes, precisely. You are getting it. African != black, just like israeli != jewish. Claiming all blacks are African is indeed bigoted, just like claiming all jews are israeli (as happens when someone claims a criticism strictly of israel is "anti-semetic). Don't make either conflation, it is ignorant and disrespectful.
Comment by nerfyink 1 day ago
That is not what it did.
If the Jews of Italy are accused of being baby-killers, and the Jews of France say we are not baby-killers, the accusation against the Italian Jews is still antisemitism, and it’s not antisemitic to call it antisemitism.
Comment by ImPostingOnHN 8 hours ago
> That is not what it did.
That is precisely what it did, and what all "antisemitism" dismissals of criticism towards israel do. Judaism literally did not enter the conversation until the criticism of israel (not judaism) was dismissed as "antisemitism". israel != semitism. israel != judaism (indeed, their actions violate the basic tenets of judaism).
If defenders of israel lump all jews in with israel's child-killing, just for being jewish, that is a blood libel. israel is doing that because it is led by monsters, not because it is led by jews. Sincerely, a jew.
Comment by nerfyink 6 hours ago
This was not “criticism of israel”, it was attacking someone just because they are Israeli.
“Israelis” == Jews of the Levant. Saying “Israelis are baby killers” is antisemitic, and you, my friend, are being antisemitic.
And if you are actually Jewish, they will come for you too, eventually.
Comment by Skwid 2 days ago
Comment by IAmRinSlow 3 days ago
Comment by laginimaineb 3 days ago
It's really unlike a compiler. For example, for a function like 'sort', the optimisation can:
- Use quicksort if the data distribution is generic.
- Use insertion sort if the data is nearly sorted
And so on... As long as these can be proven sound, Maxwell can pick the best optimisation in real time.
Comment by ch_sm 2 days ago
Comment by MilkingCowboy49 2 days ago
Comment by ben_mussay 3 days ago
Comment by 1Ecz3 2 days ago