Documentation

Studies.GiulianelliEtAl2026

Giulianelli, Wallbridge, Cotterell and Fernández (2026): Incremental Alternative Sampling as a Lens into the Temporal and Representational Resolution of Linguistic Prediction #

This file formalizes the incremental alternative sampling (IAS) family of [GWCF26]. A language model is the family of next-unit kernels of an autoregressive process, and a comprehender samples continuations of the context over a forecast horizon of h units, the partial trajectory of the process (Kernel.partialTraj); the generalised surprisal of the next unit is the substrate's genSurprisal at that kernel. Standard surprisal is the member with the negative logarithm and the prefix indicator at every horizon, because the alternatives' first unit is distributed as the model's next unit (genSurprisal_prefixIndicator); it thus evaluates alternatives by lexical identity alone, and the discrete distance shows what this conflates, since information value with it is the probability of error (informationValue_discrete). Incremental information value replaces the indicator by a representational distance between each alternative and the observed unit followed by the alternatives sampled after it, the double expectation of the paper's definition (iiv), whose horizon-one case is the information value of the substrate (iiv_zero).

Implementation notes #

References #

def GiulianelliEtAl2026.snoc {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] {n : ℕ} (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) (i : ↥(Finset.Iic (n + 1))) :
X ↑i

The context x followed by the unit w.

Equations
Instances For

    Standard surprisal at every horizon #

    noncomputable def GiulianelliEtAl2026.prefixIndicator {X : ℕ → Type u_1} {n h : ℕ} (w : X (n + 1)) (a : (i : ↥(Finset.Iic (n + h + 1))) → X ↑i) :
    ℝ

    The prefix indicator: one when the alternative's first unit is w.

    Equations
    Instances For
      theorem GiulianelliEtAl2026.integral_prefixIndicator {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] [∀ (n : ℕ), MeasurableSingletonClass (X n)] (κ : (n : ℕ) → ProbabilityTheory.Kernel ((i : ↥(Finset.Iic n)) → X ↑i) (X (n + 1))) [∀ (n : ℕ), ProbabilityTheory.IsMarkovKernel (κ n)] {n h : ℕ} (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) :
      ∫ (a : (i : ↥(Finset.Iic (n + h + 1))) → X ↑i), prefixIndicator w a ∂(ProbabilityTheory.Kernel.partialTraj κ n (n + h + 1)) x = ((κ n) x).real {w}

      The expected prefix indicator is the next-unit probability, at every horizon.

      theorem GiulianelliEtAl2026.genSurprisal_prefixIndicator {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] [∀ (n : ℕ), MeasurableSingletonClass (X n)] (κ : (n : ℕ) → ProbabilityTheory.Kernel ((i : ↥(Finset.Iic n)) → X ↑i) (X (n + 1))) [∀ (n : ℕ), ProbabilityTheory.IsMarkovKernel (κ n)] {n h : ℕ} (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) :
      Surprisal.genSurprisal (ProbabilityTheory.Kernel.partialTraj κ n (n + h + 1)) (fun (r : ℝ) => -Real.log r) (fun (a : (i : ↥(Finset.Iic (n + h + 1))) → X ↑i) (w : X (n + 1)) (x : (i : ↥(Finset.Iic n)) → X ↑i) => prefixIndicator w a) x w = InformationTheory.surprisal ((κ n) x) w

      Standard surprisal is the generalised surprisal with the negative logarithm and the prefix indicator, at every horizon.

      What the indicator conflates #

      noncomputable def GiulianelliEtAl2026.discrete {X : ℕ → Type u_1} {n : ℕ} (a w : X (n + 1)) :
      ((i : ↥(Finset.Iic n)) → X ↑i) → ℝ

      The discrete distance on units: an alternative is accurate only when identical to the unit.

      Equations
      Instances For
        theorem GiulianelliEtAl2026.informationValue_discrete {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] [∀ (n : ℕ), MeasurableSingletonClass (X n)] (κ : (n : ℕ) → ProbabilityTheory.Kernel ((i : ↥(Finset.Iic n)) → X ↑i) (X (n + 1))) [∀ (n : ℕ), ProbabilityTheory.IsMarkovKernel (κ n)] {n : ℕ} (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) :
        Surprisal.informationValue (κ n) discrete x w = 1 - ((κ n) x).real {w}

        Information value with the discrete distance is the probability of error, 1 − p(w | c): the alternatives' similarity to the unit counts for nothing, as under surprisal.

        Incremental information value #

        noncomputable def GiulianelliEtAl2026.iiv {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] (κ : (n : ℕ) → ProbabilityTheory.Kernel ((i : ↥(Finset.Iic n)) → X ↑i) (X (n + 1))) {n h : ℕ} (d : ((i : ↥(Finset.Iic (n + h + 1))) → X ↑i) → ((i : ↥(Finset.Iic (n + h + 1))) → X ↑i) → ℝ) (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) :
        ℝ

        Incremental information value at horizon h + 1: the expected representational distance between an alternative sampled before the unit and the unit followed by the alternatives sampled after it, the paper's double expectation.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem GiulianelliEtAl2026.iiv_zero {X : ℕ → Type u_1} [(n : ℕ) → MeasurableSpace (X n)] [∀ (n : ℕ), MeasurableSingletonClass (X n)] (κ : (n : ℕ) → ProbabilityTheory.Kernel ((i : ↥(Finset.Iic n)) → X ↑i) (X (n + 1))) [∀ (n : ℕ), ProbabilityTheory.IsMarkovKernel (κ n)] {n : ℕ} [∀ (n : ℕ), Countable (X n)] (d : ((i : ↥(Finset.Iic (n + 1))) → X ↑i) → ((i : ↥(Finset.Iic (n + 1))) → X ↑i) → ℝ) (x : (i : ↥(Finset.Iic n)) → X ↑i) (w : X (n + 1)) :
          iiv κ d x w = Surprisal.informationValue (κ n) (fun (a w' : X (n + 1)) (x : (i : ↥(Finset.Iic n)) → X ↑i) => d (snoc x a) (snoc x w')) x w

          At horizon one, incremental information value is the information value of the substrate, with the distance read on the extended contexts.