Top
Best
New

Posted by bjin 3 days ago

GPT-6.2 Astra is the first model to beat Googlers' code golf records(bjin.github.io)
Back in 2015, when I was still at Google, there was a small group of code-golf enthusiasts spending hours trying to save just one byte on their solutions for weekly code-golf problems. No matter how hard you tried, there always seemed to be another Googler who found a shorter solution. And once a problem entered the challenge phase and every solution became public, it was always astonishing to read how brilliant other people's solutions were.

11 years later, LLMs are evolving fast. A recent OpenAI post ("Perplexity and Intelligence", https://openai.com/index/perplexity-and-intelligence/) described researchers watching a model solve open math problems one after another in a Slack thread. I started to wonder: how would frontier models compete with the records that a small group of brilliant minds created with hours of effort each week?

So I built this benchmark. Frontier models do find a lot of new approaches (and very brilliant ones) to solve these problems. For example, in two problems ("Surviving Queens" and "The Rolling Dice"), frontier models use complex numbers to solve them in Python and Ruby (both languages have built-in complex number support). And for the "(-5)-Smooth Numbers" problem, where you have to write code to list the first n positive integers of the form (-2)^x⋅(-3)^y⋅(-5)^z, most solutions build them with nested loops or by growing a set, then sort. GPT-6.2 Astra gets them all from powers of 4, and earns a sole best with this brilliant solution:

    g=lambda n:sorted(4**i%(2**999-5)%(2**49-3)for i in range(7000))[:n]
There is a dedicated section for this: https://bjin.github.io/go-codegolf-benchmark/#why/finding-a-...

It's nice to see GPT-6.2 Astra become the first frontier model to beat the human records in code golfing. Along with other frontier models, it finds a lot of interesting solutions that Googlers back in 2015 didn't. On the other hand, I also believe code golfing can be a good benchmark (not a comprehensive one, of course) for frontier models.

Code golfing rewards thinking differently, because a shorter solution usually comes from looking at the problem from a different angle. It also rewards running experiments, not just thinking: writing a search program to find a shorter expression, or exploring lesser-known features and functions in the target compiler, interpreter, or library. Human code golfers do this a lot, and no public training data tells a frontier model how to do so.

261 points | 78 commentspage 2
nukanse 3 hours ago|
Code golf is useless. It could be useful if it were about length of the generated assembly, but it's only about the code, which means is unreadable and unmaintainable.

Instead small assembler has utility because it uses less cache.

On other side, speed golf is the best thing.

swatcoder 3 hours ago||
For things that learn (humans, AI's-while-training), it's a useful exercise.

And things that play (humans), it's a useful diversion.

The sport gives you an incentive to learn a language, library, or algorithm more deeply and to discover new ways to think about how they work. It's very useful.

lg5689 2 hours ago|||
It's a purely recreational activity. But there's a surprising amount of depth to it--the skill ceiling is extremely high and it's not uncommon for thought-to-be optimal solutions to be beaten years later. There's lots of crazy math and algorithm tricks you will never see in conventional programming. Getting good at code golf requires mastering not only the language, but lots of math and algorithmic skills as well.

Part of the fun is also doing things you're not supposed to do. Not only does it become unreadable, but you often are abusing dark corners of the language and implementation.

lifthrasiir 3 hours ago|||
Speed golfing also often makes code unreadable and unmaintainable to some degrees. Everything is a trade-off.
jcims 2 hours ago|||
Very first (and last) coding competition I entered was in ~1991. It was on a local BBS and the challenge was to find all primes from 0-1000. Four scoring metrics were correctness, code size, size of executable and speed of solving.

I took that opportunity to learn a bit of assembly. I’m guessing it was 100 lines of code, COM size was ~100 bytes and it could do the whole test in less than 100ms. I got second place to a turbo pascal entry that had a much larger binary, took 5-10 seconds but it was maybe ten lines of very readable code.

Made me realize that folks really value readability (and to ask how metrics are weighted )

zachgolf 37 minutes ago||
Kind of funny how Zach Barth, while designing engineering games, noticed this distinction between speed, size and time and just made each of the three separate leaderboards in all of his games. But actual serious engineers making "more" serious playthings seemingly couldn't figure it out.

e: Autocorrect did the worst thing you could do to Barth's name.

nukanse 3 hours ago|||
But it's justified. Efficiency on key parts of the code, of course. Not on the entire code base.

You can mitigate the unreadability in many ways. For example c++ allows to generate magic numbers using constexpress, where the code itself is clear and human readable.

You can create a loop to calculate a lookup table and store it into a small number of uint64. The code shows what the magic numbers mean, and can be debugged.

lifthrasiir 3 hours ago||
The reduction of code size in general is called an abstraction. So it is also justified as long as it is not taken to the extreme.
nukanse 2 hours ago||
Top code golf just uses languages where the characters are compressed, and the notation is abused. So the winners read like hfE#^gg
lg5689 2 hours ago||
"Winners" depends on the where you're competing. Many places include langauge-specific leaderboards, so your Python is not competeing against my GolfScript.

Incidentally, in my experience, the strongest human competition usually is in Python.

fishtoaster 3 hours ago|||
It's about as useless as regular golf. The point is not to be useful, but as a fun competition and a demonstration of a niche skill.
nukanse 3 hours ago||
But they should had focused the ai into beating speed golf instead of code golf.
daymanstep 3 hours ago|||
What is speed golf?
nukanse 3 hours ago||
Speed golf is the fastest code. Stack Exchange has a site where speed golf is fused with code golf.
asdf24211 2 hours ago||
Why not make the oracle solutions public? I'd be interested in seeing some of those
ogogmad 3 hours ago||
Some interesting strides have been made here thanks to GPT 6.2: https://wiki.bbchallenge.org/wiki/Logical_independence

Thanks to some expert code golfing, we know that:

  - Peano Arithmetic cannot be used to find the 173rd Busy Beaver number.
      That's -50 from a month ago.
  - Mac Lane cannot be used to find the 173rd Busy Beaver number.
  - ZC cannot be used to find the 182nd Busy Beaver Number.
      That's -43 from a month ago.
  - ZFC cannot be used to find the 192nd Busy Beaver number.
      That's -33 from a month ago.
  - ZFC + inaccessible cardinals cannot be used to find the 197th Busy Beaver number.
      That's 100s less than a month ago.
zahlman 31 minutes ago|
Does this imply that, not only is the general Halting Problem unsolvable, but it becomes unsolvable even for fairly small inputs?
drnick1 3 hours ago||
Disappointingly, all the restrictions means OpenAI models are increasingly refusing RE tasks. So all that intelligence is kind of wasted.
refactor_master 1 hour ago|
You could also, I don't know, build something new?
IshKebab 5 hours ago||
I have thought about doing this but really the Kitty image protocol is just too inefficient for general purpose GUIs over the network.
rspeele 5 hours ago||
Astra also code golfs its contributions to my regular codebase so this is totally on-brand.
zergrush 3 hours ago||
on a tangent note i find gpt 6.2 astra to be complete let down on top of the fact that they are now merging chatgpt usage with codex which will lead to even reduced usage for the $200/month plans

still gpt has its core value but its clear that OpenAI is moving away from the prosumer subs and towards profitability, I expect more generosity to be cut and all of this would be fine and dandy if OpenAI had anything that could seriously compete with Opus 5.5, it still falls behind unless your work is in science or math.

oh_no 3 hours ago|
they doubled the combined total compared to the prior amount on codex, and i can't see how you could use chat nearly as much as codex without trying to do a bunch of code-related tasks in it for a ton of manual overhead.

pretty sure it's a far better deal now than before

zergrush 3 hours ago||
usage has been down across the board and its no longer competitive
dayone1 3 hours ago||
Why run a rigged benchmark? You run astra on max but many of the popular Claude models you only run at xhigh
bjin 2 hours ago|
Claude models with max thinking effort simply scores less in code golfing than xhigh. And it's not unique to this Benchmark. In Both FrontierCode 2.0 and Coding Agent Index v2.1 (Claude Code harness), Claude Fable 5.2 with xhigh thinking effort scores more than max thinking effort.

I have wrote a dedicated section about this: https://bjin.github.io/go-codegolf-benchmark/#about/thinking...

rpq 2 hours ago|
Data just doesn’t have a body yet, don’t fret.
More comments...