Skip to content
AI.info

Generative AI

From Probability Distributions to Generated Artifacts

Explain generation as a sequence of probabilistic choices and connect that mechanism to variation, uncertainty, and failure.

By the end you can

A probability distribution is not a verdict

Given the beginning of a sentence, a language model assigns scores to possible next tokens. An image generator does the same for pictures: many outputs are compatible with one prompt and its conditioning inputs. Generation chooses a path through that possibility space. The chosen path can be coherent without being factual.

That is not an accusation from outside the field. It is a numbered risk in a federal standards document. NIST's Generative AI Profile, published in July 2024, lists confabulation as risk 2 of 12 and defines it as “the production of confidently stated but erroneous or false content (known colloquially as 'hallucinations' or 'fabrications') by which users may be misled or deceived”. The profile attributes it to the design, not to misuse: “Confabulations are a natural result of the way generative models are designed: they generate outputs that approximate the statistical distribution of their training data; for example, LLMs predict the next token or word in a sentence or phrase.”

How often that happens has been counted. Dahl and colleagues put specific, verifiable questions about randomly selected federal court cases to general-purpose models. Their 2024 paper in the Journal of Legal Analysis gives the range: “we find that legal hallucinations are alarmingly prevalent, occurring between 58% of the time with ChatGPT 4 and 88% with Llama 2, when these models are asked specific, verifiable questions about random federal court cases”. The questions had checkable answers. The models could not reliably predict when they were hallucinating. The error rate arrived without a warning attached.

The mechanism producing these distributions is not new. Sohl-Dickstein and colleagues described diffusion generation in 2015 as a slow destruction of structure, then its reversal. Ho and colleagues refined it in 2020 and reported an Inception score of 9.46 on CIFAR-10. Brown and colleagues had shown the same year that a 175-billion-parameter language model could work from examples alone. Every one of those results is a claim about statistical fit. None of them is a claim about truth.

Fluency is not verification: on specific, verifiable questions about random federal court cases, hallucination ran between 58% with ChatGPT 4 and 88% with Llama 2.

Visual

A complex artifact emerges through many conditional choices

The exact factorization varies by model family. But each step depends on prior state and conditioning. And the third step — the selection policy — is not a formality that can be left at its default.

One experiment isolates it. Hold the model fixed at GPT-2 Large, 762M parameters, generate 5,000 passages, and vary nothing but the decoding policy. Greedy decoding gave perplexity 1.50 with 73.66% repetition. Beam search at b=16 gave 1.48 with 28.94% repetition. Pure sampling gave perplexity 22.73. Nucleus sampling at p=0.95 gave 13.13 with 0.36% repetition. Human text sits at perplexity 12.38 and 0.28% repetition. One unchanged distribution, and repetition running from 73.66% down to 0.36%, depending only on how a number was turned into a next state.

Holtzman and colleagues, who ran it, name the trap in their abstract: “even though the use of likelihood as training objective leads to high quality models for a broad range of language understanding tasks, maximization-based decoding methods such as beam search lead to degeneration — output text that is bland, incoherent, or gets stuck in repetitive loops.”

Note where the lowest perplexity sits. It is 1.48, under beam search, against 12.38 for human text. The most likely continuation was the least human one.

FigureProcess · 5 steps
  1. 1

    Condition on input

    Prompts, source material, images, tools, or latent variables define the current constraints.

  2. 2

    Compute a distribution

    The model assigns relative scores to candidate continuations or updates.

  3. 3

    Apply a selection policy

    Greedy choice, sampling, search, or a solver turns scores into a next state.

  4. 4

    Update the context

    The selected element changes what becomes likely at the following step.

  5. 5

    Stop and validate

    A product decides when the artifact is complete and whether it satisfies its contract.

Comparison

Three uncertainties that should not be collapsed

Each has to be measured differently, and each needs its own way of reducing it. The most common collapse is to read a token probability as a confidence readout. OpenAI's own GPT-4 technical report, from March 2023, contains the number that breaks that reading. On a subset of MMLU the pre-trained model had an expected calibration error of 0.007. The same model after PPO post-training had an expected calibration error of 0.074. Worse by roughly a factor of ten, with the underlying knowledge unchanged. The figure caption states it without hedging: “The post-training hurts calibration significantly”.

What that costs a user appears in the report's own Limitations section: “GPT-4 can also be confidently wrong in its predictions, not taking care to double-check work when it’s likely to make a mistake.” A quantity that moves by an order of magnitude because of an alignment step, while what the model knows stays put, is a property of the model's expressed confidence. It is not a measurement of missing evidence. And it says nothing at all about what the surrounding workflow will do in production.

FigureComparison · 3 columns

Distributional ambiguity

Several outputs may be plausible under the model.

  • Visible through alternative samples
  • Affected by decoding settings
  • Useful for creative variation
  • Not equivalent to factual uncertainty

Knowledge uncertainty

The system lacks reliable evidence for a requested claim.

  • May arise from missing or stale context
  • Requires retrieval, tools, abstention, or review
  • Can coexist with fluent language
  • Not solved by adding stylistic confidence

Operational uncertainty

The surrounding workflow may behave differently in production.

  • Permissions, tools, queues, and users matter
  • Requires end-to-end testing
  • Can appear after a model upgrade
  • Cannot be inferred from token probabilities alone

