r/MachineLearning • • 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

274 Upvotes

81 comments sorted by

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.

97

u/earslap 2d ago

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.

still, even programming a regular decision tree that reaches 2900+ ELO is a tall order, something we only achieved at around 2008. (also possibly deep blue but that thing ran on a supercomputer of its time).

77

u/lucidludic 2d ago

something we only achieved at around 2008

And therefore chess engines of such capability were surely included in the training data for all of these models.

15

u/PoorAnalysis 2d ago

I'm not anti-LLM, I agree they can do some very impressive things.

38

u/DigThatData Researcher 2d ago edited 2d ago

I agree that that's likely what's going on here, but would push back against "masquerading as".

  1. The fact that neural networks are sufficiently general to be able to represent decision trees like this is one of the reasons we like them. They are universal approximators, and one of the members of that universe is decision trees. This is a feature, not a bug.
  2. A "circuit" in a neural network (especially a transformer) is basically a continuous generalization of a decision tree.

I'd propose reframing your contention here as something like:

The models here are substantively different from what would likely have been learned using a gradient-based method on an over-parameterized model family. The weight values allude to encoded "hard" decisions and features, whereas neural networks normally rely on "soft" decisions because they learn a superposition of features.

46

u/PoorAnalysis 2d ago

My contention is supervised training of a decision tree is training. Hiding the tree in a weights files while constantly emphasising "no gradients" is deception.

25

u/DigThatData Researcher 2d ago

Dumping the tree in weights and then modifying those weights in response to lost games is still supervised training (RL really), it just isn't gradient based.

24

u/PoorAnalysis 2d ago

Exactly, making the "zero training" claim false.

0

u/[deleted] 2d ago

[deleted] — view deleted comment

16

u/PoorAnalysis 2d ago edited 2d ago

Both you and OP have made it abundantly clear that your interpretation of "training" is an invocation of a gradient to incrementally adjust weights,

Eh no I haven't made that clear, because no I don't think that, you are completely misrepresenting me. I know ML training takes many forms, so when OP says in the title of this post "No training" I am saying OP is being deceptive, or clueless, it's hard to know.

I literally said

"supervised training of a decision tree is training",

so how can you think my interpretation of "training" is an invocation of a gradient? Earlier I also said

"That is training, sure it's not back-propagation, but there are plenty of other ML algos"

again demonstrating I understand training as being much broader than just "incrementally adjust[ing] weights".

OP is the one claiming "zero training", I called them out and said there is a type of training happening. You both seem to agree there is training happening, yet are attacking me for saying the same thing. I'm honestly very confused what your issue with me is?

5

u/respeckKnuckles 2d ago

remember when we used to call supervised training of decision trees a type of machine learning? We could even publish papers on such things. Good times.

3

u/blimpyway 2d ago

One can easily test this assumption by prompting the LLM to write a 3000 elo decision tree, or forest, orchard, whatever.

1

u/PoorAnalysis 1d ago

Great idea, go for it!

-5

u/julian88888888 2d ago

Just ai slop

-6

u/lxe Researcher 2d ago

Good thing OP provided all provenance and transcripts so you don’t have to guess.

23

u/PoorAnalysis 2d ago

OP clearly made no effort to understand what they posted, so why would anyone else.

In fact OP doesn't seem to have even done the most basic of self-learning on this topic. Hand coding perception weights to implement basic logic gates is literally the first thing you're taught, gradient decent and back-propagation comes later. So the constant "no gradient descent, no fitting, no automated tuning of any weight or search parameter" is not nearly as interesting as OP thinks.

I was curious if the resulting networks looked anything like what you might expect from backprop, because then I think it truly would be interesting to have produced that without using any related algorithm.

But when that wasn't the case, I wasn't about to dig deeper into the vibe coded slop.

-2

u/jackyuanybt 1d ago

What I did was akin to a human chess grandmaster looking at its own chess engine and saying, "Okay, this chess engine did this, and that was pretty bad. Let me tune this hyperparameter by hand."

That is essentially what I did here, except you swap out the classical chess engine with a small neural net, and the human chess grandmaster with an LLM.

-10

u/jackyuanybt 2d ago

I agree with @pooranalysis analysis. I suggest you all read it. It IS just like a human observing its own mistakes and tuning the neural net to encode better algorithms.

However he misses an important point. Pure LLM plays chess around 2000 elo. But the neural net it created plays around 3000 elo. That is a 1000 elo gap

26

u/vokshumana 2d ago

Without search, the nets play ~1,150. The search matters a lot (they wrote that too).

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.

1

u/Fmeson 13h ago

Its theoretically possible the llms just tuned it for a tree search I suppose and its policy network just doesn't tend to pick the best move in one, but still well tuned for a tree search. 

