r/AskComputerScience • u/Spongebubs • Aug 20 '26
Could an LLM "reason" faster than a "slow" (non-polynomial) algorithm?
I'm not sure how to articulate this, so bear with me.
If there was an NP complete problem, would it theoretically be possible for an LLM to "reason" an answer that would scale polynomially with number of tokens? For example, a 9x9 sudoku could be solved with 1M tokens, a 16x16 sudoku could be solved with 2M tokens, 25x25 solved with 4M tokens, etc.
Ever since the Jacobian Conjecture was disproven, it got me thinking. An algorithm would have been too slow to find a counterexample, but an LLM was able to "reason" a counterexample. Why couldn't an LLM "reason" a solution to NP complete problems too? Wouldn't this imply that P=NP?
Apologies if this is a naive thought process. Thanks!
EDIT: Follow up question - If it was somehow proven that P != NP, then would that imply that AGI/ASI could not exist? That it is impossible for a non-hallucinatory, 100% deterministic, 100% correct LLM to exist?
17
u/nuclear_splines Ph.D Data Science Aug 20 '26
LLMs are predictive models that yield likely text. If they produce what's likely a solution to Sudoku, but sometimes hallucinate or make fundamental errors, then that's not a polynomial solution, but a polynomial heuristic. We can often make fast approximations to problems that either get the right answer most of the time, or get close to the right answer all of the time.
1
u/Dangerous-Quality-79 Aug 20 '26
I am slightly confused by a few things you mention.
First, a "token" is not a specific unit, but rather changes based on the model and design. So scaling tokens does not really work that way. It could work that way, but designing an algorithm that scales tokens that way would be... weird. Improvements to models come with larger training data, parameter tuning, and number of nodes in the network. How things are tokenized does have an impact, but not as you describe it.
Second, LLMs are large language models, they output statistically probably answers based on training data. If you watch the video of the guy asking the LLM to time how long he runs a mile then says start and stop a second apart the LLM tells him a much larger number. Because the trained answer to the question is usually a larger number so it is statistically more likely to be correct. Some companies are add "tools" that the LLM can invoke to solve things not designed for an LLM like image generation.
Third, I do not understand the edit about AGI and P != NP. Artificial general intelligence is simply having a computer match human intelligence. If we forget about a computer for a second and have 2 people talking, one says what the primes numbers that equal 77 (okay, 77 easy, but imagine more complicated. It will be harder than asking if 7 x 11 equals 77. So we do not need P = NP to surpass human intelligance because P = NP is a human problem. Proving P = NP or P != NP is not required for AGI. Same goes for ASI.
2
u/ghjm MSCS, CS Pro (20+) Aug 20 '26
In addition to the good points others have made, I think it's worth noting that:
So if the question is, can an LLM converge on an algorithmic process that is known to be impossible through writing normal code, then the answer is no. LLMs are bounded by the same theoretical limitations as any other form of algorithmic language.
And as others have said, nothing in CS theory prevents you from getting lucky and finding a solution early. If you're trying to factor some 100-digit number, it could be that all its factors are single-digit primes and you're done in a few seconds. You just can't count on that happening if you're trying to prove the properties of a general-case algorithm.
1
u/apnorton Aug 20 '26
The algorithms we're talking about for P vs NP are deterministic and must always return correct answers. A large part of the strength of LLMs comes from their "fuzziness," yet this also comes at a cost of not being correct all the time.
If you were able to show that an LLM that took polynomially many steps to always return a correct answer to a certain NP-Complete problem in a deterministic way, then yes, you would have shown P = NP.
Fuzzy search for counterexamples that prunes "unlikely" paths to find solutions faster than a total search has been around for decades; this is more-or-less an evolution on that same concept.
1
u/SufficientStudio1574 Aug 20 '26
An LLM is an algorithm. As long as P != NP remains unproven, it is of course theoretically possible to discover a fast algorithm, and maybe that algorithm would be an LLM. It's extremely unlikely though.
1
u/thesnootbooper9000 Aug 20 '26
Neutral networks can't unless P=NP. However, modern LLMs can use a constraint programming solver as an agent if instructed correctly, and those solvers can do Sudoku in far fewer steps than you would expect. This isn't a P=NP thing, just that to generate actually-hard-scaling Sudoku puzzles for these algorithms requires astronomically large inputs.
1
u/donaldhobson Aug 23 '26
It's possible that P=NP. It hasn't been disproved yet. It's possible LLM's have an algorithm.
Most likely, it's doing https://xkcd.com/3026/
Computational complexity is defined in terms of the worst case. So it's likely that LLM's have a bunch of tricks that only sometimes work.