#fide-google-efficiency-chess-ai-challenge
1 messages · Page 1 of 1 (latest)
Would anyone happen to know whether it's possible to pip install a package on the remote env?
At submission zone there is an option, packages, there you can write all pip install that needs to be installed, even internet off
this is an environment competition where you submit an agent as a .py file. Not sure this works.
Ups. True.
Actually "Create agents to play chess with resource constraints" doesn't mean frezze environment?
Hey everyone,
I am pretty new to AI/ML and wanna participate in this competition so can anyone guide me on:
- What should I learn to build a chess-playing AI?
- How to make it efficient?
- Any beginner-friendly resources to get started?
Thanks a lot!
Learn about the standard minimax (alphabeta pruning)
Just googling chess ai or searching on youtube for tutorial will get you some basic information
You can also search for TCEC 4K, which is a contest in a similar format (but even more restricted in file size)
you were right, I was able to find out more and posted more info here: https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/547244
Funny thing is that some packages require more than 5MB to be imported so it doesn't even matter that they're available
Note that you can also submit a submisstion.tar.gz with main.py in the top level directory
kaggle_submissions/
main.py
<other files>
You can run tar -czf submission.tar.gz -C kaggle_submissions . and upload submission.tar.gz
Does teaming up increases number of allowed submission per day?
Oh okay, thanks!
Can someone please explain this constraint further:
Constraints
- 5 MiB of RAM**
- Dedicated CPU: a single 2.20GHz core
- 64KiB compressed submission size limit
During the RAM allocation, I used psutil to monitor memory usage while running the script, but the basic package imports were too large.
Any suggestions would be appreciated.
We have python running with 5 MB of avalialbe RAM above the baseline. We then load your code and it has to load in 5 MB or less RAM
We also already have Chessnut imported
Need clarification on timing as I don't play with clock. Is 10s the total time for all your moves in a game? And does .1s delay mean you get a "free" .1s per move?
correct
Okay, thanks.
the restriction here being that main.py has to have a specific signature?
@languid barn Thank you for taking the time to help out here and in the discussion forum btw
It just needs to have "def chess_bot(obs):" as the last function. It doesn't even need to be named main.py if you're uploading 1 file. Take a look at this or other examples in Code tab. https://www.kaggle.com/code/vyacheslavbolotin/chess-bot-starter-step-0-0-0-1
thank you! 
On "already have Chessnut imported", does that means that memory used for Chessnut eats into the 5MB or no?
mh I have the feeling the agent logs are sometimes not able to capture what has gone wrong.. im having some issues with a submission and the json log is an invalid json and just
[
well not the feeling, it is this way
No, we account for Chessnut in the baseline
Yeah if the agent OOMs the logs die, you can tell if it died because remainingOverTime would be around -10s
meh, i shouldnt technically oom according to my calculations but I will check thanks
btw is there a formal answer to this?
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/547225
what if I include the source code of a free and open source library licensed under MIT/GPL/etc ..., is that fine?
Checking with folks on this
how often will the program be restarted?
is it,
- every game
- every turn
- never at all
Hey everyone! New here and still figuring things out. I put together my first bot, and after a few games, it managed to hit rank 7, but I’ve noticed some teething issues as it went down the ladder. I’d love to connect with others—pros or newcomers alike—to collaborate, share ideas, and learn from each other
Does the CPU support avx2?
probably, pretty much any datacenter cpu should have avx2 nowadays unless it is arm
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/547146
hello everyone!
i have a general question, how is the evaluation done?
i mean my code should produce a pgn/fen for every move?
how is the piece movement evaluated ?
i am trying to understand what the output my code should be for every move
thanks in advance
https://www.kaggle.com/code/bovard/your-first-chess-bot
you return the bestmove ?
hm okay, i see, i meant in what format, seems helpful, thank you very much!
uci format, "e2e4", "e7e8q" etc
Out of curiosity, was the choice of using Chessnut instead of python-chess random? Or was there a specific reason? (e.g. RAM?)
Yes you can use stockfish. As a winner you have to select an open source license for your submission (one of which can be GPLv3). If you use stockfish you have to license as GPLv3, which is acceptable
I feel like this might ruin the point of the competition? This just turns the competition into who can modify stockfish the least to fit the memory constraints
It's no longer about ML and more about pure optimization
We definitely don't want it to be a stockfish comp. The 64 KiB submission limit along with the 5MB RAM limit guard against this.
Stockfish has many components:
- tree search (cpp files)
- nnue evaluator (10.5 million params)
- opening books
- position evaluation cache
- end game solvers
any of these pieces are larger than 64 KiB and many are so large they won't fit at all. In addition none of these pieces are designed to fit in 5 MB RAM.
I am somewhat very new, maybe its a stupid question, can RL algos run under the given constraints?
- You can just simply compile the binary. Afaik @neat sapphire already got it down to low 70KiB.
- Cutdown HCE from last stockfish with HCE will do. (Stockfish classical is still 3600 CCRL engine. Good luck beating that)
- Not part of stockfish
- Transposition Table as its called can be made really really small very easily
- Those are called tablebases. They are not part of stockfish either xD
Some are but are purely optional and can be worked around.
The 5MB limit is truly enough for cutdown stockfish xD
If you dont want it to become stockfish competition or clone competition as a whole. I recommend simply banning cutting down an existing engine or using code from existing engines. Let the developers be actually creative.
it's not very hard to remove parts of the code that takes up memory, saying this as a sf developer
If you dont want it to become stockfish competition or clone competition as a whole. I recommend simply banning cutting down an existing engine or using code from existing engines. Let the developers be actually creative.
which requires extra validation during the competition to not allow such entries
Thats their problem. Not mine. People will cheat. Its their job as stuff to not allow that...
It's not a significant issue. A custom solution will always beat a hacked together one. There is plenty of time (3 months)
I kinda disagree. You can SPSA tune the hacked code stockfish for this.
I don't think the winning engines will even be HCE. You should wait to see what people are capable of instead of being immediately dismissive
It wont be. I know what you mean exactly 😉
We shall see but it doesnt hurt to be little more careful of this issue.
that's a good point about HCE, we will be watching the leaderboards to see what evlolves
bumping this
im still new to kaggle
can somebody walk me throught the whole submitting process
is it just an agent we submit or what
ah
so its legit just a raw agent
btw, how are yall managing with making sure ur bot knows what color it is
for specific piece instructions
im wondering if I should group both pieces from both sides into classes and code for that class itself
also
whats the deal with notebooks and jypter and stuff
i am still trying to figure out how it works lol
i THINK its supposed to be like some sort of frontend backend system??
as in there are files linked to specific cells
but i can't access them
the FEN encodes it
@languid barn In case of C binary. What are the libraries installed in the enviroment ? math.h and pthread.h are there ?
Why would you even need pthread ?
👀
Unless the one core actually means that we are allowed to use 2 threads in which case yeah
Our docker container is based off of the notebooks environment, so open a new notebook and take a look
how is remainingOverageTime calculated between turns? when I substract two remainingOverageTimes in the replay log, I'm using more time than the duration in my agent log
You should not be using average time at all
Your engine should be time managing from the left over time
The description says this time is “Total remaining banked time (seconds) that can be used in excess of per-step actTimeouts -- agent is disqualified with TIMEOUT status when this drops below 0.”
My understanding is that I can use the 0.1 second plus this value of time for my next move
It’s not the average time, it’s the obs.remainingOverageTime that is passed to the agent and also logged in the replay log
Yea. Its the remaining time. You cannot use all the time per 1 move...
Right. If I subtract two consecutive remaining time, I should get the duration I spent on a move. But the result I got doesn’t feel right
Is our agent only allowed to take the game as an argument or can we somehow pass the remaining time in the game?
your bot gets an observation which includes opponentRemainingOverageTime and remainingOverageTime
so you can just take the remainingOverageTime with obs.remainingOverageTime?
yes
thanks
also people are not allowed to clone stockfish and use it in the competition right?
Scroll up and read the chat
@languid barn
- Would it be possible if we somehow get information on what the "Err" was when games were played?
- We kinda need the move which the opponent played in the observation as well, otherwise it's annoying to figure out if a position will repeat itself and thuse be a 3 fold repetition. If we don't, we need to add "complex" logic to figure which move the enemy played.
This position is a mate, but got marked as a tie...
Also is anyone using a minimax algorithm or a trained model?
im using minimax but only for now
btw does anyone know if the top submission models are made on c wrapped to python?
We are able to create notebooks not on kaggle right? I was wanting to work on vscode
I am trying but am getting a unicodeDecodeError
yes just intall jupyter extesion ok vscode
almost certainly. i dont see any other way you could be competitive
but i dont knowww c 😭
Hey guys, does anyone know if we can actually upload compressed zip files with a main.py and additonal files as long as its under 64 KB? It seems to say we can but ive had no luck with it
you can upload tar.gz files. i dont think you can do zips.
Thanks!
Minimax with alpha-beta pruning should be best. See https://www.kaggle.com/code/shawnxxq/advanced-chess-engine-with-alpha-beta-pruning
new to kaggle, is it reasonable to assume that these environments won't significantly change?
can anybody tell me what format my code output should be in? like should it be a movelog notation? something like Ra7? or should it be like an FEN notation? or anything else
you should return a move like this e2e4 which is in the Coordinate Notation
More well known as UCI notation
ohhk thankss
Can we submit a bot that is coded in another langauage like c++
or do we have to wrap it in python?
Has to be through Python since it calls main.py
Yea
See it as an learning opportunity 🙂
There is much much more that is bugged.
We submitted a slower version of our Agent to make the 3470 agent go out. We then submitted the 3470 agent again... Its now 2600. Its literally the same EXACT file.
IDK how the scoring or whatever works. But its hella broken.
It needs time to get back to where it was. The scoring only works reliable if there are many agents evenly spread. Then it can get back to where it was quickly. If you are unlucky you run into an early tie because of missing threefold repetition
Which will reduce your progress
idk man the grader is just borked
the grader seems to be some kind of elo system. elo ratings are just relative to the population so as new bots get submitted elo of the existing bots will also change
also i suspect people resubmitting bots has some downward push on elo since their rating gets reset
The grader is borked. We submitted 2 identical agents. 1 is 100 score higher than the other.
thats not particularly surprising. most chess bots aren't deterministic. plus there will be some variation in the opponents that they go against. overtime their ratings will probably converge but theres bound to be a difference
@languid barn If i may suggest. PLEASE use an opening book. You need thousands upon thousands of openings to get a real sense of the engine elo. if you dont you will just repeat the same game over and over and over again as engines are deterministic. 1 opening is played twice. Each engine plays black and white. When we do engine development we use UHO lichess opening book. Thats standard basically across entire engine dev scene
Also figure out a better rating system. Its borked and not representive of the actual strength at ALL. 2 identical agents are more then 120score points apart now. That is SERIOUSLY BAD.
Engines ARE deteministic
Unless you screw something up
If your engine is non deterministic thats BAD.
if you put two engines against each other they won't play the same game over and over
from what we saw. There are 10 opening positions. I cannot even say how bad that is without using swear words
They will.
theres a lot of noise involved. sometimes the engine might get 1 depth deeper and change its move
Oh but you are using time
Deterministic means that with the same amount of nodes. they will say the same move
yes thats true. for the same nodes they will, but they wont always get to the same amount with iterative deepening
also 99% of the time even time doesnt matter. Since the speed doesnt change
We use so called bench when doing changes to engines. Thats required when using testing . Bench must 1B/1B times be the same when doing depth search
Time adds minor but 99% of the time insignificant variance
i think ratings take a lot longer to converge with the current system
e.g. rafbill's rating takes half a day to go down
i think there are more in their "private" list
but even then if it's not close to a thousand it's not good
UHO has what like 2M positions ?
What's UHO?
Opening book
https://www.sp-cc.de/uho_2024.htm specifically ones on this site
SPCC Computerchess
https://github.com/official-stockfish/books has some useful books for computer chess. the best of these is probably UHO_Lichess_4852_v1.epd with 2.6M positions
I’d like to participate in this competition, but I also want to learn the Julia programming language. I know that to submit this project, you need a main.py. Any workarounds to this?
run a compiled exe from the python script
not exe but a linux binary
are people using the chessnut library they give?
so would u make a c++ file, then a wrapper file, then a setup py file , and then finally execute your code in the main.py file?
To incorporate other languages?
also wondering this, I feel like people must be using a c library for speed
Hello all,
As we know that the chessnut library will be pre loaded in the environment and hence its import wont be counted in the memory utilised.
But will the various functions which we use from the chessnut library also **not included **in the memory calculations or they would count towards ram utilisation?
I am not
are you using a library in c or did you make your own?
made my own
I'm starting to think I should of been paying attention in my intro to c class
Hello everybody, completely new to Kaggle, I want to participate in chess competition, Where should I begin? any examples?
how much disk space do we have?
To submit the agent or in the notebook?
If you want to run the code in another language like c or c++ do we have to make our own chess libraries or is it possible to import them?
Anyone using subprocess.Popen? I'm getting TIMEOUT status during submit. Seems like the Kaggle env is not truly the same as the docker container as it's working great running the agent in docker container and subprocess.Popen not working the same in the 2 envs is my hunch. https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/547978
yes I am using subprocess.Popen, just made a comment under your post to a script i just posted that works for me
If you are writing in python you have to use it, and it sucks
the entire library contradicts the contest's focus on "efficiency and strategic thinking"
This is not true actually, there are other options for Python
@obsidian spoke Are you writing code in python or is it wrapped in a faster language?
after submitting
like when it's actually running
I think you only have 64 KB of compressed files
It's on the main page tho
whats the meaning of terms in this log file?
here stdout stands for the output given by my engine?
I think it means what you have printed out during the match.
@wind pecan I have the same issue with TIMEOUT status on the first step. @arctic flint I saw your potential solution here:
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/548061
but I received the same timeout error after matching your code exactly. I have confirmed that my RAM usage is under 5 MB locally also.
Hm interesting. Have you ensured that your linux binary is compiled with ubuntu 20.04? That was an issue for me and some other people
Also @slate sundial , my script sends allocated time in milliseconds (in accordance with UCI protocol), so ensure that your program is using milliseconds to calculate how to use its time
If your program is interpreting it as seconds it could be timing out
Another issue that affected me is:
Make sure that when you tar your files you do something like:
tar -czf KaggleSubmission.tar.gz main.out main.py
not
tar -czf KaggleSubmission.tar.gz src_folder
though I suppose that's not the issue you guys are having since I had a different error based on this
I am on ubuntu 20.04 but I could try adjusting my compiler settings to work with more generic hardware instead of only modern CPUs
hm ok. From what I understand they have Intel Xeon Haswell CPUs
I'm using make build ARCH=x86-64 in ubuntu 20.04 but still getting the timeout status on step 1. @wind pecan let me know if you ever find a solution to the timeout status
Is it possible to debug this kind of stuff in a kaggle notebook? (I just have a python script and an executable)
I have three files -- how do I submit them because my main.py needs my other file which needs my last file
@slate sundial No, I looked at @arctic flint 's solution and changed my code to mirror that. Still the same, works in docker but not in submit.
@arctic flint Compiling inside the docker container should do it. I didn't do that at first and I did see a "wrong format" error, so not seeing that and compiling in docker should be good. Although if nothing else explains it, it may be the only reason left.
https://www.kaggle.com/code/snufkin77/running-c-c-in-submissions?scriptVersionId=209377679
compiling the c code in notebooks also seem to be working
Does anyone know if we are allowed to submit in a tar.xz file format
I cannot compress my solution into a tar.gz
no
7z doesnt work either
hello, im currently trying start and have little experience of kaggle environments, does anybody have similar error? it works for everything else but chess? apologies if its an FAQ
check kaggle-environments version
make sure you are using the latest version
yes i have it already
Oh ok, yeah that might be worth a shot. For me compiling in Ubuntu 20.04 worked but I guess it might be even better to compile in the docker
compiling a c code before hand results in a binary of 140kb.
compiling the code in main.py is running fine on local but is failing validation post submission.
any suggestions..?
im veryy new to c,
so should i try submitting the compiled binary in submission or is trying to compile the c code post submission worth a shot..?
i personally feel that compiling the code in the python script would allow me to pack more lines in the .c file pre submission .-.
but that would result in my code being compiled every time the script is run to output new move
what are ur views @arctic flint @wind pecan ?
I am trying to call obs.board, such that it will give me an FEN string. But i get this
yeah that would probably be better but I don’t think it’s possible. Worth a shot though?
It would definitely be much better space-wise if you can minify your source code
Is pawn promotion available?
Looks like you are calling obs.board() when it's actually just available at obs.board
yup! see https://www.kaggle.com/code/bovard/your-first-chess-bot when it looks for queen promotion moves
Yes, I've seen it before. If you create a cell with just ```%%capture
ensure we are on the latest version of kaggle-environments
!pip install --upgrade kaggle-environments``` as shown in your-first-chess-bot example, the latest version is ensured. Maybe you didn't have the %%capture part when you did it.
thanks! i will have a look
Sometimes you have to restart the kernel to get the new version to take (that option is the menu above)
yup, i didnt knew why that was the case. i ended up trying locally and it worked instantly, thanks for the help!
i had it, basically i copy pasted everything and it didnt worked. now im just doing it locally since it worked instantly
What file formats are allowed for sumbission?
Ok thx
Minor correction, it can be anyname.py.
Is there any c library that will return the legal moves of a certain fen
Or do we have to make that functionality ourselves because that seems like a daunting task
what are they
rust is cozychess iirc
and cpp is https://github.com/Disservin/chess-library
Is there any thing for C?
oh its @neat sapphire 's 🙂
Yes but if you want to use Disservin's chess library the header file is 180 Kb which is too large for the submission size
So do we have to make our own program that gets the legal moves
make your own if you want your own design choices
I cannot fit the header file into the submission
Is there any way to fit the file into the submission
Because the size limit is only 64 while the file size is 180 kb
just remove stuff you don't use from the file
or make your own (which I personally recommend)
hi, came from kaggle, i am ranked at 20-30th place in leaderboard
(it changes frequently)
hello, I am doing this kind of challenge for the first time, can anyone tell me how to start in this challenge, just where should I begin with? a basic approach
You compile it, and submit the binary. Make sure linker optimization is on
And you can turn on -Os to optimize for binary size
Thanks so much
!tar -czvf submission.tar.gz a.out main.py
When submitting the tar.gz file it keeps giving me an error saying that a.out is not defined but it is clearly defined.
Would this be because the OS is Linux on that competition's end?
Hey everyone, I created a guide to compile stockfish into a 60 KB executable and profile its memory usage. The 60 KB executable still uses ~25 MB of RAM (exceeding competition limits), but the guide shows how to run valgrind to identify stockfish components using the most memory which can be targeted to reduce memory usage. I included a pre-compiled 60 KB stockfish executable, modified stockfish codebase used to compile the executable, profiling tool, and explanation of how to build and profile.
I'm selling this for $5 because it took a significant amount of trial and error to get everything working:
https://payhip.com/b/bRt1l
Im pretty sure this is against the rules.
Is there a moderator I can check with? I didn't see any rules related to this
Pretty certain that in the rules this was stated that it’s not allowed to share your code or even like sell it to others
The executable included in the guide can't be used as-is for the competition since it uses 25 MB of RAM, so it's mainly for learning purposes- it will still take some innovation to reduce the memory usage to 5 MB
for 0$ I'll sell you the advice that paying someone 5$ to see their potentially half-baked take at reducing Stockfish's file size won't actually help you very much.
how did you do this with the NNUE being several MBs? are they even embedded?
which stockfish version
I actually didn’t use NNUE for that reason, but might look into it later
the version just before NNUE was added. The same approach might work for later versions of stockfish if NNUE can be disabled
so Stockfish Classical? or do you mean Stockfish 11
git clone https://github.com/official-stockfish/Stockfish
cd Stockfish
git checkout 9587eeeb5ed29f834d4f956b92e0e732877c47a7
cd src/
make build ARCH=x86-64-modern -j
strip stockfish
tar -czvf temp.tar.gz stockfish
174k. Go delete some random tables and voila, you have Ben Swain's version.
Is it ok to ask but is this what the people at the top of the LB are doing? Shrinking down open source chess engines...more or less? Or writing thier own in C?
most are going the former, I'm going the latter
the people at the top have their own open source chess engines 
yeah there's that too
nice, I got 3 months to make my own then
3 months to match the worlds strongest chess engine authors is an ambitious goal : D
so is taking an existing engine and out-tweaking the worlds strongest chess engine authors
losing to the worlds strongest chess engine authors is enough to put on my resume lol
haha
3 months to write 3600CCRL level search. Impressive goal 🙂
Most of the engines are in the top 30 in the world you forgot to add 😂 Making a chess engine is EZ. Making a good one is another task 🙂
some people told me to restart the kernel, but i just run jupyter notebook locally
If the bot says ERR for a game and the logs show that it had 9+ seconds left, does that mean that the agent exceeded the RAM limit?
Am I able to share my chess website in here or are there more appropriate discord channels for such a thing?
This would clearly break rules on private sharing of code. Code needs either to be shared freely on the copmetition forum, or not at all.
Is just optimizing the chess engine enough to beat the world's strongest chess engine authors?
only if none of the worlds strongest chess engine authors also try to optimize the engine.
I'm not trying. But there will be some that are ~top tier.
out of all the available chess libraries in python, why was chessnut chosen?
python-chess would have been the far superior choice.
Chessnut breaks(timeout) with just a lookahead of one(or maybe my code is that bad)
i uploaded a notebook 15 times already and still wont work (count as error)
what am i doing wrong 😔
I am not sure if notebooks can be submitted
I know, i meant when i submit the submission.py it just counts as an error now
same 😔
I am using an open source bitboard chess move generator, and the submission is not working, but I am not even able to understand where the error is.
Even the logs are not working
The logs are just []
same here
I've added countless debugs
Same
I noticed that when I remove the import part, the logs start working again
I tried keeping everything in one file, in separate files, in different folders, everything ended up in the same issue
I have no idea what is wrong
Chessnut is depressingly slow
And I do not have the time to make my own bitboard
I dont know but should the submission file just be purely a def
no
At least I do not think so
My first bot had a dict outside
And my present bot works without import, it is just importing the chess file that causes everything to go blank
expecting that they might want us to do that 😔
thats sad 😔, I have no idea why logs are empty []
This is my first competition after years and I am getting so many weird problems
My bot does perfectly fine in my own env
Both is outsmarting each other and not recognizing the remainingOverageTime
in kaggle notebook
Yeah
even with itself
"When you upload a submission, we first play a validation episode where that submission plays against copies of itself to make sure it works properly. If the episode fails, the submission is marked as error and you can download the agent logs to help figure out why. Otherwise, we initialize the submission with μ0=600 and it joins the pool of for ongoing evaluation. At this time we also deactivate older agents if the total number of active agents is greater than three."
I dont get how the episode fails
same here
and especially why the logs are empty
the bitboard implementation I am using is about 4k lines of code
When I randomly remove code, the logs give valid results(but ofc errors because I removed random lines of code)
I mean it is not [] anymore
Only if chessnut was faster
A single look ahead results in a timeout
Yes
I don't think so
a lot of repeated moves already ends in a draw it seems
if log is [], it means that neither the agend went trough a single step
It could not even load the agent
In short the game did not even begin
Maybe it took too long to load the dependencies, which resulted in a timeout
i think ill just
make it that it uses the same 3 moves
just to visualize a surrender
But in my local machine, I timed the imports
It took 0.1 seconds
my local is more faster
I have no idea
but when it comes to the notebook, its sad to see
is there paid plans in kaggle lol
But that would not apply to the competition env 😔
you can use a GCE runtime afaik
"Threefold repetition rule is automatic draw"
I think it might work
yes
But if your logs is [], it means that a single step is not working
the game does not even start
and I have no idea why are the logs []
the dependencies take 0.1 second to load on my local, how bad can it be in the game env ?? 😔
If I add a print statement at the top of my code, even that does not print anything
If there is a huge import
any advice on how to measure the ammount of memory, compute and data im using?
where are you running?
I just started the competition so default notebook what do you recommend?
I also ran on kaggle notebook
how did you manage the memory constraints then?
I could not 😢
Are you using chess nut?
There shall not be any issue if you are using that
(also if you are not using other intensive libs)
You can go by the kaggle chess env then
ok tremendous so If I use chessnut I can just do whatever basically?
No
If you are using chessnut, you are fine as long as your chess env in kaggle says so(mostly)
The env was updated to match the actual constriants a few days ago
ah ok so as long as I use the chess env and I dont get an error Ill be fine on the constraints regardless of what I use?
I'm honestly kinda disappointed with this competition a bit so far--the current obvious best route is to just clone one of the top engines and remove NNUE/TT/any other tables, switch out -O3 to -Os when compiling, and zip to sub-64kb and sub-5Mb RAM. Just commenting to start the conversation, not sure how can be solved if there's a follow-up competition though and maybe this is due to the competition just beginning (I'm sure it'll get more competitive with engine improvements as it gets closer to ending)
Lower the limits even more 🙂
But the actual answer was for FIDE or Google to consult with literally anyone in the field before making the event. It's clear just from reading the event description that there is a gross lack of understanding of computer chess.
you can still try to optimize existing engines
Anyone else getting "Unknown Enviorment Specification" when running make("chess")? Works fine for tictactoe
NVM - just restart kernel for anyone facing similar issue
Ideally how should the event be set up in your eyes?
with increment, no ponder, with a cpp/rust library if they still intended on using a fixed movegen, idk. so many things could have improved
How would you implement pondering to you engine?
the only method I know of is using 1 thread to search, and the second one to receive communications at the same time, but I'm sure theres a better method
but I thought the CPU is single threaded so threading will not work?
single core != single thread
Oh is it 1c2t for the competition?
That doesn’t matter, you can run multiple threads on any x86‐64 CPUs, regardless of literally anything else.
A simple way is just polling stdin (from C and/or C++).
I don't know exactly what could be done in order to accomplish Google/Fide's goals of people doing something "original" -- but I know enough to say with absolute certainty that all 5 prize winning entities will be Stockfish, or another already-worked-on-for-years open-source engine.
I noticed that kaggle permits different file formats, including compression formats like .gz, .7z, .zip, and so on.
I uploaded a .gz file and it failed with no errors logs , so I compressed to .7z, it failed but this time their were error logs to download, and I noticed that it is trying to load thr 7z file as a script to be ran instead of extracting the contents
I had the same issue 😦 a few days ago, I just gave up on the comp as a whole
Well, that sucks
7zip software compresses my submission pretty well (56Kb).
My implementation is in C++, used a python binder to compile to a shared library which I could then import to python, the compiled file is 128kb, and compressed to 56kb
how much is other compressions?
7z gave me errors too
I had tried to include the src code of a bitboard based chess move generator in python, although it was below 64kb and it ran fine in the env, submitting the code always resulted in error regardless of any compressions.
Actually not even errors
The logs were empty
Maybe they were not able to load the dependencies
About 71KB
thats so close
Bruh, I had to do hardcore and aggressive size optimisation to even get my binaries down to 128KB before using a compression format
When I originally built, it was 520KB
someone specifically asked about 7z compressions but that post got downvoted
how long have you been working on it?
Today marks 8 days
do you have a working C++ based submission yet?
Well, I mean it works on my end and several other machines I've tried it on and it doesn't exceed the RAM constraints
But I'm yet to make a successful submission on ksggle
ohk
the only thing left is compression?
There's a discussion about this 7z compression tho, discussion 547145.
I already tried .tar.gz format, and it failed without any error logs even
Yeah
I have more work to do, I just want to submit what I have currently.
So compression is the issue now
iirc, it has many downvotes
The one I'm seeing has 2 upvotes
It could be another one, or maybe people have retracted their downvotes
This is quite hilarious
anyone looking for teammate?
I just posted a little tutorial: https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/549743 Maybe it can be useful to someone here! 😄
The tutorial teaches how to submit a simple C engine, so if anyone is stuck trying to figure out how to do that, maybe the tutorial can be helpful.
If there are random timeouts in the submission(Like when the agent goes from 9.3 seconds to -0.1), does that mean I exceeded the RAM limit?
From what I have been able to understand insofar, yes.
Okay so I'm just starting to look at this competition and it seems interesting. Looking at the the chat so far, I'm a bit hesitant to start working on this immediately since it seems there are some gimmicks people have been trying. Specifically trying to just use a barebones stockfish w/o nnue, compress the binary, and find ways to reduce RAM. Is this something serious to think about? Like the top submissions will all be barebones stockfish and some novelties on reducing ram? Should I just wait to work on this project until later in the competition when the rules may change?
Exceeding RAM limits will always end up with -1s. The environment will only wait 1 second past the deadline. In the case of using too much RAM the OS has killed your process and there is nothing that can respond so it's always -1s.
Just posted some debugging steps for if your agent can't pass validation: https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/549965
That's what some of the professionals in the feild seem to think (Andrew Grant father up in this channel). I'm assuming most top solutions at the moment are using previously developed engines.
There are some custom engines in the works. Supposedly they look promising but it's taking time to improve
@languid barn is there any chance of it actually happening, or does FIDE/Google actually care?
I mean I don't want a precise answer, just an insight into whether any of the obvious concerns about the potential direction of this comp. have anyhow came to the hosts attention?
I only said that comment because I believe lowering the limits more benefits me and hurts tho who are willing to put in more effort than I am.
( But still, lower the limits even more 🙂 )
Haha, yeah, I referenced this as it seemed the only mentioned potential solution - maybe there are others.
I would bet money that all 5 top submissions will be existing engines, as long as at least 5 people care enough to try.
But this is what holds too IMO
So I'm just asking if there is any chance of this changing
What does "this" mean in your sentence?
The first "this" refers to Your comment about lack of understanding from the hosts
The second 'this' refers to the current situation
No one stopping Fide/Google from emailing me, or any other open source author, or anyone on the stockfish team.
I don't think there is really anything that can be done to ensure the top submissions are actually "interesting/novel", without just ruthlessly dictating what people can and cannot do. But the irony of the situation here is that the 64kb/5MB limits heavily favour existing approaches. Things like Lc0 don't exist under those conditions.
But the irony of the situation here is that the 64kb/5MB limits heavily favour existing approaches.
Yup, thats what Im talking about
Lower the limits further, then you favour AB even more. Raise the limits, then you allow existing tech, which makes it even harder for novelties to exist.
AB ?
Idk. Maybe its just $50,000 to see if anyone will come up with anything interesting. I'm sure someone will. they just won't win.
AlphaBeta.
We are definitely watching the leaderboard. Is there a change in the limits that you think would foster more "interesting/novel" solutions?
I don't think there is any increase/decrease that can be done that will change the results at the top of the leaderboard. Increasing the limits allows access to a greater set of ideas, so that would help make noevl solutions possible, but guarantee what the majority of solutions look like.
No amount of lowering the limits meaningfully stops someone like me from submitting Ethereal or CFish. Unless you go psycho and down to like 4kb binaries.
And if you did go to 4kb binaries... then there exists already an entire class of engines that play at that constraint lol.
I'd say going very low on the computational power fosters innovative solutions the most, because leveraging the efficient usage of CPU has been done for so many years on a world-class level (and almost always won by stockfish)
Let the code limit stay the same, but reducing move/game times and memory to even 10x less
I think that change also helps existing engines.
Would even disable AB
Ethereal can play super human chess with 1s + 10ms.
Does it do AB?
Yes
Then lets go for even less
There is a bit of propaganda from alphazero that misleads people into thinking that modern chess engines are just "brute force" super calculators.
Engines are highly selective, and dynamic in their decisions to explore the search tree. Calling them brute force is essentially a pejorative.
Sure thing
Most of the non-alphabeta solutions are the ones that require greater time and resources.
CPUCT engines like A0/Lc0 require massive networks.
MCTS engines require memory to dynamically build search trees and not just iterate and toss them.
An LLM approach (lol) obviously requires a lot of memory, and probably compute for inference time.
Exactly, how about constant computational complexity? Im thinking rule-based approaches, tabular ones even, FUNCTIONAL models, but ofc optimized locally to find interesting patterns that havent been found before
Anyway, this is not just me ragging on the rule set. There is a very clear status quo, and forcing something outside that is hard. I'm sure there is a silly analogy to some other domain. If you run a motorcycle competition, you are going to get mostly combustion engine solutions.
the definition of constant complexity is bendable.
It takes constant time to solve chess.
Less silly, it takes constant time to do a depth 10 search, because you can bound it.
Whoah, I am almost sure electric motors would leave them far behind, but I get it 😂
okay my lack of domain knowledge makes the analogy bad.
Maybe my bad anaolgy is the perfect analogy here. Since it seems Google does not understand the domain 😆
I just fell prey to the same thing 😦
Not really, its just hard to enforce
How do You constrain sth not to search in the move tree?
Because I was thinking with another analogy (a closer one maybe) - AlphaGo was a success mainly because it found patterns that no huma knew before, which can now be used by humans, I mean - no tree search (either direct or probabilistic)
Could be done with a custom programming language that doesn't have goto/recursion/etc. For example, instead of submitting a python program, you submit a neural network. Then the referee runs your NN (without any search) to choose your move
anything that can be done iteratively can be done recursively and vice versa.
Im pretty sure this can be done for chess, so ofc seeing the gain somewhere in the tree, but then being able to make a pattern from it, being albe to discover them from just the board setup
AlphaGo was a blackbox, right? I mean eventually, because of the computational complexity, no matter the approach actually
MCTS/RL/NN as well as simple AB are eventually black boxes
Yet what we got was human players know more about tactics
Some patterns being so easily explainable even to amateur-class players
Can't we get that in chess?
NN seems to be too defining, but Yeah, thats what I mean I guess
You can actually lock recursion in Python, even disallow using loops pretty easily...
That would address both
How about that ? No time constrains then, no problem with the unstable environment/hardware
Just pure functional responses, no recursion, no loops
I'm thinking outloud, IDK, sb please tell me when my msgs are no longer valuable 😛
Maybe even just a table+mathatical (and logical) operators
I'm sure there are lots of ways to introduce programming constraints that could make for an interesting (i.e. not already solved by current techniques) competition. But the question is what FIDE/Google are trying to get out of the competition, and what constraints would help to achieve that.
Well said, the question is if we can rely on the official goal of the competition: to emcourage novel approaches, unseen strategies - thats what they say the're trying to get out of it, right?
I’d say TCEC 4K does a good job at at least requiring people to create engines that are specific to it (rather than just modifying an existing engine). Though at the same time, it doesn’t encourage any particularly new techniques. I think significantly limiting the RAM rather than the executable size might lead to different techniques being used. Or maybe throttling the CPU significantly.
At the same time, it’s very difficult to get people who are familiar with chess engines to “think outside the box” to come up with a completely new approach, and people who aren’t familiar at all are unlikely to be able to have good ideas for it in general. I think you either need someone really creative, or maybe someone who has some understanding, but isn’t quite very experienced.
Agreed. Also, it's hard to develop new ideas in just 3 months, when you're facing a problem that has ~50 years of research already!
Does anyone know what version of kaggle environments should be used. When I run make("tictactoe") my code works but when I switch to chess I'm running into error saying the environment is known. My assumption is that im not im when I pip install/upgrade im not getting the right version of kaggle-environments, any suggestions would be helpful
Latest version is recommended. 1.16.9 https://pypi.org/project/kaggle-environments/
I think removing the submission size limit and dropping CPU further would lead to very novel solutions
I dont want to say what those are in case it ever happens
But it would be quite far from current engines
Just as one can argue that decreasing the constraints even further can increase the likelihood of introducing novelty, one can also argue that increasing/relaxing the constraints increases the likelihood of introducing some novel approach.
It goes both ways but personally, I believe all this shouldn't matter. I see people complaining about constraints, and how it's either too small or too large. The bottom line is the constraints will not change so suck it up while you still can and tailor your solutions to fit right in.
I think it’s mostly a ubiquituous take (at least among people who have some experience) that making it more constrained would lead to more novel ideas.
I don’t think anyone is really advocating that making the constraints looser would be better, at least not without making other constraints tighter.
It’s just a matter of figuring out which constraints should be tighter, and I agree with Virenz that throttling the CPU would probably be helpful to encourage novel ideas.
At the end of the day, it's all just opinions.
But hey, It doesn't actually matter
Well, it’s not just opinions in the sense that there are sets of constraints that require people to come up with new approaches, and there are sets of constraint that allow people to just reuse existing engines. Though it’s not obvious to which extent Google and/or FIDE want innovation.
And if you want for people to actually come up with innovations, this is definitely something that warrants being conversed.
@languid barn thank you for your help
Hi, are people using shared c libraries or is that no possible omly c executables? I am not very advanced on this sorry
I believe you can use shared c libraries, I don't particularly see anything that hinders that.
If you want novel approaches and Innovations that center around minimal compute resource consumption, then yeah, sure strictly enforcing the constraints or even reducing it is the way to go
If you want a novel approach that doesn't necessarily center around minimal resources, but rather performance in the game, relaxing some of the constraints will promote/favour that.
Your approach can be novel and still not fit within those constraints, just as it can also be novel and fit right in.
Relaxed constraints and novelty are not mutually exclusive like you think.
As at the time NNUE became a thing, it was quite novel, at least within the context of chess engines, but it's not exactly a good fit if you compare that to bots that can work under the stipulated constraints of this competition.
the whole issue is that under these constraints, novel ideas will not beat conventional negamax approaches
Maybe its all fine. It just means that Google will have to look at the 40th best entry to scout for novel ideas, and just ignore the first 39.
Well, unless ofcourse said approach involves devising some very quality heuristics or static evaluation function to evaluate game position.
Assuming those "novel ideas* can even submit
I enjoy the prospect of google getting 100 stockfish submissions.
and that assumes the top CPU engines (Stockfish and Torch) which are developed in excess of 1k cores (4k in the case of SF) have not discovered this yet
I think small things will be found, but larger innovations won't happen
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/550339
I'm not gonna lie, this I think is the most pressing issue with this whole thing. Sure there may be bugs now, but they sort of apply equally to everyone. This is fundamentally about determining the winners of the competition.
👏8 👏 opening👏 lines👏 in👏 the👏 book👏
it will be changed at some point tho
in my experience, when you start piling up things that will be changed eventually, a handful of them slip through.
Is there anyone here able to achieve a depth of 10-15 (assuming you're using minimax or a variant w/o PV search and Alpha-beta pruning)
Pocket math on a depth 10 search using pure minimax. You explore all nodes. Lets say there are 30 moves per position on average. 30^10 = 590,490,000,000,000. You have about 200ms per move on averge let us say. So you need to search 2,952,450,000,000,000 nodes per second. I believe that is ~3 quadrillion nodes per second? I don't care how much A0 propaganda you've read, engines ain't that brute forced.
True.
Tho, It's not like the agent gets to explore all these nodes, pruning can drastically reduce the number of nodes to explore.
Whether one can prune the tree enough to reach this depth in 0.2sec is another story. You think that's possible?
Possible with what? In general? Yes of course, the AB engines do it easily.
$ ./main.out
position startpos
go depth 15
info depth 15 seldepth 19 score cp 16 time 73 nodes 192516 nps 2601000 hashfull 527 pv e2e4 c7c5 g1f3 b8c6 d2d4 c5d4 f3d4 d8b6 d4c6 b7c6 b1c3 e7e6 e4e5
bestmove e2e4 ponder c7c5
73 ms to reach depth 15. But "depth" is a very subjective word.
Interesting.
A lot of pruning is really going on here.
I'm working on an AB engine myself, alongside an MCTS engine (just because...) and another that combines AB with iterative deepening for PV search.
The first and last one explore as many as 90k nodes in 2x this time, yet it's not nearly as deep as this (it reaches a depth of 6)
I guess this has something to do with my evaluation function.
Subjective in what sense?
I can easily reach depth 1000 if I just prune everything except 1 move per node.
First things, first. There is a chessboard. An 8 x 8 grid. A 64 dimensional tensor. King, Queen, Rook, Horse, Tower, Pawn. 6 dimensional "profiles" for every dimensional tensor, at any point in time. We cooking now. Thinking out loud.
24576 varities of: input layer to LSTM
It's a Discrete problem, btw, imho
and you are already out of memory 🙂
i'm all ears 👉
powerful algorithms, as cookie cutters, are approaches to problems, rather than cookie cutter solutions
I can’t claim I have all the answer, but it observably, it seems tightening constraints seems to favor more innovation one way or another, since it makes existing approaches prohibitively expensive (sizewise or speedwise). A simple example is TCEC 4K, on which existing engines simply cannot fit, so new engines have to be written from scratch.
I suspect if there is a CPU speed constraint, that would require novel techniques even more, but of course that is only a suspicion. I think it’s at least fair to say that if you constrain the CPU enough, existing approaches won’t work well at all, though it’s difficult to say that people would be able to come up with anything better.
the example you gave is another one where the answer still ends up being the existing methods.
Okay it sucks to get an engine to 4kb instead of 64kb. but it does not create innovation.
We start here. An ANN with 64 input layers. The Chessboard.
Each input layer, a Square on the grid. Of state to Date.
A bit of a complex number, perhaps, as each Square encodes, binarily, its Spacetime content. Tis rook or knight, tis, King or Queen.
If at all one wants to go down this route, to handle constraints, you'd have to use something more efficient than an LSTM, something like mamba, since the mapping from input to hidden to output is linear, you can perform an associative scan, which will make it a lot more faster than LSTMs
But associative scan consumes more memory than just doing things iteratively.
Also, your technique would have to be very well optimized for CPUs since GPUs aren't an option here.
Personally I'd say it's worth a try, but not for this competition.
Hi I am new and have just started using C++. Has anyone had success finding any existing good C++ bitboard implementations?
I want to use a fast C++ library to turn the fen string into a bitboard and then be able to get all the possible moves and such.
Check this out:
GitHub: https://github.com/Disservin/chess-library
Doc: https://disservin.github.io/chess-library/
It was made by @neat sapphire
default version fits within the constraints you just have to trim it down a bit if you want to competitive
Yeah, true
Thanks
So I could download the files in the src files and then trim it down myself?
Yeah.
It's just one header file
chess.hpp
The one with Almost 4k lines
Write your strategy/strategies, when you're done remove the parts your implementation doesn't depend on
Kk, thanks for your help!
Sure
I have tried using that library but it seems like it uses too much memory. Could this be true?
It might. I’m hoping I can just remove all the parts of the code I don’t need but haven’t tried yet
You have a board. 8 x 8, or a grid of 64. Each grid point may be occupied by a piece (pawn, castle, horse, etc.), or no piece at all. Each piece , as it is, or as it's moved, changes the board. Does it threathen your opponents pieces, does it protect a piece, is it a barrier. Also, limiting the freedom of the King is paramount.
these may be encoded as binary arrays of each grid point: its piece (6+1 possibles), its characteristics/ current contributions (binary classifications too), to then be used by an ANN to weigh moves (based of learning). What do you think about this approach @wide oak ?
C++ is not going to give you an edge. The problem has nothing to do with rapid calculations.
C++ not going to give you an edge over what?
Over everything except C and maybe Rust it certainly will.
I have exactly zero thoughts on your hypothetical net architecture that probably won't fit in 64kb.
No. I myself have used it for one submission. If it is using too much memory you are doing something wrong.
Whhy would you use a notoriously hard to debug language for this project, unless for speed?
Well how will you calculate the best move for a game that you only have ten seconds for?
You need to be very fast
So, you are attempting to do exhaustive searches, at every turn of the way. This is exactly what the competition is trying to side step, imho.
But if you use NNUE, you will go over the 64 KB limit
No
I have 5 MB of ram to work with btw
You can easily use NNUE and be under 64kb.
C/C++ are only hard to debug if you are not very smart.
RAM is not the limit to the nets, its the submission size.
sorry, i was focused on how much ram my system can use. my bad
Your net can happily run with 5MB of memory, but you are not putting more than 64kb of weights in. Or 2x/3x that with some lucky/novel compression.
But how good can your model be, because to limit into a 64 KB compression size, it will be a small model right?
You can beat hand-crafted evaluation functions with micro nnues very easily.
well, 64KB is the compressed file submission
Are they super jaw-droppingly awesome and competetive with SF's NNUE? No.
i can fit 16,384 floats into a 64kb files. I ike them odds
More then enough for an ANN
Pointers are nightmares
feels like an undergrad CS take ngl.
debugging c or c++ is not meaningful different than anything else. you have debuggers, you have tools to step through code, to check the values of variables/registers at points, produce repeatadble core dumps, ...
Its all the same stuff.
I'm not against using it in a final product, but never to prototype
Sure. I was never arguing against that.
“Exhaustive” feels like an overexaggeration. But you definitely need some kind of search. You won’t get anywhere near anything remotely decent without either search or a large neural network (which definitely won’t fit here).
You don't need to do a search. You need to encode the board. Every square has either a piece, or no piece. And the piece (or lack of) has some relationship to the other pieces/ squares on the board. So their are 64 input vectors to your ANN, composed of these binary encoding categories. Encoding such details as, a pawn to the diagonal left or the right of a Horse, etc. Or empty space. The system then weighs movements of pieces
you gonna have to search if you want to place top 25 🙂
I like this project
Doesn’t sound unreasonable, basically just policy, it just won’t be competitive at this size.
I dare say you need search to place in the top 50%, though maybe I’m overestimating the participants.
i don't care about the prize on this one
Maybe you could investigate e.g. Lc0, which sounds like what you are describing (i.e. networks that can play above human grandmaster level on policy alone, without search), though you probably won’t be able to train a good enough network that fits in 64KB. I was told by one of the Lc0 developers that he is looking for someone to figure out how to train a small network to replace their “trivial” backend, and he wants to use this competition as an incentive for it.
so, as input to an ANN, i can include, grid, piece (or lack), relationship to the whole (protects a piece, backed by a piece, threathens, sacrificial, etc.) and map this to smart moves without searches
all inputs being binary vectors
Normally neural networks for chess just use one hot encoding (i.e. one input for each piece type and for each square) and let the network figure it out.
That is probably better than trying to encode heuristics ultimately.
S,o just encoding the squares, themselves. Piece type being part of encoded info for squares as well as it's impact, also binaries.
Well, not “its impact” in any way. But yes, just boolean vectors.
Impact; a piece in square may have an impact: encoding that as booleans too, is what i meant: checkmate is the big one 🙂
Well, sure, you can explore novel ideas like those, but I’m just describing how existing strong engines go about it.
lc0 without search is super human, although terrible in engine terms. but that requires 100+MB nets.
Sure. Now look at it this way: you move a piece: it may back up another, be supported by another, threaten your opponent, be used as a sacrifice to save another piece, etc. These can be booleans to describe a piece. The vector resultant is rich with meaning. What it is and what it can do. The board is a landscape of these. Every square is a piece, absence of piece being a piece too. An ANN gets fed these vectors (64 sets of booleans) and learns to weigh next moves. No search involved.
Well, in non‐“size constrained” engines, the network can just learn nuances of the position without needing to have it be part of the input.
I am looking at a team
Well, you'll get used to it. I'm guessing you're just new to C++ that's why.
If you can't properly handle raw pointers or are too lazy to always malloc and free, I suggest you go for smart pointers (assuming you're using C++)
Shared pointer, unique pointers and weak pointers.
I use them a lot these days, in my MCTS implementation, I store shared pointers of children nodes and each node holds a pointer to their corresponding parent, to avoid circular referencing, use weak pointers for parents (they only reference but cannot own an object)
That being said, you should probably avoid pointers when they're not needed.
You just have to use various compressing and debugging stripping flags.
It also depends on the size of your own solution, but you can always trim it down too.
It's really not that hard to debug, you're just not used to it
Pretty small and quantized... The quantisation might even make it useless as it would be quite inaccurate.
Who knows...
They were talking about memory usage, not submission size, compressing and stripping flags won't improve that.
I must've read that wrong
A grid square on a Chess Board, is defined by the piece on it (or lack thereof). And that piece, threatens and/or supports other pieces. Or threatened or supported given current board state. Also, it commands space, as potential next move of occuying piece (if there is one). It also affects the opponents King's freedom of latitude in movement, at all times. And a checkmate denies this. 🤔. @torpid maple , @pastel creek , @wide oak , @verbal stratus , what do you think of this?
how would you define "threatens"(ok this is understandable) and "supports"?
Good question. Threatens: my Bishop can take your Horse next move. Support: there is a pawn next to Horse that can take bishop after that. Make sense?
Probably check Rule 10: #rules message
oops. I was just trying to share some ideas that i had. 😅
maybe post it in the official discussions forum
Got it. Don't tag other people. Still okay to drop ideas about this challenge here though
for sure
but if you post it in the official discussions forum a lot more people can see 🙂
true
So there is also 'Command of Space" for a grid square, Qafig. It represents all grids a piece (in that gird) can move to, given a turn. So every grid square (with piece) becomes defined as threatens/ supports, commands space, supported, threatened (which can be encoded as booleans) , when next move potentials are weighed and passed to an ANN. And all focused on cutting off the King's freedom of movement, under attack (a checkmate). This is the vision.
running an ANN in this comp would be such a hassle
- Such an ANN would take a very long time to learn such a complex feature set.(ig)
You'd train it on the side, and just include model weights and arch in submission
How many inputs in total?
One particular problem in representing a chess board for input to NNs is how would you represent a grid
idk tho
maybe it might work out with proper selection of inputs.
also, what shall the model output?
or maybe I am not getting what you are trying to say
Story of my life dealing with my Mad Scientist brain, brainstorming 😂
weighing potential next moves
That is very confusing, is your nn some kind of heuristics for a minimax?
There are only 64 squares. Has a piece or not. Relationship of that piece to other pieces and the grid: this is Threatens, supports, commands space, supported, threatened.
So every square as input has evolving values, based off piece in it ( or lack of) as well as impact (command of space, etc.)
😮
evolving values?
I think to make such an nn work, you need multiple layers with tons out parameters
also the output of the NN would be a move?
like a distribution of next moves???
how will an ANN output chess moves(like what is the format)?
Just out of curiousity. What's your take on some of the ideas I've dropped
and anything else
The grid's current 64 dimensions of vectors changes with each move
It's a classification problem, not regression
Yeah, but even for classification, what would the output tensor look like?
To tune such a complex neural network I imagine you would need to train it for millions of games.(unless you train it on data of chess matches, which is better but still)
could it look the same as the input, giving out a new board
I imagine that would be hard to train, generating valid next-move boards(via nn) are complicated, thats why people use minimax/mtcs like approaches.
I am not sure tho
Maybe I am wrong
It could feed itself though no?
like its own output as input?
I mean definately not good for this competition constraints anyways
yes
thats true, but is there someway for it to theoritically work?
but what would that achieve?
Infinite computing power👍
what if it is an endgame?
as in maybe it could evaluate its own output over and over again to actually get the best position
but if im not wrong the OP says that the NN would generate the best next move
what it thinks is the best move
but if we pass the next state as input, it would generate the next to next move
sure and then evaluate that one, similarly to minimax ig
but it does not evaluate the "score" of a particular board, it just generates the state of the board assuming that an optimal move was taken
but you can have an evaluation function at the end of the iterations
NNUE is already quantized (to i16) and you should be able to fit 95% of the weights in i8 without any accuracy loss
Unless they were trained with Quantisation aware training (QAT) technique, I don't see how quantisation will not impede accuracy
Also, even if they were, for 8bits quantisation, the network would have to have less than 5 million trained parameters to fit into this competition constraints and for 16bits quantisation we're talking half of that.
Maybe there are NNUE networks that are smaller than that anyways... with reasonable accuracy even after being quantized
However the RAM itself is not the major issue with using a neural network for this, it's the submission size that is the problem, compressing millions of weight params into a file less than 64KB is hell...
Also with the NNUE, I am under the impression that there has to be an engine that takes those evaluations of positions into account to make the best move.
you only need ~ 50k params to make a one about as good as top HCE
and that is exactly what will be happening
and I am pretty sure the trainers know about quantization
all that is happening is you are turning floats in [0, 1] to ints in [0, n]
the quantization is pretty good considering that the extra accuracy from using floating points nowhere near makes up for the speed loss
when I say you can fit 95% of the weights in i8 without accuracy loss I mean that the usual i16 quantization process which takes weights from (-2, 2) to (-512, 512) or so results in usually around 95% of them in the range (-128, 127)
50k params is crazy small, but I suppose it's possible.
Well, yeah...they won't have a choice.
Well, there's always IEEE 754 half precision compression format
Not like it has an edge over quantization
Yeah, well I guess we'll just have to see how all that fares as compared to the "more traditional" approach
For 50k params with i8bits quantisation, your weights would be atleast 50KB
Atleast coz there's usually extra serialisation data as well.
So you'd have to build your code binaries to be less than 14KB, or even less
Is it possible to return algebraic notation? (a3) instead of (a2a3)
No.
If we use the Chessnut library to generate legal moves, does that count toward the RAM limit?
Would it be better if we had our own move gen?
I think it may not meet the RAM requirements
Does that mean it doesn't count toward RAM usage or not?
The master zip of the Chestnut API, on github, is ~19.5 kb. So what the api takes up as RAM, in and of itself, even expanded, is ridiculously small. Importing it for use, it's negligible vis a vis RAM usage.
Yes every object that you code creates (including calling into libraries) will use your available RAM.
😂
As far as the question of "should I my make own move gen" that depends on how often you are calling it and how much you think you could improve on the existing.
What have you raised the RAM limit to, as the (hopeful) stop-gap on better limit checking.
People are reporting using quite a bit
Your comment a few minutes ago is 1MB. But I saw claims of people using 8MB+.
Hmm. But then the solution is not eligible to win, even though it can be run. 🤔. Be mindful of the competition constraints
I raised the RAM limit by 1MiB
why?
can we raise RAM by another 3MB 🥹 😛
so it should be reduced back when the RAM usage is enforced better?
correct
while we investigate RAM usage issues
so this means the environment itself has some issues, not strictly related to the agent?
It's pretty great when you fix a small bug in your code and go from 140th place to 20th place
correct, the RAM enforcement is per container
Hoping my new submission goes like this (removing ankle weights for more power)
it might reach the top 10 this time
Just made it to 9th place- i can’t believe it
Very cool! 😄 Congrats!
Hi does someone know if they added obs.LastMove?
I did add that, yes
you should also consider using a (much) larger book. should be easy to do, and it will improve the significance of the leaderboard no end
they will be doing that for the final leaderboards, but for the current preliminary ones an 8-pos book will do sadly
Hi everyone
I just wanted to try a sample submission with an existing engine but my submit fails... do you know if there is a way to get log or understand why the submit fails even if everythings seems to work on my notebook ?
Most common reason is that it takes too much memory, or the directory you are loading the engine from is wrong (directory is agent_simulations if run outside of notebook(
@merry kestrel so the path of the directoy is not "/kaggle_simulations/agent/" but "/agent_simulations" or "/agent_simulations/agent", right ?
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/548061 take a look at that.
engine_name = "main.out"
engine_file_path = "./" + engine_name
if not os.path.exists(engine_file_path):
engine_file_path = "/kaggle_simulations/agent/" + engine_name
ah ... so my file was already managing this... so I suppose it is linked to the ram usage .... Will check your link, thanks 🙂
Does anyone have a good way to score their agent locally?
c-chess-cli, fastchess, cutechess
Hi does anyone know which cpus are or will be used to test the engines? (or where to look)
Found this info on CPU specs:
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/547146
I have a C++ bot and I am trying to submit. My bot runs locally with my main.py file but when I submit it I get this error and I don't know how to interpret.
Anyone else run into anything similar and figure it out?
Try replacing "./my_chess_bot.out" with "/kaggle_simulations/agent/my_chess_bot.out".
How did you compile and run it? When I try with the kaggle compiler (g++ 9.4.0) it gets a bunch of errors, only works when I do it locally.
I think the error is actually in my c++ code compiled version. It doesn't like it for some reason, which is probably because I'm on a mac compiling and using g++ 17.
Ah, that makes sense. You need to compile on Linux (with a glibc old enough to match the one in their container). Or conversely cross‐compile, but that would be less straightforward.
there is no g++17...
Wait sorry, meant 15
Ohh, looks like you're right. Clang 15
well and i ran it like you would run any program, ./myprogram
and compiled on ubuntu 20, to have an old glibc/cxx dependency
and uploaded the compiled program
Should I get a virtual machine to run ubuntu 20?
@languid barn Have you looked at https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/550339 ? I hate being intusive and pinging you directly, but I assume you are the main moderator of this competition. Please look at this. The submission placement is currently all over the place, the swings are +- 100 elo, and I don't mean the initial ramp-up. A whole day after submission our engine can place 2nd, or it can place 6th, in a matter of few hours.
It is a fundamental flaw of how the elo (score) is being calculated
well you only can if you have an intel mac.. otherwise you will have to run arm ubuntu and cross compile and im not sure about glibc there
M3 unfortunately. I will look at cross compilation. Thank you!
okay well not so much cross compilation just change the compilation target to be x86-64 and hope that glibc will work
Is there a way to measure RAM usage locally?
Ended up just uploading the files to kaggle and letting a kaggle notebook compile it, which worked
Profiling in Development Environments
Many IDEs provide built-in profiling tools:
• PyCharm (Python)
• Visual Studio (C#, C++)
• IntelliJ IDEA (Java)
• CLion (C++)
I use a docker with the image they shared its pretty simple
How do you set up the Docker Environments?
I have a docker app installed in my mac but im not very advanced on it
Is this the docker that we are talking about?
https://www.docker.com/
After downloading new version to Fide Chess , I got Error=Validation Episode failed, size of main.py is 7kib,When clicked on notebook name I got the replay that ended in mate and following text: Agent exit status/reward/time left:
DONE / 1 / 1.689153000000002
DONE / 0 / 5.775771 . Need help!
has anyone managed to get stockfish to fit in the RAM constraints
no
yes
yes probably
I believe, the point of the competition is to not rely on this, or alpha zero
i think many people are attemting to strip down very strong engines like stockfish, but prob not alpha zero though
My prognosis 😂
It's not gonna happen. Stockfish uses massive search trees to analyze postions and come up with a move. It's not gonna fit in a 64KB file, even compressed.
stripped down version of it, and without the nnue version it can definately fit
what
Has anyone gotten NNUE to fit within the filesize and memory constraints?
one could say that all engines that have a PSQT, have an NNUE. So sure.
Mainly curious if anyone has compressed the NNUE weights and biases file without reducing the skill level below that of stockfish classic
does anyone have the source code for what obs actually is
NNUE is an eval function, right?
If you include NNUE, wouldn't running it be much more expensive for RAM and CPU?
And then on top of that eval, you would have to perform a search that would exceed the limits of the CPU and RAM.
Hi does someone know if they are enforcing correctly the 5Mib RAM? Im pretty sure my engine is using more but it is working
I think I've reached the best solution I can while having 0 chess knowledge. If any chess masters want to team up, I might be open to it
You don’t need to have particularly good chess knowledge to come up with a good engine.
Knowing how to play chess well and knowing how to make a good chess engine are almost entirely orthogonal skills. There is almost no overlap.
i mean for evaluating things like pawn structures, mobility etc I think its a good advantage to have some decent chess understanding
I suppose, but ideally you’d be looking into Elo test results, rather than individual games.
hi can someone help: have people managed to ponder, like to have their compiled engine think during the opponents turn?
im really struggling with it :(imgoinginsane
Not if you are implementing a nnue, hueristics maybe
when tried to test all possible positions when when starting with 2e-e4, I have 20 possible moves, so im using two nested for loops , its like for every 20 moves I have 20 moves for every initial move, when submitting this logic I have an error, but if I limit every loop to 10, I can submit , but the moves are not so strong.
well, idk.
but you should generally have a recursive solution rather than an iterative one for your search.
one approach is to use https://www.chessprogramming.org/Negamax
unless it's some sort of PUCT
Hi does someone know if to promote a pawn you send for example c7c8q or c7c8, I am having issues when sending a move to promote and receiving obs['lastMove']. Like can you promote to a knight?
The (lowercase) letter of piece you want to promote to is attached to the move name.
q -> queen, r -> rook, b -> bishop, n -> knight
E.g. c7c8n to promote to a knight.
Hi, is the CPU used by kaggle for validation too slow compared to a normal laptop? On local machine the agent uses 2-3 secs to finish a game but runs out of time (10 secs) in validation within a few moves. No use of threads.
Wanted to check if others are seeing it too. It seems 5-6x slower than a laptop cpu core
Hi, I'm trying to submit a C agent, this is my main.py
from subprocess import Popen, PIPE
def main(obs):
print("Starting main", obs.board)
process = Popen(['./main.out', obs.board], stdout=PIPE)
stdout, _ = process.communicate()
return stdout.decode('utf-8').splitlines()[-1]
But the submission errors out before running the validation game, this is the error I get
[
[
{
"duration": 0.001298,
"stdout": "",
"stderr": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 44, in get_last_callable\n code_object = compile(raw, path, \"exec\")\n File \"/kaggle_simulations/agent/main.py\", line 1\n PK\u0003\u0004\u0014\n ^\nSyntaxError: invalid syntax\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 169, in act\n action = self.agent(*args)\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 135, in callable_agent\n agent = get_last_callable(raw_agent, path=raw) or raw_agent\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 65, in get_last_callable\n raise InvalidArgument(\"Invalid raw Python: \" + repr(e))\nkaggle_environments_chess.errors.InvalidArgument: Invalid raw Python: SyntaxError('invalid syntax', ('/kaggle_simulations/agent/main.py', 1, 1, "
}
]
]
It's apparently something to do with my python file? I compress both main.py and main.out in a bot.7z file
bot.7z
- main.py
- main.out
I can't see what I'm doing wrong
People have reported not being able to use 7z. Instead, gzip a tarball, and it should work.
Also, note that the file name in the actual Kaggle environment can’t be relative like you expect with ./main.out.
Yes, I've found out about .tar.gz but been struggling with my main.out not being found since then. What's the expected path I should use?
Thanks a lot
CPU specs your submission is being run on:
5 MiB of RAM**
Dedicated CPU: a single 2.20GHz core
So yeah, submission will run slower, on Kaggle, than on somewhat recent laptop
/kaggle_simulations/agent/{yourengine}
There are some examples of submitting C, under Code in competition: try them out first and maybe make modifications to them after, as per your goal/algorithm
Wait, you mean compressing stockfish's nnue or making your own micro nnue?
Compressing stockfish bignet NNUE
Oh then no. I think training your own smaller nnue would be a better apporach no?
Look at this btw: https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/551257
In fact I dont think its possible
I wonder how many of the teams in the top 20 are hardcoding for the 8 openings used in the dev phase leaderboard
I dont think that many actually. It doesnt matter that much anyways
i doubt that a single person does that it insanely useless and dumb
because of how insanely dumb it it, I'm guessing at least a few people are doing it LOL
The 1st place team has been pretty consistent for the past few weeks, I wonder what they're doing differently than everyone else
Are they combining MCTS + NNUE ?
Are custom bitboard functions more efficient than ChessNut library ?
They are simply repeating the same methodology that anyone would do for engine development.
Can't we use stockfish engine ?
Do you mean OpenBench?
openbench, fishtest, playing local games with cutechess/fastchess/c-chess-cli, whatever.
there is a very clear, already beaten path, to iteratively improving a chess playing entity.
However, based on the leaderboard, I only thing two teams are actually doing it.
The rest are just varying degrees of chopped up SF, some doing a better/worse job than others, IMO.
in the current state of the competition the "conventional path" is overrated and perhaps not worth the effort
if you are at the point where you need to test for fine grained changes then you should already be placing very very high (roughly be in contention for 1st place i'd say)
most well performing teams are (presumably) (allegedly) (mere speculation) using SF
Atom said discussion he had stripped down all versions of stockfish to try them for the competition😭
well, you can't blame partecipants for going with the most obvious route
given the constraints there isn't much in the way of ideas that isn't covered by tradtional engines and given the lack of constraint using the best engine you can get your hands on makes sense
have to start somewhere. starting with sf beats every other starting point. foolish not to. even if you rip much of it away and add more in
surprisingly enough, last we tested.. the (8 openings) "book" almost didn't compress a progression test Elo gap obtained on a lichess UHO books..
I suspect it might be due to how weak the engine is compared to a top modern chess engine.
that being said, I wish more openings would be added anyways
if this is the complaining about things moment i'd really like 1mb less of ram and increments
and if i'm allowed to dream BayesElo wouldn't be terrible
I believe we have increments now.
At least, my only update to Ethereal in a month is that, after it was posted about having been changed.
A long with the 6m. "Temporary" ram limit
the last announcement i'm aware of is this https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/551050
which introduces the extra ram and doesn't mention real increments
you might be thinking of the 3fold change
or i'm just working off of outdated info
anyone tried/trying Sunfish NNUE version ??
It's impossible to fit without making your own nnue arch
Why though sunfish one is just 1.2kb pickle file for model weights
sunfish is incredibly weak
if you're going to take a pre-existing engine, just do what the people at the top of the leaderboard are doing and take stockfish/cfish/etc and strip them down
maybe he just wants to learn, because winning against full on cracked chess engineers is not that realistic, specially at this point of the competition
to learn, the best way is to forget about the competition, and just begin your engine dev journey.
Your first step is PERFT completeness 🙂
I'm trying to submit multiple files ... zipped 48kb ... contains main.py and model.pkl ... but I keep getting validation errors
[[{"duration": 0.001201, "stdout": "", "stderr": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 44, in get_last_callable\n code_object = compile(raw, path, \"exec\")\n File \"/kaggle_simulations/agent/main.py\", line 1\n PK\u0003\u0004\u0014\n ^\nSyntaxError: invalid syntax\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 169, in act\n action = self.agent(*args)\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 135, in callable_agent\n agent = get_last_callable(raw_agent, path=raw) or raw_agent\n File \"/usr/local/lib/python3.10/dist-packages/kaggle_environments_chess/agent.py\", line 65, in get_last_callable\n raise InvalidArgument(\"Invalid raw Python: \" + repr(e))\nkaggle_environments_chess.errors.InvalidArgument: Invalid raw Python: SyntaxError('invalid syntax', ('/kaggle_simulations/agent/main.py', 1, 1, "}]]
Code looks like this
` with open("/kaggle_simulations/agent/model.pkl", "rb") as f:
print("Starting model load...")
model_state = pickle.load(f)
if isinstance(model_state, dict):
model.load_state_dict(model_state)
else:
model = model_state
print("Model loaded successfully!")
except Exception as e:
print(f"Error loading model: {e}")
return model
model = load_model()
model = model.to(device)
model.eval()
def chess_bot(obs):
"""
Chess bot using the simplified board representation.
Returns the best move in UCI format (e.g., 'e2e4').
"""
# Get FEN and color from the board
fen = obs.board
`
got similar error
Maybe this will help. Read in, https://www.kaggle.com/code/bovard/your-first-chess-bot,
Here’s the streamlined general approach:
1. Upload Data: Prepare your data and create a private dataset on Kaggle.
2. Access Data: Use the dataset path (/kaggle/input/...) in your notebook to load and use it.
Done! Simple and direct. 😊
Now I just get this error [
Let's start more simply. What Are you trying to acheive, exactly?
https://www.kaggle.com/competitions/fide-google-efficiency-chess-ai-challenge/discussion/548061
tar -czf KaggleSubmission.tar.gz main.out main.py
It do be as simple as following that post.
If not running a binary, then you now see the import/untarball structure.
submitting my agent. My compression has two files main.py and model.pkl ... of size 48kb ... I load the pickle file in the main file like this
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def load_model():
import sys
# Register the class in the main module
sys.modules['__main__'].NeuralNet = NeuralNet
model = NeuralNet()
try:
with open("/kaggle_simulations/agent/model.pkl", "rb") as f:
print("Starting model load...")
model_state = pickle.load(f)
if isinstance(model_state, dict):
model.load_state_dict(model_state)
else:
model = model_state
print("Model loaded successfully!")
except Exception as e:
print(f"Error loading model: {e}")
return model
model = load_model()
model = model.to(device)
model.eval()
so, you've pickled the weights for you NeuralNet, i'm imagining? Or am i off as to your strategy?
yes. I've pickled the weights for the neuralnet ... then I compress the files... and upload
excuse me guys theres a Stockfish_ubuntu model in kaggle but i m unable to use it in a notebook
its saying permission denied
So what I' saying is your code in submitted file might be able to read a file from your personal kaggle directory. That file would be a python file that just contains the weights. Submission file would not be bloated by them, and if amounts of wieghts suffiecientl small, would not go beyond 5MB ram limit.
Submitted code would access weights at runtime, and plug these into neural net
The 64kb limit bites. I get why: build a minimal system; but it bites, imho
Not entirely sure why, but it seems you are running into this problem, From the Competition overview page,
works properly is a bit vague, but perhaps it is things such as trying to make illegal moves for a piece, etc.
my agent logs is not helpful...
ok n i m gettting
timeout most probably
I think that means that your program has exceeded the RAM limit.
i think its just time out cause its slow
OK. It's telling you Validation Episode failed, for your failed submission. Figure out how to get one that doesn't fail, to get over this hurdle. Relax. Until final date to submit, you can submit imperfect solutions. During last days of competition, leaderboard is reset, and submissions are locked.
RAM limit is limit to how much info the running program can load up. Speed is CPU processing power
story of my life
It is unrealistic to develop a complete and innovative chess engine within two months. From this perspective, this competition is actually tailored for current chess engine developers. However, based on the current situation, it seems that not many chess engine developers are willing to spend time participating. Is there any specific reason for this? For example... difficulties with debugging?
10k prize money is not very much, if you are talking about employed software developers in the US.
There is also not particular utility in the results. As soon as this ends, every dev will rm -rf their working dir.
It should be around 30-40k
having to cut to pieces and stitch someone's else work isn't what most devs like doing
and the way the competition is structured doesn't leave much space for not doing that, unless you are willing to work at a severe disadvantage
it's more an excercise in compression and code rewriting compared to actually improving on modern day chess engines, it's just boring
I wish fide could still hear upon this n increase the prize to appreciate real innovation
you could have 1m as the first prize
(but i g there's no way to give feedback to them like they improved a Lil bit Ram constraints)
and it would still be about cloning sf and cutting down its search
more money means more partecipation but not more innovation
Yeah no point if they want to ve better engine than sf
you'd have to either accept the fact this is about nnue engines, and force everyone to use the same default one, or make things very interesting and cut down on ram so much there's no chance to fit SF
1MB or less
I'll still fit SF in 1Mb ngl
and it's possible ?
I mean, it won't be functionally equal, but it would be something.
at that point the work you'd have to do is equal or more taxing than doing something from scratch
but all of giuseppes points holds. Why do I give a hoot to work on some random code base thats not mine
but ig the only real solution is moving onto Ataxx
chess is flawed because the design space is incredibly well explored, that's all
The text of the competition points out quite clearly that FIDE was unaware how explored it was.
fwiw my preferred solution would be having a base engine and then it all becoming about NNUE, it makes more sense in the context of a ML competition
Yes, they'd have greatly benefitted from consulting with an actual dev prior to this
Yup.
NNUE training only event would be intersting. You would get some competition about novel archs paired with novel compression techniques.
What about ensemble of sf n alphazero
a mcts engine with 5mb of ram total? and 64kb of space? no
alphazero is dogwater in comparison to modern engines.
A0 loses to the top submissions of this exact competition
let alone "unrestrained" modern top engines
Little bit of free money, probably for a handful of chess devs for very limited amounts of work, and thats about it. Its a net good, but its not all that much to write home about.
it is overall a net positive for an hobby that is notoriously populated by people starving for hw, and i think something interesting might come out of it, so it's definitely not all bad
thanks fide, if you ever want to do a nnue only one i'm available as a consultant.
Im struggling with slow code execution, ** get_moves** and apply_moves are the slowest to execute, is there a way to use another faster function too get legal moves and then apply moves, Can I use another chess engine, like** Chess** instead of** Chessnut**?
It might not be of much improvement most probably u d need to use some c/c++ engine
I think you can only import Chessnut in python, unless you want to get a library inside your 64Kib limit, I am not sure though
Thanks
Thanks
@dire pond , A possible solution: Refined Mobility Maps
The refined mobility map is a crucial concept for determining where a chess piece can move, factoring in the constraints of the current board state. This process (below) is computationally efficient and involves two primary steps:
Step 1: Generate the Unrefined Mobility Map
• What it is:
• A precomputed lookup table for each type of chess piece.
• Contains vectors representing all potential moves a piece can make, unrestricted by obstacles.
• How it works:
• For a piece at a given square, retrieve its possible move vectors based on its movement rules (e.g., a bishop’s diagonal paths).
• This map assigns a value of 1 to squares the piece can potentially move to and -1 to all other squares.
Step 2: Calculate the Refined Mobility Map
• What it is:
• A dynamically calculated map that modifies the unrefined mobility based on the board state.
• How it works:
1. Iterate through each vector from the unrefined map:
• For example, a rook’s horizontal or vertical movement vectors.
2. Determine constraints along each vector:
• Stop if a friendly piece is encountered.
• Include a square if it contains an opponent’s piece but stop further exploration along that vector.
• Respect the edges of the board as natural boundaries.
3. Assign refined values:
• Replace -1 with 1 up to the constrained index along each vector.
Optimization of the Algorithm
• Initial State:
• Start with a 64-dimensional vector for the board, initialized to -1 values.
• Efficient Processing:
• Use the unrefined map’s vectors as guides, reducing unnecessary checks.
• Dynamically calculate the refined mobility by:
• Iterating over the vector only until a constraint is met.
• Minimizing operations by leveraging precomputed patterns.
• Final Output:
• A refined 64-dimensional vector, with 1 values marking the squares the piece can legally move to and -1 elsewhere.
The system assumes all values for 64 dimensional vector are -1. It determines where to add ones, based on a piece vectors. It includes just the ones that are legal moves.
Have you found a solution to this? I've been having the same issue. Only the Replay has any data to analyze but it doesn't look like the replay information is good for debugging the error.
try clicking on "Agent 0 logs" you must something like this: [[{"duration": 0.341105, "stdout": "Elapsed time: 0.3017001152038574\nbest move= d2d4\n", "stderr": ""}],
[{"duration": 0.348884, "stdout": "Elapsed time: 0.3420417308807373\nbest move= b1c3\n", "stderr": ""}],
[{"duration": 0.333992, "stdout": "Elapsed time: 0.3260173797607422\nbest move= c3a4\n", "stderr": ""}],
[{"duration": 0.345103, "stdout": "Elapsed time: 0.3381059169769287\nbest move= a2b3\n", "stderr": ""}],
[{"duration": 0.443004, "stdout": "Elapsed time: 0.43607473373413086\nbest move= a4c5\n", "stderr": ""}],
[{"duration": 0.418567, "stdout": "Elapsed time: 0.41050052642822266\nbest move= c1f4\n", "stderr": ""}],
[{"duration": 0.485729, "stdout": "Elapsed time: 0.47602176666259766\nbest move= b3b4\n", "stderr": ""}],
[{"duration": 0.421666, "stdout": "Elapsed time: 0.41419196128845215\nbest move= a1c1\n", "stderr": ""}],
[{"duration": 0.411412, "stdout": "Elapsed time: 0.4040870666503906\nbest move= c5a6\n", "stderr": ""}],
[{"duration": 0.340503, "stdout": "Elapsed time: 0.33300304412841797\nbest move= a6c5\n", "stderr": ""}],
[{"duration": 0.903928, "stdout": "elapsed: 0.9038302898406982\n", "stderr": ""}]]
Nope, for my situation both agent0 and agent1 logs were empty. I can check some other runs, but they either contained « [« or « [] »
try to include print ('something') for debugging purpose like print (bestmove or time), it might appear in Agent Logs.
Lol
Pretty possible
yo
if i get timeout as a message on the very first move does that mean that im OOMing
or is another error being thrown for OOM
my submission plays fine when i run it on a kaggle notebook but it doesnt seem to play a single move in the validation test
it just times out
Yes, timeouts can indicate RAM limit issues.
10k is a large amount for underpaid software devs in the US, not so much for the fairly compensated ones though
https://money.usnews.com/careers/best-jobs/software-developer/salary
lower quartile salary in the US $96,790. 10k becomes 5 weeks worth of work.
Not to mention that your 10k winnings are < 5k post-tax.
I think I probably spent around 20 hrs at this point for Kaggle. So for that investment, 10k is great. $500 an hr. But to invest another 80 hrs? 180 hrs? yuck.
probably the competitive part plays into it also, some try to make the most of it if they are already in a competition
for me personally as someone who is involved in chess engines if I wouldn't know I would score good I probably wouldn't have submitted
others might do it for fun or probably as an opener to chess engines world
I think that my teammate already got into chess engine development because of a previous "similar" competition on youtube
Many Kaggle competition participants are not in it for the money; if they were relying on the prize money to live, they'd have starved by now. Most people are in it just for fun or learning. For this competition, developing a chess engine sounds pretty cool to those who haven't been involved in this field.
Yeah I don't disagree with that. The question I responded to originally was "why are engine devs not interested". And for them, its a drag-and-drop for their existing hobby, with marginal gain.
NNUE compression alone would be more interesting
lobotimizing Stockfish is much less interesting
We've expanded the possible opening positions to include 2000 different openings! This will be the set used during the final evaluation unless there are significant bugs or issues.
I think there is an issue here, if the set is the same one as the final one because pre-prepared book moves and hardcoded solutions would emerge..
although it could still be very hard to achieve...
Guys quick question, what's better in terms of speed/ram. a subprocess from the main python script, or an imported extension module?
Or if there's a third option please do let me know
Maybe yes~ recording 10 to 20 steps would give a significant advantage, and the remaining code section can just use a simple search.
it was less of a comment about feasibility and more of a comment about the fact it would be terrible.
You can do it, it's gonna perform terribly at vstc, with those constraints, against nnue + a/b engines
Note that i'd absolutely love to be proven wrong and for the top 30 entries to not be all A/B + nnue
Hi, does someone know if it is better to input starpos <moves> or the fen directly?, at the start i feel just moves is better, but when there are like 100 moves fen would be better right?
How is this a good starting position DOWN A BISHOP😭 I think they got too unbalanced positions.. Stockfish rates it -4.8 lmao
depends on your 3fold logic, if you need the moves from the (presumably uci) command then you'll need the entire list
if not you can just parse the latest fen
the actual parsing of the moves itself from the command isn't (or at least shouldn't be) particularly taxing compared to everything else that goes on
Hello, where can I find the instruction how to use external modules in FIDE competition.I have to copy them to Kaggle? How? Thanks
Isn't just saving a board state and playing the moves as they come better?
if you can make it work and fit the same functionality in less space, sure, for performance it shoudn't really matter. In this scenario most people are reusing already existing engines and some of those engines might assume they get sent proper uci commands that include moves
What's the point of competing with something you didn't build?
other than potential prize money if it's actually good
for most people? having an entry with a chance to place at a decent spot
if 20 people re-use SF and you have to write something from scratch, your theoretical best placement is 21st
if 50 people re-use SF, well, good luck
erm
Well beginning with some SF clone can probably get you top 5 but there is a chance that the pain of being randomly getting excluded from top 5 because of random luck and unstable ranking would overweight it.
We have a +250 tracked commit on top some clone.
now imagine not starting from a ready-made engine but having to read up on how to write movegen, good luck competing against that
Well at the very least you can look up a good chess library for everything related to the game itself
most libraries are too big tho.. tailored functions would be needed eventually..
People try to remove dependancy on standard libraries
you can see SF as a library if you squint hard enough
In competitions hosted by communities like Kaggle, this kind of situation is inevitable. As a Kaggle user (like me), the goal is to "climb the leaderboard" using any legitimate means, and copying Stockfish (SF) might be the best approach. Of course, during this process, one is forced to learn a lot of knowledge. Personally, I believe that if you want to start developing your own chess engine, it's best to first become proficient at using someone else's engine.
Anyone who has successfully implemented NNUE? I’m working on ethereal and disabled the nnue and tbprobing but the engine is not performing well (elo 1600)
So you must have done something wrong. If you think the error is with NNUE/HCE, you can go back and cross-validate with an earlier version of Ethereal that hasn't implemented NNUE yet, to pinpoint where the issue is.
If you're not equal to my Ethereal on the leaderboard, then you did something wrong. Zero dev effort into my submission. Its ponder + Ethereal with minimal trimming to get the size down.
Unbalanced, yes, but why not?
Is pondering even that good in this tournament? Just waiting for the engine to stop pondering seems like a bigger disadvantage
- I don't know. I refuse to actually measure pondering elo values since its troll.
- This hardware / config is a real unknown. So lots of noise there.
- Does it really take that long to "stop pondering"? I don't think so.
- If you have a good ponderhit rate, then the stop comment is null.
- Strictly its gotta be > 0 elo right?
It will be a very likely outcome between top engines, like its almost useless I feel
Wdym waiting to stop? you can just interuppt it
Yes the environment is the main issue, also you mean ethereal with nn?
There is no public Ethereal NNUE. So yes I mean Ethereal HCE.
I don't understand :
It will be a very likely outcome between top engines, like its almost useless I feel
"Does it make sense to include such unbalanced positions? Given the relatively small differences in engine strength among the top few hundred competitors, starting a game with such a disadvantage often makes the outcome almost inevitable. While unbalanced positions are often used in engine development to avoid draws, to my best knowledge they typically fall within a range of [-200, +200] centipawns. Positions like the one above fall far outside that range."
I thought that was in response to me.
Yeah I don't disagree. Although for the weak engines, + a bishop might not matter. So who is to say all openings should cater to the top of the board.
If they made it so the elo gain is affected more highly when losing/winning with an unbalanced starting position it can be a trick to speed up the tournament and discern the top from the rest
Well I feel bad for someone trying to get top 5 and on an error and an unlucky loosing streak varying >50 elo, which is a lot of positions due to close strength between the top engines
Game-pairs are played ( in theory ), so it just becomes a drawn pair, and its fine. It just compresses the result a bit.
However, I notice often that 1 but not both of the games error out on both sides. If that occurs, then there are problems. But Its unclear if that will get fixed before all is said and done.
So you are wrong, but also right.
I dont feel more variation is better, and I think they run the engines for two weeks anyways, not sure thiugh
at the rate things are going I dont think so, the ram and time I think have not been modified yet..
This unbalanced starting position can cause trouble if the positions chosen for games are random, someone getting that position more often is more likely to draw the match (1-1), which can either boost him down or up unfairly from his real level
Overall, i don't think it matters that much either way
RAM has def been modified. people are claiming to use > 5MB without dying. So the 6MB is the new limit. Although unclear if KAggle will rugpull at the end and drop to 5, killing those people.
This is precisely why I don’t like it though
Because you are just trying to add a bunch of hacks to make Stockfish stronger at short time controls by sacrificing LTC+ performance which doesn’t really translate into true improvements to Stockfish
If you make a competition for a domain that has zero already established best practices ... then maybe no one will care in the first place. So its almost inevitable that any competition results in tinkering on-top of state of the art practices.
I think it's impressive that atom123 was able to reach top 5 without having worked on chess engines before- we have similar approaches to this competition but I only reached 8th place at best, and now dropped to 20th place since I haven't found any improvements over the past few weeks of tinkering, although I have found many different ways to break the chess engines