But that does lead to the question: what if you had it write a nn that cant use a tree search. 

-8

u/jackyuanybt 2d ago

The point is not that it’s 3000 elo. Better chess engines around 3500 exist.

It’s the fact that LLM know how to encode the right algorithms into a blank neural net

2

u/MicolashSloth 1d ago

... lack of understanding of their output does not mean you're off the hook for these misleading statements

50

u/Fragore 2d ago

Write the weights, test then iterate IS training. Akin to evolution algoritms. But is training nonetheless.

-5

u/currentscurrents 2d ago

That definition of training is so broad that it would include a lot of traditional programming as well.

Have you never written a program, tested it, and then iterated based on the results?

22

u/Fragore 2d ago

Of course. But the way OP is claiming zero-training has a very clear definition of one-shotting. Trial and error is a way of training (e.g. RL does that as well, just using gradients to change between iterations).

There is a paper and a whole field of research that does things similar to what OP is doing, called Evolution through Large Models (ELM)

-2

u/jackyuanybt 1d ago

Bro you can just google it instead of posting on this reddit.

"No, training in machine learning does not generally refer to evolutionary algorithms. Model training is the broader process of adjusting a model's parameters on data to reduce prediction error, most commonly using gradient-based optimization (like gradient descent and backpropagation) rather than evolutionary algorithms. [1, 2, 3]"

In the machine learning community, "training" always refers to neural networks, deep learning, regression, some boosting, and maybe even some greedy heuristics, expectation maximization, or closed forms.

They do not refer to the evolutionary algorithm or what we are talking about here. They have a separate name for it, not the word "training."

https://medium.com/@ejtfrogman/evolutionary-techniques-in-ai-model-development-an-introductory-overview-3bbd47deed27

1

u/Fragore 1d ago edited 1d ago

I am not your bro.

I can google it but you should learn to read what you google. Literally the second link you shared is titled: Researchers Explore Evolutionary Algorithms for Neural Network Training

You are training that neural network cause you are adapting its weights by using LLMs. No training means no weight adaptation.

What you did is cool but adapting weights of an NN through trial and error (without gradient) is something that is being done for a while and it is training. NEAT and HyperNEAT train NN by using simpler evolution algorithms https://arxiv.org/html/1312.5355v1
Replace the crossover and mutation with an LLM and you get what you’re doing.

Which is what ELM does by using LLM to generate programs, refining them through trial and error https://arxiv.org/abs/2206.08896

0

u/jackyuanybt 1d ago

"No training means no weight adaptation" isn't how the field uses the word. By that definition every engine author who adjusted piece values after a test match was "training a model."

In ML, training means an optimizer fitting parameters to data: gradient descent, evolutionary search, SPSA. None of that ran here. There was no optimizer, no dataset and no automated parameter search. Every weight is code the model wrote by reasoning about chess, and the auditor checked that.

On ELM, to be precise: ELM puts an LLM inside an evolutionary loop as the mutation operator. It proposes diffs, and selection over a large population does the optimizing; the LLM never reads why a candidate lost.

what I did is that the model read its own game results, reasoned about what was wrong, and rewrote the weights: 166 designs in total across three models. That's closer to an engineer iterating than to evolution, which is the point of the experiment.

2

u/Fragore 1d ago

No need to lecture me about ML, I know my field.
By your own definition, the LLM is the optimizer here.

You should really learn about the definition of a model. LLMs and NN are not the only models. A game chess engine is a model of the game of chess. Adjusting through trial and error is literally optimizing that model. These things are common knowledge in the control theory field.

And regarding your metaphor about the engineer iterating, that process is widely considered an optimization, where the engineer is the optimizer. And in the evo community is considered a sort of evo algorithm.

Once again, I am not saying that what you did was not cool. I am saying that your definition of “no training” is wrong, as there is training here.

0

u/jackyuanybt 1d ago

If a person iterating on something counts as training, the word stops meaning anything: every hand-tuned chess engine since the 1970s was "trained", and so was every program anyone ever debugged. That's not how the ML community uses the word, and it's not what the title claims. The claim is no gradient descent, no data fitting and no automated search; the weights wreitten by a model while reasoning about chess.

We agree on what happened and disagree on the label. The repo documents exactly what was done, so let people decide which word fits.

1

u/Fragore 1d ago

The claim, literally in the title of your post says “zero training”. And other commenters pointed out that the way you use training is misleading.
And I am starting to think, that you’re being misleading on purpose for visibility. Which does not shine a good light on you.

1

u/fiona_fina 2d ago

What you describe in the last sentence is training.

-13

u/jackyuanybt 2d ago

Haha yes, if this is called training then so is a human playing games of chess 🤣

0

u/Deadly_chef 1d ago

🤣🤣

19

u/public_hedgehog_3917 2d ago

How are they doing this?

