AI Wiki中文/EN

Computational pragmatics: infer meaning from alternatives left unsaid

计算语用学

Connect literal meaning, speaker choice and listener inference in a finite RSA reference game, testing how costs and priors change implicatures.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Why say “red” instead of “square”?

Three invented objects sit on a table: a red square, a red circle and a blue circle. A speaker can identify one by saying “red,” “square,” “circle” or “blue.” Hearing “red” literally rules out only the blue circle. But if the speaker meant the red square, why not choose the uniquely identifying “square”? An alternative that was not selected can itself become evidence.

Computational pragmatics studies how context, common knowledge, communicative goals and expression choices affect understanding. It differs from semantic parsing: even when we know which objects make a sentence true, we must still infer why a speaker selected it here. “The window is open” could be a description or, in a suitable setting, a reminder to close it. The latter interpretation needs additional assumptions about the situation and goals; literal truth does not supply it automatically. Probabilistic understanding in context

The Rational Speech Act framework, or RSA, makes such assumptions explicit. Frank and Goodman study finite reference games in which speakers favor informative words and listeners infer intended objects in reverse. This supplies computable predictions, without implying that every person and utterance follows the same strict rational policy. Reference-game model

We begin with a literal listener, add a speaker who chooses utterances, then obtain a pragmatic listener. Meanings, objects, priors and available utterances are supplied explicitly rather than automatically recovered from the world. This exposes which inference comes from word meaning and which comes from assumptions about people.

With supplied literal meanings, the listener reasons about alternatives left unsaid. Increasing only the cost of saying square reverses the red-circle preference; priors and alternative sets remain explicit assumptions.
With supplied literal meanings, the listener reasons about alternatives left unsaid. Increasing only the cost of saying square reverses the red-circle preference; priors and alternative sets remain explicit assumptions.

Three levels, three normalizations

Let ww be a possible target object, uu an utterance, and Muw∈{0,1}M_{uw}\in\{0,1\} indicate whether the utterance is true of the object. The strictly positive prior p(w)p(w) sums to one. Literal listener L0L_0 filters by truth and normalizes the prior; a zero denominator makes the utterance impossible in the supplied state set.

