The million-dollar question
Imagine a friend tips a 1,000-piece jigsaw puzzle onto the table and asks you to finish it. There goes your weekend. Now imagine they show you a completed one and ask whether it’s right. You glance over it. No gaps, no awkwardly fitting pieces, and the picture matches the box. Ten seconds is all it takes.
This gap between checking an answer and finding one sits at the heart of a famous open problem in computer science: P versus NP. Roughly speaking, P is the set of problems a computer can solve quickly. NP is the set of problems where, if someone gives you a proposed solution, you can check it quickly.
Every problem in P is also in NP, because if you can solve something fast you can certainly check it fast. The question is whether the reverse holds. Is every problem that’s easy to check also somehow easy to solve? If P = NP, then cracking passwords, scheduling airlines, folding proteins and proving theorems might all collapse into tasks no harder than checking a completed jigsaw puzzle.
Most computer scientists suspect the answer is no. Finding a solution really is harder than checking one. But nobody has proven it, and the Clay Mathematics Institute is offering a million-dollar prize to whoever does.
Hold that thought while we take a moment to talk about AI.
How a language model learns
A large language model like ChatGPT or Claude starts life as an elaborate guessing machine. During pre-training it reads an enormous amount of text and code from the internet and plays a simple game over and over again, predicting the next word from the words seen so far. Each time it guesses wrong, it nudges its internal weights slightly towards the right answer.
After trillions of these guesses, something surprising happens. To predict text well, the model has to absorb grammar, facts, writing styles and a fair amount of reasoning. It doesn’t so much memorise the internet as compress it into a model of how ideas fit together in language.
Then comes fine-tuning, where the model is shown example prompts with their ideal answers, and its responses are compared against them. This turns the raw text predictor into something that behaves more like a chatbot or coding assistant. The beginnings of intelligence.
The result is impressive, but notice what it is at its core. A model produces a plausible answer in a single pass, one word at a time, without going back to check its work. It’s a brilliant improviser. But even brilliant improvisers will get things wrong.
Harnesses, loops and graphs
Here’s where things get interesting. Increasingly, we don’t use a model on its own. We wrap it in a harness, a bit of ordinary software that calls the model, takes its output, does something with it, and calls it again.
The simplest harness is a loop. Ask the model to write some code. Run the code against a set of tests. If a test fails, hand the error message to the model and ask it to try again. Repeat until everything passes. This is, more or less, how today’s AI coding agents work.
From there you can build more elaborate structures. A graph of steps might have one model propose a plan, several others attempt different parts of it in parallel, a checker reject the weak attempts, and a final step stitch the threads together. Each node is a model or tool call, and each edge is a decision about what to do next.
Now look at what makes the loop work. The model doesn’t need to get the answer right first time. It just needs to be right occasionally. As long as something can reliably tell the good attempts from the bad ones, it will make progress. It’s the tests doing the heavy lifting.
That gives us a rather striking principle: any problem whose solution can be verified quickly can, in principle, be solved this way. Generate, check, repeat. Given enough attempts, a decent guesser plus a fast checker can grind its way to a correct answer.
This should sound familiar. “Easy to check, hard to find” is exactly the definition of NP. A harness is a machine for turning a fast verifier into a solver. It doesn’t make the hard problems easy (the guessing can still take an astronomically long time), but it means that for any problem a model can verify, it can at least chip away at finding a solution.
Baking the loop into the model
Harnesses improve a model at inference time. The current big trend in AI is to push the same idea back into training, using reinforcement learning.
The recipe looks a lot like our loop. Give the model a problem, let it work through a long chain of reasoning, check the final answer, and reward it when it’s right. Over millions of problems, the model learns the kinds of reasoning steps that lead to correct answers, often helped along by a handful of examples from human experts. Much of AI’s progress over the past several years is a product of this approach.
But, once again, everything hinges on the checker. Reinforcement learning needs a reward signal, and that signal has to be cheap enough to compute millions of times. That’s why progress has been fastest in mathematics and programming. A maths answer can be compared against a known result, and a program can be tested. Both checks are quick.
Not every task needs a perfect yes-or-no. A solution that can be scored quickly is often enough, whether by a rubric, a simulation or another model acting as judge. But the further you drift from clean verification, the noisier the signal and the easier it is for a model to learn to please the grader rather than solve the problem.
Some of AI’s most striking wins have come exactly where checking is cheap. DeepMind’s AlphaFold learned to predict the shapes of proteins, with every guess scored against structures scientists had already measured in the lab. The work earned its creators a share of the 2024 Nobel Prize in Chemistry.
Mathematics has followed the same pattern. AI systems have recently started cracking genuinely hard problems, often with their proofs checked by programs like Lean, which verify every step of an argument mechanically. At its core, a vast generate-and-check loop, with a computer program as referee.
So what we can check, AI can learn. What we can’t check, it struggles with. Researcher Jason Wei calls this Verifier’s Law. In short, how easily AI can learn a task depends on how easy it is to check its answers.
When the checker is the real world
All of this works beautifully when the checker lives inside a computer. Physical AI is a different story. For a robot, checking an answer means actually trying it, whether that’s picking up a coffee cup, driving around a corner or landing a drone. In the real world that’s slow, expensive and often dangerous. You can’t let a car swerve a million times to learn which swerves end badly.
The obvious workaround is simulation, where a robot can practise millions of attempts without leaving the safety of the computer’s memory. But now the verification is slightly off. Simulators can’t capture every bit of friction, flex and sensor noise, so a model can learn policies that work in the simulation and fail in reality. Researchers call this the sim-to-real gap, and it’s closely related to learning to please the grader.
The situation isn’t hopeless, however. Training in simulation with lots of randomised physics has worked surprisingly well for things like legged walking. But delicate tasks like handling everyday objects remain much harder, and this is where today’s verification loops are at their weakest.
So, in AI, does P = NP?
The title of this article is a bit cheeky. In computer science, P versus NP is posed with far more precision. It’s about how running time grows with the size of the input, measured on idealised machines, with technical definitions of what “quickly” means. Nothing in a coding agent or reasoning model comes close to deciding the P versus NP question, and nobody should be claiming the million-dollar prize just yet.
But the analogy points to something real. Modern AI is getting very good at problems where a good answer can be checked quickly, even if it’s hard to find. Harnesses exploit that at run time. Reinforcement learning exploits it during training. In both cases, the model and the verifier work as a team.
A practical open question remains. What category of problems can AI effectively learn to solve? Is it everything we can check? Will better simulators close the sim-to-real gap and let robots learn as quickly as chatbots? Can clever scoring stretch that to tasks where “correct” is fuzzy, like good writing, sound strategy or wise judgement? And what lies beyond, the problems where we struggle even to recognise a good answer when we see one?
We don’t have the full picture yet. But if you want a rule of thumb for where AI will improve next, look for places where verification is accurate and cheap. The missing pieces of the puzzle, for now, are the ones we can’t easily check.



Nice article Stephen. I think the reason even in AI, P != NP is because both harness and reinforcement learning are NOT running in polynomial time. If you take the amount of data the LLMs are storing and processing, it is not even clear if these AI agents are running in polynomial space!