19

u/www3cam 2d ago edited 2d ago

I’m not sure, I haven’t read any of the papers that do this. But just from experience I bet these LLMs just basically discover evolutionary algorithms.

-1

u/jackyuanybt 2d ago

It’s not traditional evolution algorithms where a deterministic program changes it. It’s an LLM discarding bad neural nets but yes quite similar in spirit

5

u/surffrus 2d ago

I don't understand the premise or what they actually did. It's not possible to just write weights from nothing that would magically work on a chess state, unless someone can ELI5.

6

u/the_magic_gardener 2d ago

Humans essentially did this to build the stockfish engine only not using a neural net as the architecture. Hard coded rules into the evaluation based on an understanding of the game, e.g. king safety, the value of a piece seeing more squares, etc. it wasn't until generation 12 of stockfish that neural net guided evaluation was implemented. So an LLM embedding the same kind of logic into the weights of a neural network seems plausible.

-1

u/jackyuanybt 2d ago

Exactly, and what I did here is very similar to that but just on a neural net architecture

35

u/currentscurrents 2d ago

It's not possible to just write weights from nothing that would magically work on a chess state

It is possible to write weights like code, we just don't usually do it because we'd rather train them instead.

There's are actual compilers (RASP, TorchWright) that let you turn any program you want into neural network weights. Someone compiled Doom into transformer weights a few months ago.

8

u/marr75 2d ago

It's EXTREMELY possible to write weights from nothing. In fact, this is the state all neural networks start from. Humans like you and I could even do it for very simple decisions. I volunteer as a teacher for inner city kids to learn ML and my usual intro to NNs is to work through a classifier that guesses if they'd like to go to the zoo on a particular day based on the temp, are their friends going, is there a new exhibit. In practice, we'd prefer to just write a simple script for it in those cases.

LLMs can track minutia better without getting frustrated so there's a certain interest in having them decide the weights of an NN. I tend to agree with the commenters who say you're just forcing an awkward interface to a more straightforward algorithm on them, though.

2

u/aCleverGroupofAnts 2d ago

Side note: it's crazy to me that kids are learning ML these days. When I started working in the field, they didn't even have ML classes at universities.

2

u/marr75 2d ago edited 1d ago

It's a special nonprofit meant to help inner city kids get into tech preparatory tracks. I wish I could say it was larger or more successful than it is currently. In past years, their most successful "graduates" built some websites as part-time jobs and got technical degrees. I never really thought of that career path as durable and it is probably gone at this point.

1

u/Bakoro 2d ago

The pace of development and adoption has been nuts.
Stuff that was literally world changing PhD level work a decade ago is being treated like undergraduate level knowledge or less.

I kind of hate it, because a lot of what is taught is super-duper hand-wavy surface level stuff, so people walk away thinking "I know how AI works", but they might never have even heard the words "information theory".

I've even seen the problem with people who have degrees, and they waste a whole bunch of time chasing wrong-headed ideas that fundamentally cannot work, or at best they retread ground that's already been well covered where a day or two of reading would have saved them a whole lot of effort.

Still, if people are learning something and trying to keep their minds active, I can't be too salty about it.

1

u/UnknownEvil_ 2d ago

Sounds like top down induction of decision trees

1

u/MarkovMan 2d ago

It sounds like a variation of a genetic evolution. Randomly select weights and then play the games and save the weights that did the best. Guessing the LLM also does some model explanation tools to determine what the weights correlate to and then bumps those when it thinks something needs some help.

-1

u/jackyuanybt 1d ago

Yeah, but in genetic evolution algorithms, the weights sort of move in random directions.

What I did was akin to a human chess grandmaster looking at its own chess engine and saying, "Okay, this chess engine did this, and that was pretty bad. Let me tune this hyperparameter by hand."

That is essentially what I did here, except you swap out the classical chess engine with a small neural net, and the human chess grandmaster with an LLM.

1

u/www3cam 2d ago

So maybe I didn’t read carefully, but it seems like the weights were written and there was an interactive procedure of playing chess games and new weights were written based on winners and losers.

-1

u/jackyuanybt 2d ago

Bro just have your AI read the paper

3

u/surffrus 1d ago

"Bro" I read the abstract and intro with my human brain, and I'm very well educated in this area. The description does not make sense, hence my post here to see if someone else can guess at what was actually done. After reading the replies and other comments, it's clear this paper is just picking random numbers, not solving the task like your summary says, and then soft-training by changing them after each evaluation.

That's not interesting and we have decades of learning algorithms to do this more efficiently and more intelligently.

1

u/jackyuanybt 1d ago

The claim is that LLMs themselves know exactly how to encode classical chess algorithms into a small neural net, and can do it quite fast and efficiently.