L0(w∣u)=Muwp(w)Z0(u),Z0(u)=∑w′Muw′p(w′).L_0(w\mid u)=\frac{M_{uw}p(w)}{Z_0(u)},\qquad Z_0(u)=\sum_{w'}M_{uw'}p(w').

With a uniform prior, “red” assigns probability 1/2 to each red object, while “square” assigns probability 1 to the red square. Now suppose the speaker wants the literal listener to identify the target while avoiding utterance cost. Utility uses natural logarithms; c(u)≥0c(u)\ge0 is a cost on the same scale as the log term:

V(u,w)=log⁡L0(w∣u)−c(u),c(u)≥0,u∈Tw.V(u,w)=\log L_0(w\mid u)-c(u),\qquad c(u)\ge0,\quad u\in T_w.

We explicitly subtract nonnegative cost. Goodman and Frank’s review first gives informational utility, then discusses utterance cost, speaker uncertainty, topic relevance and other social goals in Box 1. Different utilities encode different communicative assumptions. Basic model and Box 1

Let TwT_w be the alternatives true of target ww, and let α\alpha control sensitivity to utility differences. Speaker S1S_1 applies softmax over these utterances rather than over target objects:

S1(u∣w)={exp⁡[αV(u,w)]∑v∈Twexp⁡[αV(v,w)],u∈Tw,0,u∉Tw.S_1(u\mid w)=\begin{cases}\displaystyle\frac{\exp[\alpha V(u,w)]}{\sum_{v\in T_w}\exp[\alpha V(v,w)]},&u\in T_w,\\0,&u\notin T_w.\end{cases}

At α=0\alpha=0, we use the α↓0\alpha\downarrow0 limit over true alternatives, which chooses uniformly from TwT_w. False utterances remain outside the support; multiplying zero by negative infinity does not suddenly make them available. Larger α\alpha favors higher-utility choices more strongly. It is a model parameter, not an intelligence measurement.

Pragmatic listener L1L_1 observes the selected utterance and applies Bayes’ rule over target objects. Z1(u)Z_1(u) is also the model’s marginal probability of that utterance:

L1(w∣u)=S1(u∣w)p(w)Z1(u),Z1(u)=∑w′S1(u∣w′)p(w′).L_1(w\mid u)=\frac{S_1(u\mid w)p(w)}{Z_1(u)},\qquad Z_1(u)=\sum_{w'}S_1(u\mid w')p(w').

With a uniform prior, zero costs and α=1\alpha=1, a speaker identifying the red square can choose “red” or “square.” Their literal identification probabilities are 1/2 and 1, giving speaker probabilities 1/3 and 2/3. For the red circle, both “red” and “circle” describe two objects, so each is chosen with probability 1/2. Hearing “red” therefore gives the red circle posterior:

L1(wred circle∣red)=(1/2)(1/3)(1/3)(1/3)+(1/2)(1/3)=35.L_1(w_{\mathrm{red\ circle}}\mid\mathrm{red})=\frac{(1/2)(1/3)}{(1/3)(1/3)+(1/2)(1/3)}=\frac35.

The literal posterior was 1/2; the pragmatic posterior is 3/5. The truth of “red” has not changed. The model treats the speaker’s decision not to use “square” as evidence. At α=5\alpha=5, the red-square speaker chooses “red” with probability 1/(1+25)=1/331/(1+2^5)=1/33, while the red-circle speaker still does so with probability 1/2, yielding posterior 33/3533/35.

Now increase only the cost cc of “square.” The red-square speaker chooses “red” with probability q(c)q(c), while the red-circle alternatives remain unchanged:

q(c)=11+2e−c,L1(wred circle∣red;c)=1/21/2+q(c).q(c)=\frac{1}{1+2e^{-c}},\qquad L_1(w_{\mathrm{red\ circle}}\mid\mathrm{red};c)=\frac{1/2}{1/2+q(c)}.

At c=log⁡2c=\log2, the posterior is exactly 1/2. At c=2c=2, it is approximately 0.388505, reversing the original preference. The speaker may simply be avoiding an expensive expression, so the listener cannot reuse the zero-cost inference. Removing alternatives or changing priors can also change the result. Priors enter both literal and pragmatic levels; they cannot be handled by arbitrarily multiplying the old posterior by a weight.

Retain the evidence at each level

The complete program needs Python and NumPy. Matrix rows are utterances and columns are target objects. literal and listener normalize each row over targets; speaker normalizes each column over utterances. evidence retains utterance marginals so that the complete joint distribution can be checked rather than only its final argmax.

"""Finite RSA with explicit literal meanings, positive priors and utterance costs.

A bounded reference game, not automatic interpretation or a human study.
"""
import json
import numpy as np


def infer(meaning, prior=None, costs=None, alpha=1.):
    raw=np.asarray(meaning)
    if raw.ndim!=2 or not 1<=raw.shape[0]<=12 or not 1<=raw.shape[1]<=8 or not np.isin(raw,[0,1]).all():
        raise ValueError('Meaning must be a binary utterance-by-state matrix up to 12 by 8')
    truth=raw.astype(bool);u,w=truth.shape
    if not truth.any(axis=0).all():raise ValueError('Each state needs a true utterance')
    p=np.ones(w)/w if prior is None else np.asarray(prior,dtype=float)
    c=np.zeros(u) if costs is None else np.asarray(costs,dtype=float)
    if p.shape!=(w,) or not np.isfinite(p).all() or (p<1e-9).any() or not np.isclose(p.sum(),1,rtol=0,atol=1e-12):
        raise ValueError('Prior entries must be at least 1e-9 and sum to one')
    p=p/p.sum()
    if c.shape!=(u,) or not np.isfinite(c).all() or (c<0).any() or (c>20).any():raise ValueError('Costs must be finite in [0,20]')
    if isinstance(alpha,bool) or not isinstance(alpha,(int,float)) or not np.isfinite(alpha) or not 0<=alpha<=10:
        raise ValueError('Alpha must be finite in [0,10]')
    literal=truth*p;z=literal.sum(axis=1,keepdims=True)
    literal=np.divide(literal,z,out=np.zeros_like(literal),where=z>0)
    # alpha=0 is the limit on true alternatives only; false meanings stay impossible.
    speaker=np.zeros((u,w))
    for state in range(w):
        allowed=truth[:,state];utility=np.log(literal[allowed,state])-c[allowed]
        logits=alpha*utility;weights=np.exp(logits-logits.max());speaker[allowed,state]=weights/weights.sum()
    joint=speaker*p;evidence=joint.sum(axis=1);listener=np.divide(joint,evidence[:,None],out=np.zeros_like(joint),where=evidence[:,None]>0)
    return dict(literal=literal.tolist(),speaker=speaker.tolist(),listener=listener.tolist(),
                evidence=evidence.tolist(),status=['ok' if e>0 else 'impossible_utterance' for e in evidence],
                alpha=float(alpha),prior=p.tolist(),costs=c.tolist())


def demo():
    # Invented objects: red square, red circle, blue circle.
    names=['red-square','red-circle','blue-circle'];utterances=['red','square','circle','blue']
    meaning=[[1,1,0],[1,0,0],[0,1,1],[0,0,1]]
    base=infer(meaning)
    return dict(states=names,utterances=utterances,meaning=meaning,base=base,
                no_optimization=infer(meaning,alpha=0),strong=infer(meaning,alpha=5),
                costly_square=infer(meaning,costs=[0,2,0,0]),
                biased=infer(meaning,prior=[.8,.1,.1]),
                only_red=infer([[1,1]],prior=[.5,.5]),
                cost_curve=[dict(cost=x,probability=infer(meaning,costs=[0,x,0,0])['listener'][0][1]) for x in [0,.5,1,2,4]],
                impossible=infer(meaning+[[0,0,0]])['status'][-1])


if __name__=='__main__':print(json.dumps(demo(),indent=2,allow_nan=False))

Run python pragmatics.py. base should give literal [0.5,0.5,0] and pragmatic [0.4,0.6,0] distributions for “red”; costly_square lowers the red-circle probability to approximately 0.388505. only_red has two red objects and only the utterance “red,” so it cannot use the “square” alternative and remains at [0.5,0.5]. biased uses prior [0.8,0.1,0.1] and gives the red square posterior approximately 0.953930, showing priors and choice evidence acting together.

Every state needs at least one true utterance. An entirely false utterance row may remain, returning a zero distribution with impossible_utterance. This is different from equal plausibility over objects: a missing evidence denominator cannot justify inserting a uniform distribution. Inputs are capped at 12 utterances and 8 targets, each prior entry at least 10−910^{-9}, costs at most 20, and α\alpha at most 10, preventing underflow on admitted support from masquerading as logical impossibility.

For UU utterances and WW states, this fixed three-level chain uses O(UW)O(UW) time and space. It neither enumerates unbounded natural language nor recursively iterates to convergence. Richer RSA models with larger states, uncertain meanings or nested inference can be more expensive. Model variations and computational challenges

Implicatures rely on defeasible assumptions

The game gives the speaker full knowledge of the target, makes the truth table and alternatives shared, and assumes informational utility. Real interlocutors may know different facts, disagree about expression costs, or pursue politeness and avoidance. The review treats these as reasons to change utilities or uncertainty structures; varying a parameter in our basic model does not reproduce every extension. Box 1 and outstanding questions

Inferring that “red” more likely identifies the red circle is probabilistic, not a logical exclusion of the red square. A positive posterior leaves the square possible in the model. This helps distinguish semantic entailment from defeasible pragmatic implicature; the probability is not proof that the model has understood the speaker. Probabilistic interpretation

The alternative-utterance set is especially consequential. Allowing additional expressions, or having a speaker who does not know the word “square,” can change the inference. The model does not automatically establish which alternatives people actually considered. Fitting one final choice may also fail to identify a unique prior, cost and rationality parameter; additional designs and data must distinguish such explanations. Alternatives and inference challenges

A real study should separately observe speaker choices, prior or salience judgments, and listener interpretations, then test predictions in new conditions rather than merely explain the same answers. Frank and Goodman’s experiment separates these tasks. Here we implement the computable structure without collecting or reproducing their human judgment data. Experimental task separation

Four tests of context

  1. Why can the literal and pragmatic posteriors for “red” differ without changing its meaning?

Answer: The truth matrix continues to allow both red objects. The literal listener uses truth and priors, while the pragmatic listener also uses the speaker’s propensity to choose among alternatives. The extra choice model changes the inference; it does not make “the red square is red” false.

  1. With uniform priors, zero costs and α=1\alpha=1, calculate the evidence probability for “red” and the red-circle posterior.

Answer: Evidence is (1/3)(1/3)+(1/2)(1/3)=5/18(1/3)(1/3)+(1/2)(1/3)=5/18. The red circle’s joint probability is (1/2)(1/3)=1/6(1/2)(1/3)=1/6, which divided by 5/185/18 gives 3/53/5. The blue circle cannot make “red” true and contributes zero.

  1. Does adding 1 to every utterance cost change speaker probabilities? What about increasing only the cost of “square”?

Answer: The common increment multiplies every admitted alternative’s exponential weight by e−αe^{-\alpha}, which cancels under normalization. Increasing only “square” changes relative utility and does not cancel. At cost log⁡2\log2, hearing “red” no longer favors the red circle; higher costs can reverse the preference.

  1. When a model fails to explain an utterance, how can missing semantic support be distinguished from prior bias?

Answer: First check whether any object makes the utterance true and whether its marginal probability is zero; an all-false row is explicitly impossible here. With positive support, inspect how priors, alternatives and costs affect probabilities, then design conditions that distinguish the explanations. Neither replacing a zero denominator with a uniform distribution nor tuning parameters to one answer establishes correct understanding.

A framework rather than a universal communication formula

Frank and Goodman’s reference game connects informativeness and Bayesian inference in a quantitative model. The later review places semantics, utilities, uncertainty and contextual variation into a broader framework. We select a basic chain that can be computed exactly, stating the cost sign and zero-rationality limit explicitly. Early reference model Later framework

An early ProbLang course repository offers a lead for organizing computable teaching of these ideas. Only its pinned old README was read here; the method evidence remains the two papers. Early course lead Read Bayesian inference and softmax first, then compare semantic parsing: obtaining truth conditions is one starting point for further inference about communicative intent.

Make a prediction, then check

Why can a cost on saying “square” reverse the listener’s preference after hearing “red”?

Choose one answer

Learning objectives

  • Separate literal truth from pragmatic inference.
  • Derive and normalize the three finite RSA levels.
  • Predict effects of alternatives, costs and priors.
  • Recognize missing support and limits of the communicative assumptions.

Prerequisites & connections

Explore related knowledge →

References

  1. Predicting pragmatic reasoning in language games
    Michael C. Frank, Noah D. Goodman · 2012
  2. Pragmatic Language Interpretation as Probabilistic Inference
    Noah D. Goodman, Michael C. Frank · 2016
  3. Probabilistic language understanding: early course repository README
    Gregory Scontras, Michael Henry Tessler (authors listed in this README) · 2017

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-13 · Single AI author checked finite RSA against scoped Frank/Goodman2012 and Goodman/Frank2016 plus historical course README. Six paired equations and four explained exercises: literal truth filtering, nonnegative cost subtraction, true-support softmax and alpha-zero limit, pragmatic Bayes posterior, 3/5 example and cost-induced reversal. Supplied semantics and bounded parameters are not natural-language parsing or a human experiment.

  • Checked three normalization axes and truth support, 5/18 evidence, 3/5 posterior, 33/35 strong-speaker limit example, cost-shift invariance and log(2) crossing. Invalid inputs/zero evidence and admitted extreme parameters checked.
  • Four computed SVGs bind exact bilingual MDX. The three-topic group passed eight numeric/encoding checks and 18 isolated language/width cases with four fallback fonts; six actual screenshots inspected by the AI author. Literal-prose AST checked before freezing. Full article browser acceptance is separate; no human peer review.

Source locations checked:

  • Predicting pragmatic reasoning in language games · Read abstract, author-manuscript pages 2–3 equations 1–2 and experimental task separation; visually inspected page3. This is the multi-page author manuscript, not the one-page Science layout. No participant correlation values reproduced.
  • Pragmatic Language Interpretation as Probabilistic Inference · Read physical pages2–3/819–820 equations1–4, visually inspected page3; scoped Box1 utility and Outstanding Questions text. Our cost is explicitly nonnegative and subtracted; one fixed finite chain does not reproduce all extensions or human inference.
  • Probabilistic language understanding: early course repository README · Commit 2017-03-15. Read the complete seven-line README; no license file found in the inspected root listing. Historical course lead only, not current course authorship/content. No copied material or Jekyll execution.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.