r/MachineLearning • u/jackyuanybt • 2d ago
Project Three LLMs hand-wrote every weight of a chess neural net with zero training. Best reached ~3,000 Elo [P]
https://x.com/JackYuan35/status/2127094713996247069?s=20
I gave Claude, GPT and Gemini one rule: build a chess engine whose position evaluation is a neural network, but no training, no fitting, no auto-tuning. They had to write every weight themselves, as code, then play test games and iterate. Search code was unrestricted; an auditor zeroes/perturbs the weight tensors to make sure the net actually does the evaluating.
Final results (400 games, held-out openings, vs a Stockfish ladder at 10+0.1):
- Gemini: 2,962 [2,936, 2,990]
- Claude: 2,882 [2,855, 2,908]
- GPT: 2,608 [2,577, 2,641]
For context, the same models playing chess directly rate ~1,800–2,200 on the LLM Chess Benchmark. So each built an engine far stronger than itself.
Things I found interesting:
- Each picked a different design: Gemini a 2.9M-weight deep net, Claude a sparse net of named chess concepts (it has a "passed pawn" neuron), GPT a tiny 13k net with a strong search.
- With the same tiny 13k-weight net and the same fixed search, all three hand-written nets beat our own gradient-trained version of that net.
- Without search, the nets play ~1,150. The search matters a lot (they wrote that too).
- Claude was disqualified 14 times for slipping classical eval code in. Once it argued its if-statements were "an unmaterialized 4.5M-connection ReLU circuit."
Everything is open: code, weights, every audit and transcript. Each net regenerates bit-for-bit from the model's own code, and the sandboxes had no internet.
Edit: "zero training" = no gradient descent, no data fitting, no automated parameter search. The models did iterate on test-game results, and that's the whole point of LLMs writing modle weights. Zero gradients, not zero feedback
Code: github.com/JackYBT/zero-gradient-chess
Report: bitianyuan.com/writing/zero-gradient-chess
Play it: lichess.org/@/ZeroGradient
341
u/PoorAnalysis 2d ago edited 2d ago
I opened the weights files and they are mostly zeros with some repeating values like 255 or -64. The histograms, used to verify the weights aren't simply downloaded, confirm the LLM generated weights are nothing like you would expect in a neural network.
I don't really understand what is happening, but given you can implement all boolean logic in perceptions, I'm going to throw out a total guess that this is just a decision tree masquerading as a neural network.
Of course you could argue that still is a NN, and fair, but I don't see how the "no training, no fitting, no auto-tuning" claim holds up if the loop was "play test games and iterate". That is training, sure it's not back-propagation, but there are plenty of other ML algos, for example again: decision trees.
EDIT after 6 hours musing on another interpretation on "training" in the context of this project:
Initially I was viewing "play test games and iterate" as an LLM take on supervised learning. Therefore, there is training happening, just not a form of gradient decent, and OPs constant focus on "no gradient descent, no fitting, no automated tuning", etc is at best missing the point, at worst outright deceptive.
However, if you interpret "play test games and iterate" as equivalent to a human coder trying to write up some complex algorithm and having to iterate to fix typos, off by one errors, etc. Then one could argue there truly is no training happening. The only problem with that interpretation is it makes this whole thing even less interesting because it was never a learning problem, it was a transformation task for the LLMs: take a problem they already know how to solve (because their training data is full of examples of chess engines) and implement it in a perceptron net.
It is still very impressive LLMs can do the transformation, but again you have to question OPs focus on gradient descent when that's a learning algorithm, but this wasn't a learning task.
26
u/vokshumana 2d ago
Before getting too excited, I'd make sure that the network actually does something meaningful. You can reach a high elo with search only, and on the other hand good neural chess bots are > 2500 elo without search.
50
u/Fragore 2d ago
Write the weights, test then iterate IS training. Akin to evolution algoritms. But is training nonetheless.
19
u/public_hedgehog_3917 2d ago
How are they doing this?
2
u/KapteeniJ 2d ago
To get a sense on how impressive this is, should've taken some humans with basic understanding about chess and how to do linear algebra, and let them iterate on this task for a bit too. How strong would their network be?
I'm surprised that they required such a large networks too, but I guess it depends largely on, how much classical logic you want to do inside the network.
10
u/HansDelbrook 2d ago
I've been hesitant to give the conversation around LLMs being able to "hand-write" functional nets much weight - is it not expected that a large amount of material related to these tasks would be present in training corpora? Why is the narrative "it wrote this by hand" not "its parroting a version of the problem its seen before"? This is akin to the ability for an LLM to spit out the entirety of Harry Potter, which has been within the realm of reasonable tasks for years.
In other words - we're automatically applying this super-powered reasoning lens to a task that could feasibly be accomplished by parroting - and it may be super-powered reasoning yet, but none of the tasks I've seen (Chess, RL-gym games like Cartpole) rule out the possibility of parroting.
129
u/brainExploded99 2d ago
lmao I've always noticed claude models are the best at pretending they are aligned, when they are not. People need to be careful of claude models, esp with the recent news of it being of very questionable quality on ML tasks.
3
u/davidswelt 2d ago
Nice.
Please publish the source code, and have your paper peer-reviewed properly at a top conference.
Extraordinary claims require extraordinary evidence!
2
u/thezachlandes 2d ago
Now try taking a SoTa OSS chess neural net, which was trained via gradient descent, and see if weight space programming can improve it’s performance on an unbiased test set
1
u/No_Inspection4415 2d ago
I am honestly shocked. Holy f... I also tend to think the ELO is much lower (if you eval against stockfish or so, you are missing what NE is and how it's defined, try humans like Magnus) but I need to actually read what you wrote.
Super cool and impressive.
1
u/Deto 2d ago
Really interesting!
What's the search mean here? Do they propose a set potential of next moves and then the net scores them?
Is it possible they are finding pre-fit nets online and using those?
For your gradient trained version, does it use the same search module?
4
u/MironV 2d ago edited 2d ago
This is cool! As someone who also recently wrote a neural network for chess, the thing to be cautious of in your results is search.
The massive rating likely comes from using an unconstrained search against a throttled Stockfish ladder. When you use UCI_LimitStrength to lower Stockfish's Elo, it doesn't play like a natural weaker engine but instead intentionally blunders to hit a target win rate. An unconstrained search easily spots and punishes those blunders.
I’d recommend you use a diverse pool of naturally weaker historical engines from the CCRL to establish the Elo or wait for Lichess.
1
u/NikEy 1d ago
Very cool project my man!
1
u/leothelion634 1d ago
Now do Advance Wars