Can neural networks implement genuine algorithms or only statistical pattern matching?
This explores whether neural networks actually run step-by-step procedures the way code does, or whether they only recognize and replay patterns seen in training — and the corpus turns out to have evidence on both sides, plus a reason the distinction is so hard to settle.
This question — genuine algorithm vs. statistical pattern matching — sounds binary, but the collection suggests the honest answer is "it depends what the architecture is built to do, and the default behavior leans toward pattern matching." The starkest evidence for the skeptical view: when researchers ask LLMs to actually *run* an iterative numerical method in their latent space, they don't. They recognize a problem as looking like ones they've seen and emit a plausible-but-wrong answer, a failure that doesn't go away as models get bigger Do large language models actually perform iterative optimization?. The same pattern shows up in reasoning: transformers that look like they're composing rules are often just matching memorized computation subgraphs, which is why they collapse on novel combinations even when each individual step is something they've handled before Do transformers actually learn systematic compositional reasoning?.
But the corpus refuses to let that be the whole story. Pruning experiments show neural networks *do* spontaneously carve compositional tasks into modular subnetworks — isolated little subroutines where ablating one only breaks its corresponding function, with pretraining making this structure more reliable Do neural networks naturally learn modular compositional structure?. That's closer to genuine algorithmic decomposition than to a lookup table. And architecture matters enormously: the Hierarchical Reasoning Model, by coupling slow planning with fast computation across two timescales, solves Sudoku and mazes that chain-of-thought completely fails — explicitly escaping the AC0/TC0 complexity ceiling that limits what a fixed-depth transformer can compute at all Can recurrent hierarchies achieve reasoning that transformers cannot?. So part of what reads as "can't do algorithms" is really "this particular architecture lacks the computational depth," not a law about neural networks as such.
Here's the thing you might not have known you wanted to know: the gap between memorizing and computing can be invisible from the outside. The Fractured Entangled Representation work shows two networks can produce *identical outputs on every input* while having radically different internal structure — one clean and modular, one a tangled mess that can't transfer or recombine Can identical outputs hide broken internal representations?. Standard benchmarks simply cannot tell them apart Can AI pass every test while understanding nothing?. So a model could be pattern-matching its way to a perfect score and you'd never see it from accuracy alone — which is exactly why the "genuine algorithm?" question resists a clean test.
There's also a quieter lesson about why raw expressiveness isn't the same as actually learning an operation. In theory an MLP can approximate any function, including a simple dot product — but in practice, carefully tuned dot products beat learned MLP similarities, because the MLP needs absurd capacity and data to recover a structure that geometry hands you for free Can MLPs learn to match dot product similarity in practice?. The takeaway across these notes is that inductive bias and architecture decide whether a network computes or merely interpolates — which is why a few notes pursue *building in* the missing machinery: hybridizing lookup with computation Can lookup memory and computation work together better than either alone?, stacking depth so abstractions compose through layers Does depth matter more than width for tiny language models?, or even letting an outer-loop system autonomously discover genuinely new algorithms its inner loop couldn't Can an AI system improve its own search methods automatically?.
So: not a binary. Vanilla transformers default to sophisticated pattern matching and hit hard computational ceilings, but the right architecture can give networks real algorithmic depth — and the unsettling part is that benchmarks can't reliably tell you which one you've got.
Sources 10 notes
Research shows LLMs cannot perform iterative procedures in latent space. They recognize optimization problems as template-similar and emit plausible-looking but incorrect values, a failure mode that persists across model scale and training approaches.
Research shows transformers succeed on in-distribution tasks by memorizing computation subgraphs from training data, not by learning systematic rules. They fail drastically on novel compositions, with errors compounding across reasoning steps.
Pruning experiments reveal that neural networks implement compositional subroutines in isolated subnetworks, with ablations affecting only their corresponding function. Pretraining substantially increases the consistency and reliability of this modular structure across architectures and domains.
The Hierarchical Reasoning Model couples slow abstract planning with fast detailed computation across two timescales, achieving near-perfect performance on Sudoku and mazes where chain-of-thought methods fail completely. With only 27M parameters and 1,000 samples, HRM escapes the AC0/TC0 complexity ceiling that constrains fixed-depth transformers.
Networks trained with SGD reproduce outputs perfectly while having radically different internal structure than evolved networks, with weight perturbations revealing fractured, entangled representations that prevent transfer to novel contexts or creative recombination.
The Fractured Entangled Representation hypothesis shows that SGD-trained networks can produce identical outputs across all inputs while maintaining radically different internal representations. Standard benchmarks cannot detect this structural difference.
Rendle et al. show that carefully tuned dot products substantially outperform learned MLP similarities in collaborative filtering. MLPs require excessive capacity and data to match simple geometric similarity, and they cannot be efficiently retrieved at scale—proving inductive bias matters more than expressiveness.
Engram combines O(1) N-gram lookup with Mixture-of-Experts routing, revealing a U-shaped scaling law where balanced allocation to both mechanisms outperforms either alone. Gains appear largest in reasoning and code rather than pure retrieval.
MobileLLM shows deep-and-thin architectures yield 2.7–4.3% accuracy gains over balanced designs at 125M–350M scale by composing abstract concepts through layers rather than spreading parameters across width.
An outer loop successfully read inner loop code, identified bottlenecks, and generated new Python mechanisms at runtime, discovering combinatorial optimization and bandit methods that broke the inner loop's deterministic patterns and improved performance on GPT pretraining by 5x.