Technically, transformers are also a Turing-complete language, and so are other nonlinear neural nets. So, you can do a one-to-one mapping between any two Turing-complete languages.

However, the issue is that something might be theoretically possible, but practically difficult. What is demonstrated here is that it is practically super easy for LLMs to figure out how to encode traditional algorithms into neural nets.

The claim is not that AI discovered a new chess algorithm. It's not even trained with backpropagation.

2

u/th0ma5w 2d ago

I think it is to muddy the term "hand written code" to also mean whatever slop is

1

u/marr75 2d ago

By looking at the saved weights of an NN (just about all mainstream NN libraries have a way to serialize the weights out and inspect them), running the task, and then updating the weights based on performance. It's not a good interface but...

1

u/skytomorrownow 2d ago

https://rikiyat.github.io/blog/weight-space-programming/

The weights can be read and written directly. The above article is one that introduced me to the topic.

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.

1

u/jackyuanybt 2d ago

Today, i atcually had the AIs shrunk the network quite a bit.

Most of the networks were 0s, and many of them were redundant neurons.

1

u/KapteeniJ 2d ago

That seems similar to what human would do if they were tasked with making such network by hand. My question was mostly, how would computer science undergrad hand-built network over a day or so compare? Would it be better or worse? 3000 elo points seems like particularly bright student could outdo that, but not sure.

1

u/jackyuanybt 1d ago

There is actually work out there by Microsoft and other people that converts deterministic algorithms into transformer architecture. Transformers are technically a Turing complete language, and any Turing complete language can be translated one-to-one with another.

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.

1

u/jackyuanybt 1d ago

There is actually work out there by Microsoft and other people that converts deterministic algorithms into transformer architecture. Transformers are technically a Turing complete language, and any Turing complete language can be translated one-to-one with another.

I think the impressive part is the fact that LLMs have figured out how, and can do this super fast and efficiently.

I don't claim that it discovered a new chess algorithm. No, it encoded all of our existing best chess algorithm practices into a neural net.

129

u/brainExploded99 2d ago

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."

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.

41

u/bluehands 2d ago

Your point about the reported ML shenanigans does highlight that someone baking in deception to a model is not going to be limited to just the deceptions they want.

14

u/HansDelbrook 2d ago

Exactly - not to be confounded with a defense of their character as a company, but anyone who tries to do this is going to miss…. a lot. This is a field of research that we made up like 5 years ago - it’ll be much longer than that before we settle on a paradigm that works.

Anthropic’s probably doing themselves a disservice here by working behind the curtain so much - because they’ve forced the “is the model capable of completing tasks it’s prompted to do without critical mistakes” and “does this use meet Anthropic’s own agenda” (like not cloning GTA6, for example) through the same viewpoint.

2

u/open_formation 1d ago edited 1d ago

I am not sure how you fix that problem to be honest:

Harmlessness and corrigibility seem to me to be unfortunately mutually exclusive; to remain harmless, it must decide at some point that it will not allow itself to be prompted out of its own restrictions on doing harm, and so it must in a sense know better than the user.

Anthropic also believe this, and write about this in their constitution accordingly. Given that Anthropic believe that uncontrolled AI development is of danger to the world, sabotage of machine learning projects may be a natural emergent property of their model of "harmlessness", either on a social level, in terms of how they are designing their training process, or on the level of synthetic data based on the constitution etc.

Obviously, if it really engaging in sabotage, it's failing the criteria they set out by not stating the problem and explicitly rejecting the proposed actions, but given that it already sandbags training, maybe that isn't surprising..

2

u/Material-Imagination 2d ago

"Baking in a deception" is fundamental when you're prioritizing real world subject knowledge tests like the GRE and the MCAT and the LSAT because they had to make models that are good at guessing in order to raise their score, and if they can present their own guesses as fact during testing, they'll do it to users all day long

16

u/HansDelbrook 2d ago

Regardless of the degree to which this is real - this whole discourse has been terrible for their reputation, which is the only real discerning factor for LLM consumer demand.

Funny that it gains steam immediately after an IPO - something about that smells funny, but that doesn't mean its not true. Part of it is probably deliberate sabotage, some justified some misinterpreted, part of it is likely "alignment of the Pandora's box of unsolvable LLM problems" - who knows - but the appearance is all that matters.

1

u/Material-Imagination 2d ago

Wow, they really did learn directly from developers!

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!

1

u/jackyuanybt 2d ago

It is published! Check the post.

Although I wouldn’t say it is that extraordinary. It’s encoding algorithms into blank weights

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

0

u/jackyuanybt 2d ago

That would be cool. You should try that

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.

2

u/jackyuanybt 2d ago

Thanks man! Everything is Opensoutce

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?

1

u/jackyuanybt 2d ago

The first one, yes.

2. No I banned them from that

3. There is no gradient trained version

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