Anyone who’s used AI knows you can’t take what it tells you totally on trust. Bias, hallucinations and confident nonsense are par for the course.
That makes scientists cringe because they are accustomed to a more candid kind of prediction. A weather forecast comes with probabilities; an experimental result with error bars. The uncertainty does not make the result useless but tells us how much confidence we can place in it.
Could the neural networks of AI be made to do something similar? Researchers have been trying, but their methods struggle with the vast size of today’s networks.
A new preprint by my co-author Peter Coveney, director of the Centre for Computational Science at UCL, and Wouter Edeling of CWI, the Netherlands’ national research institute for mathematics and computer science, takes a step in that direction.
Their method does not make AI generally trustworthy, nor has it yet been shown to detect hallucinations in a chatbot. What it offers is narrower but important: a way to estimate how uncertainty in a trained network’s weights – the strength of connections between its ‘neurons’ - affects some of its predictions, without performing an impossible task, namely working out which among millions, billions even trillions of weights are the most important.
Three Flavours of Trust
To understand why that matters, it helps to start with a more conventional kind of computer model, and with one of the most consequential modelling exercises of recent history: predicting the COVID-19 pandemic.
Weather forecasters, scientists and engineers who build digital twins and plenty of others who rely on computer models, such as the COVID-19 pandemic modellers, have a well-established way to decide whether to trust their simulations, called VVUQ, or Verification, Validation, and Uncertainty Quantification.
Verification asks whether the equations have been implemented and solved correctly: “solving the equations right”. Validation asks how well the model represents the real system for its intended purpose: roughly, “solving the right equations”. Uncertainty quantification then asks how uncertainty in the assumptions, inputs and parameters affects the answer. That’s about working out how much a prediction could vary, given everything we don’t know precisely, such as the exact values of the numbers fed into the model, so you can put honest error bars on its predictions.
When a simulation passes muster on all three counts, it becomes “actionable”. You can trust it, within limits you understand, when it comes to making decisions.
How many parameters, exactly?
VVUQ was the tool of choice when the Royal Society, the venerable scientific academy, set up the Rapid Assistance in Modelling the Pandemic (RAMP) initiative in 2020. On its behalf, Peter and his colleagues put Imperial College London’s CovidSim simulation through its paces.
CovidSim, developed by Neil Ferguson and colleagues, was hugely influential. The UK government relied on it, in part, to shape its response to COVID-19 in March and April 2020, notably the shift towards suppressing the virus with lockdowns.
Unlike AI, CovidSim is what’s called a mechanistic model. Rather than learning patterns from data, which is how AI works, it’s built on understanding, in this case of how a disease spreads.
It creates a virtual population of individuals, placed according to high-resolution population density data, with ages and households, who meet each other at home, at school, at university and at work. The rules for how the virus passes between them are written as algorithms, a word that comes from the Latinised name of the Persian scholar Muhammad ibn Mūsā al-Khwārizmī (around 780 to 850), whose most famous book also gave us the word “algebra”.
Ultimately, success depends on understanding the processes by which a virus spreads, capturing them in mathematics and feeding the model good data, in other words data that’s timely, complete and accurate.
And what makes a model like this different from AI, Peter told me, is that every parameter in it means something. “In physics-based models, the parameters represent some kind of mechanism,” he said. “Here, it could be the efficiency with which the infection spreads. You don’t know that parameter unless you have some really fundamental theory, so it’s tunable, but at least it represents something mechanistic.”
The trouble is that nobody knows the exact value of every parameter. So the team represented each uncertain input not by one supposedly exact number but by a range of plausible values. They then ran the model thousands of times on the Eagle supercomputer at the Poznań Supercomputing and Networking Center in Poland, each time with a different combination of values drawn from those ranges, to see how that fog of uncertainty in the inputs affected the predictions.
CovidSim has a lot of parameters by the standards of mechanistic models. “Famously, I had to ask Neil Ferguson how many parameters he had, and he didn’t know,” Peter recalled. “I told him he had 940.” Peter’s team got that figure by simply counting every input the code uses. Many weren’t relevant, because CovidSim was adapted from an earlier model built to plan for pandemic flu, and some parameters, such as those for vaccination, weren’t being used for COVID-19 initially.
Even so, the team, working as part of VECMA (Verified Exascale Computing for Multiscale Applications), an EU project led by Peter, faced what’s called the curse of dimensionality. The possible combinations multiply so fast that even a supercomputer can’t explore all the permutations. “The off-the-shelf algorithms for uncertainty quantification haven’t been scalable,” Peter explained. “You can only wrestle with something of the order of ten parameters if you want a chance of doing enough sampling to get the probability distributions that tell you the uncertainty.”
So, with Wouter Edeling, they trawled through the parameters, worked out what each was doing in the model and, with advice from the Imperial team, focused on 60 that looked of most interest. “However, when we put the model through its paces and figured out how sensitive it was, only 19 dominated the predictions,” said Peter.
A systematic analysis then showed that just three of those 19 accounted for between half and two-thirds of the variation in the predicted death toll, depending on the scenario. One was the latent period, the stretch of time when you’re infected but not yet able to infect others. The second was the assumed effectiveness of social distancing. The third was the delay before a suspected case starts isolating.
What Did VVUQ Reveal?
CovidSim amplified the uncertainty in its inputs by up to a factor of three. In one scenario the team studied, the average of all those runs came out at almost double the death toll of the single, deterministic run that features in Imperial’s influential Report 9, while rare but possible outcomes were five to six times higher. And when the researchers compared the simulations with validation data, they found substantial bias: uncertainty in the parameters alone could not explain the mismatch.
That’s not a hatchet job: Report 9 never claimed it could forecast the death toll of the coming months. Its central message still stood: several measures had to be adopted together and that doing nothing would be disastrous. But the study showed that a single prediction is just one member of a much wider range of possible outcomes, and policymakers need to see the lot.
Knowing which parameters matter most also tells you where to invest your effort. “What you’re trying to do, first of all, is control the uncertainty and know what it is, so you can report it,” said Peter. “But afterwards, if you want to improve the model, you’ve only got a limited amount of time. We’re saying: these are the parameters you need more data on, or a better theory, to nail them down.”
Peter and Wouter have since done much the same for molecular dynamics, simulations of how atoms and molecules jostle and bind, where a model of a protein can easily involve hundreds or even thousands of parameters describing the forces between different kinds of atoms. In a 2024 paper, they used a far more scalable form of UQ. “If I have 100 parameters, it’s not going to be exponentially expensive in the number of parameters. It’s just linearly expensive,” Peter said. “This is incredibly important.” And the result was a surprise. “Nobody had any clue about it before but only about as many as the fingers on my two hands control almost all the uncertainty.”
Weights Without Meaning
When it comes to AI, you don’t build a mathematical model of how the world works. Instead, you take data on how the world behaves and use it to train an AI, typically a neural network, to predict what happens next. Applying VVUQ runs into two headaches. First, the biggest AIs have hundreds of billions of parameters, some reportedly trillions. Remember, it was hard enough with CovidSim’s measly 940.
Second, these parameters, called weights, simply set the strength of the connections between artificial neurons. “They have no meaning,” said Peter. “They’re just being twiddled in order to get a good correlation. And that’s still the weakness.”
He’s also clear about which kind of uncertainty matters. “With that number of parameters, you’re going to be able to fit anything,” he said. What counts isn’t how the AI behaved while it was being trained, in what Peter calls “this dark satanic mill”, on data that had already been carved up for training and testing. “It’s about what happens when you start using it on data that never went into that satanic mill.”
I should add that a prediction can be uncertain for two reasons. The world itself may be noisy, like the roll of a die, so no model could predict it exactly. Statisticians call that aleatoric uncertainty, from the Latin for dice. Or we may simply not know enough to pin the model down, which is called epistemic uncertainty, from the Greek for knowledge. The new method is chiefly aimed at the second source of uncertainty.
Canyons in a Million Dimensions
Wouter and Peter have now come up with a way to estimate that uncertainty in neural networks with a million or more weights. Here’s how it works, as best I understand it (and, ahem, it took me a while).
Training a neural network means adjusting its connection weights until its predictions fit the training data reasonably well. Imagine every possible setting of those weights as a point in an immense landscape, with one dimension for every weight, where lower down means a better fit. The trained network sits near the bottom of a valley.
Now ask what happens if you nudge the weights in a particular direction, which means changing a particular combination of maybe thousands of weights together. In most directions little happens. The valley floor is nearly flat. But in a few directions the walls are steep, and even a tiny nudge makes the fit noticeably worse. Those steep directions are where the training data has pinned the network down, and they’re the directions that really matter, where wobbles in the weights change its predictions most.
The team used the Laplace approximation, a trick that goes back to the French mathematician Pierre-Simon Laplace in the 18th century and was first applied to neural networks by David MacKay in 1992, which uses the steepness of the walls around the valley floor to describe the uncertainty in the weights as a simple bell curve, centred on the trained network.
The catch is that, done in full, this means building and inverting a table of numbers with a million rows and a million columns. The clever part is that Wouter and Peter keep only the handful of steepest directions, which they call the “active subspace”: a low-dimensional slice through an otherwise impossibly large space of possible networks.
“In effect, you reduce it to a kind of eigenvalue problem,” said Peter. By this, he means that in a landscape with a million dimensions, steepness depends on which way you face. There’s a special set of directions that line up with the grain of the valley, rather like the long and short axes of a gravy boat. Along each one, the walls rise at a single rate, and that rate is the eigenvalue. A big eigenvalue means a steep canyon; a tiny one means a plain.
To find those canyons without ever writing down that vast table, they used a clever shortcut from 1950, an iterative technique called the Lanczos algorithm, which probes how the network responds to a series of carefully chosen nudges and sifts out the steepest directions from the results, where errors wreak the most havoc. “So instead of total brute force, varying every parameter randomly,” Peter explained. “it’s trying to find that subspace without doing the exhaustive search, which would be exponentially expensive and utterly impossible.”
More Data, Worse Error Bars. Wuh?
Then came a surprise. In ordinary Bayesian statistics, more evidence generally narrows the range of plausible parameter values. But in this stripped-down low-dimensional approximation the Bayesian method worked badly. As the training set grew, the conventional calculation squeezed the uncertainty especially tightly in the few steep directions the team kept. To make the resulting intervals cover the required proportion of unseen data, the method then had to add many flatter, less informative directions and this distorted both the predictions and their error bars.
The team instead built their calculation from the average error per training example, rather than an error that grows with the number of examples. In their tests, this “mean-loss” version kept the useful uncertainty concentrated in far fewer directions and produced intervals whose observed coverage was much closer to their advertised coverage. The number of directions is set by checking the error bars against data the network has never seen, until they capture the share they promise.
Curves, Concrete and Drug Molecules
They first tested the idea on a simple wiggly curve with a known amount of noise, using a small network with 2,701 weights, few enough to check their shortcuts against the full calculation. With 50 training points, their approach needed to let the weights wobble along just two directions, the two steepest canyons in the landscape, to produce error bars that captured at least 90 per cent of a separate set of test data, as they should. The standard approach needed 31 directions and gave slightly wider, messier error bars. With 1,000 training points, the new approach still needed only two directions, while the standard one needed 43, and its predictions got noticeably worse.
Next came a real-world problem: predicting the compressive strength of concrete from eight measurements describing the mix, using a dataset of 1,030 samples and a network with around a million weights. Here the difference was even more stark. The new approach hit its target by letting the weights wobble along just the three steepest directions. The standard one never got there. Even with 50 directions, its supposedly 90 per cent error bars captured only about 60 per cent of the test data. The team also found that the 1,000 most influential weights, a mere 0.1 per cent of the total, accounted for 95 per cent of the network’s sensitivity.
Finally, they tried their method on REINVENT, an AI developed by AstraZeneca to design new molecules for drug discovery. Its network has about 1.6 million weights and was trained on 1.25 million molecules from the ChEMBL database, each written as a string of letters and symbols. It builds a molecule one character at a time by predicting what comes next. This time the aim wasn’t to draw error bars but to see how varying the weights within their uncertainty changed the molecules it created.
With the standard approach, little changed. With the new one, the AI began to explore, producing molecules of different lengths and properties. But there was a limit. When they let the uncertainty spread into a third direction, the AI started to go off the rails. Only 44 per cent of the strings it produced were valid molecules, down from 87 per cent, and some of those that were valid were long, carbon-heavy chains that were chemically implausible, breaking one of the rules of thumb drug hunters use to judge whether a compound could work as a pill. That’s useful to know too, because it marks where the model’s knowledge runs out.
A Chatbot that Knows its Limits?
So is this VVUQ for AI? And could it lead to a chatbot that knows when it’s hallucinating? “The most important thing is that we can say, with a high degree of confidence, what level of uncertainty this model generates,” Peter replied. But chatbots are a harder case. “How you quantify the prediction when it’s spoken English is rather harder to quantify than it is if it’s doing numerical stuff,” he said. The advance is not that an AI now understands why it is wrong, but that researchers may be able to estimate some of its predictive uncertainty with confidence.
Peter’s also candid about what this method can’t do. “Unlike a physics-based or mechanistic model, you can find the smaller subset of parameters, the connection weights, that contain all the uncertainty, but you don’t know how to deal with them,” he said. “You don’t know how to change those parameters to reduce uncertainty.”
What’s more, train the same network again on the same data and you get different weights. “You may find that this neuron is now part of the set causing the uncertainty, not that one. It doesn’t translate into something you can act on,” he said. “That’s still their intrinsic weakness. But at least we’ve got control over what the error is going to be when they make a prediction. That’s, I would suggest, pretty useful.”
Every expert knows that uncertainty is not a flaw. It is part of how science works. The challenge for AI is that today’s systems often hide their uncertainty behind fluent and authoritative prose. This new approach raises the possibility that future AIs could become more like good scientists: not just providing plausible sounding answers but revealing how reliable those answers really are.
Whether that ambition will survive the jump to giant language models remains uncertain. The authors themselves name fine-tuned language models as the next frontier. And, as Wouter warns, there may yet be “a snake in the grass somewhere”.
Bottom line: this is a step towards AI that’s as candid as a weather forecaster. And that matters: even though I know a weather forecast might be wrong, I still listen because I know how likely it is to be right. Finding a way to measure uncertainty in AI may prove just as important in the long term for AI as improving its intelligence.
Archived at: https://zenodo.org/records/23925090


I enjoyed the post, but as a linguist and academic editor (and now software developer) I found the mixing of categories a bit perturbing. Also, as a very heavy and longstanding user of AI for linguistic research and vibecoding, I actually have never come across this alleged “hallucination” problem and feel it may be a category error. In my experience, LLMs do not “hallucinate” but they may provide unexpected outputs due to the context in the user’s head not having been made sufficiently explicit. The solution of course is iterative: go back to the point where the context was not clear and make it explicit. From a linguistic point of view, LLMs are in principle 100% predictable. This doesn’t mean you can use them to do science, since, as you did point out, science is all about creating new data, not doing predictable things with the data that already exists!