How to Build an AI Math Compiler from Scratch?

preview_player
Показать описание
One of the big challenges in AI is synthetically generating math data including the reasoning steps to train large language models such as GPT, Llama3.1, Mistral.. Only with reasoning can you truly train the model. In this video Chris shows how to generate a synthetic dataset using generative ai for math using his new AI math compiler, which accurately returns questions, answers and step by step explanations.. This seems to be a similar technique to Google Deepmind used with Alphaproof and maybe how OpenAI synthetic data generation with Q* or Project Strawberry. If you wish to understand synthetic data generation for ai models or even how compilers work, this is the video for you.

To get accurate results for the step by step explanations, chris couldn't rely on Large Language Models LLM's generating the wrong data, so he had to build a math compiler that could reliably produce the result and the explanations. This is a true compiler with tokenizer, parser, abstract syntax tree and instruction emitter. Instead of emitting assembly instructions however, it natural language prompts. This is a pretty unique technique in the open source world. The compiler also produces explanations. The final trick is to use an LLM such a mistral-nemo to prettify the output into a human readable form.

The code is available here:
Рекомендации по теме
Комментарии
Автор

I don't have time to go through the whole video at this specific moment, but it seems to me that you came to a fairly similar answer to myself: LLMs are pretty strong at presenting data and handling noisy inputs, while traditional computer programs are pretty good at doing the math (numerical instability notwithstanding).

One obvious opportunity that I'm not seeing in the first ten minutes (though I'll certainly allow it's possible that I'll have egg on my face after finishing), is that this seems like an efficient way to embed agentic function calling into a model; if the steps to solve the problem contain a call to a remote system with the equation as an argument, and the remote system can solve the equation, that seems a lot like a function call to my eyes.

Beyond that, there's also probably some room to reverse engineer a problem with the synthetic generator LLM based on the equation and answer, in order to encourage semantic problem solving, as seen in certain benchmarks which have word problems encoding ideas best solved with mathematics.

Overall, this is a super cool project, and is probably going to be very beneficial for people doing continued pre-training or experimenting with certain ideas like grokking. I'm pretty excited to have a hack at it myself.

novantha
Автор

When you said "math" I thought you meant symbolic math, not arithmetic. Using an LLM to do arithmetic is pointless; a calculator does a far better job.

BlunderMunchkin