Example

The same mechanism behaves differently across products

These cases show why the kind of artifact, and what it costs when it is wrong, both matter. Two of them have measured failure rates attached, from controlled studies rather than anecdote.

  • Email drafting: Several polite phrasings are acceptable, so variation can be a feature, and nothing external has to adjudicate between them.
  • Invoice extraction: Multiple plausible values are unacceptable when only one amount appears on the source document. And a system that is accurate almost all of the time still invents content. Koenecke and colleagues report of OpenAI Whisper, in 2024: “we find that roughly 1% of audio transcriptions contained entire hallucinated phrases or sentences which did not exist in any form in the underlying audio”.
  • Code completion: A locally likely function call may compile while violating a project invariant, and the size of that effect has been measured. In a controlled study of 47 participants, only 3% of those working with an OpenAI codex-davinci-002 assistant produced a secure solution to the ECDSA message-signing task, against 21% of the control group (p = 0.039). The assisted participants were also more likely to believe their code was secure. Perry and colleagues put it plainly: “Overall, we find that participants who had access to an AI assistant wrote significantly less secure code than those without access to an assistant.”
  • Image editing: A realistic reconstructed face may introduce details absent from the original photograph, and the realism is precisely what stops a reviewer from noticing the addition.
  • Medical explanation: Familiar wording can make an unsupported recommendation sound authoritative — 38% of those Whisper hallucinations carried explicit harms, including invented associations and implied false authority, with rates highest for speakers with aphasia.

Analogy

A weather ensemble is not tomorrow’s weather

Weather ensembles produce several plausible storm tracks, and the ensemble worth borrowing here is a real, dated, operational one. NOAA's Global Ensemble Forecast System reached version 12 on 23 September 2020. Its Environmental Modeling Center records the configuration: “GEFS v12 runs 4 times per day (00; 06; 12; 18UTC) with 31 members at each lead-time at C384L64 (about 25 km horizontal resolution and 64 vertical hybrid levels for atmosphere component) and out to 16 days at each cycle, except for 35 days at 0000 UTC.” Thirty of those members are perturbed. One is the control.

The 31 tracks reveal possible futures under a model, and not one of them proves where the storm will go. A generative model also represents alternatives, and a policy selects one. The storm ignores the forecast. Language and media outputs reach users. So the selected artifact can change the environment rather than merely describe it.

Possible outputs describe model behavior; product decisions still need external evidence and controls.

Key idea

Use deterministic code where the contract is exact

Nothing stops a model from proposing a date, formula, database query, or payment amount. So exact validation should happen in code that enforces type, range, authorization, and business invariants.

Probabilistic generation is useful for interpreting and drafting. It should not silently replace deterministic checks when what counts as a valid answer is precisely defined.

Six of the judicial opinions cited in one federal filing did not exist. ChatGPT had produced them, complete with fake quotes and citations. On 22 June 2023, in Mata v. Avianca, Judge P. Kevin Castel imposed a $5,000 Rule 11 penalty jointly and severally on the two lawyers who filed them and their firm, and ordered them to write to each judge falsely named as the author of one. A citation is exactly the kind of value with a deterministic contract: it either resolves in a case database or it does not. The opinion states the standard: “Technological advances are commonplace and there is nothing inherently improper about using a reliable artificial intelligence tool for assistance. But existing rules impose a gatekeeping role on attorneys to ensure the accuracy of their filings.”

Let the model handle ambiguity, then let deterministic systems enforce invariants.

Steps

Trace one output back to its sources of uncertainty

Choose a generative feature and annotate the full decision path. Mark every probabilistic choice, including model sampling, retrieval ranking, and classifier thresholds. Identify the values that must satisfy exact deterministic rules. Record separately the claims that cannot be justified from available sources. Add independent checks: calculators, parsers, policy engines, human review. Then define the point at which the system should abstain rather than continue generating.

Two of those annotations are easy to skip, and the anchors above show why neither should be. Write down who chose the decoding policy and what it is set to. Changing that alone moved repetition from 73.66% to 0.36%. Then write down which fields resolve against an external database, and who runs that query. In Mata v. Avianca, nobody did.

FigureProcess · 5 steps
  1. 1. Mark every probabilistic choice

    Include model sampling, retrieval ranking, and classifier thresholds.

  2. 2. Identify exact invariants

    List values that must satisfy deterministic rules.

  3. 3. Separate missing evidence

    Record claims that cannot be justified from available sources.

  4. 4. Add independent checks

    Use calculators, parsers, policy engines, or human review where needed.

  5. 5. Define a safe stop

    Specify when the system should abstain rather than continue generating.

Generation is useful precisely because one answer is not hard-coded

The value of generative models comes from handling open-ended input and producing flexible artifacts. That same flexibility forces the application to declare what remains variable and what must be checked. The figures in this lesson describe one boundary from different sides: 58% and 88% hallucination on verifiable legal questions, an expected calibration error moving from 0.007 to 0.074 without any change in knowledge, 3% secure solutions against 21%, roughly 1% of transcriptions carrying invented sentences.

The next lessons examine the representations and architectures that create these distributions. Keep the boundary between statistical plausibility and product validity visible throughout the path.

Key takeaways