Documentation

Studies.FutrellGibsonLevy2020

Futrell, Gibson and Levy (2020): Lossy-Context Surprisal #

This file formalizes [FGL20]'s lossy-context surprisal, on which the difficulty of a word is its expected surprisal under a lossy memory representation of its context, carried by LossyContext.MemoryProcess. The comprehender of section 3.3 predicts the next word from its memory representation by Bayesian inversion of the memory kernel (bayes), and averaged over contexts its difficulty is the conditional entropy of the word given the representation, which exceeds the difficulty of surprisal theory, the lossless comprehender who sees the context, by exactly the predictive information memory loses (averageDifficulty_bayes_sub_lossless); the data processing inequality makes the loss nonnegative.

Information locality (section 5) is proved in the single-dependency configuration, where the paper's first-order approximation is exact: under erasure noise (erasure), which keeps the context word with probability 1 - e, difficulty is the unigram surprisal less the surviving fraction of the pointwise mutual information, so with progressive noise, a more distant word erased more often, difficulty grows with distance when the words are positively associated and shrinks when they are negatively associated (locality, antilocality). No erasure is the lossless case and certain erasure recovers the unigram prior.

Implementation notes #

References #

The Bayes-optimal comprehender and the average form #

noncomputable def FutrellGibsonLevy2020.joint {W : Type u_1} [MeasurableSpace W] {C : Type u_2} [MeasurableSpace C] (L : ProbabilityTheory.Kernel C W) (π : MeasureTheory.Measure C) :
MeasureTheory.Measure (W × C)

The joint law of the next word and its context under the language model L and the context prior π.

Equations
Instances For
    instance FutrellGibsonLevy2020.instIsProbabilityMeasureProdJoint {W : Type u_1} [MeasurableSpace W] {C : Type u_2} [MeasurableSpace C] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] :
    MeasureTheory.IsProbabilityMeasure (joint L π)
    noncomputable def FutrellGibsonLevy2020.memJoint {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSpace R] (L : ProbabilityTheory.Kernel C W) (π : MeasureTheory.Measure C) (mem : ProbabilityTheory.Kernel C R) :
    MeasureTheory.Measure (W × R)

    The joint law of the next word and the memory representation of its context.

    Equations
    Instances For
      instance FutrellGibsonLevy2020.instIsProbabilityMeasureProdMemJoint {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSpace R] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] :
      MeasureTheory.IsProbabilityMeasure (memJoint L π mem)
      theorem FutrellGibsonLevy2020.joint_real_singleton {W : Type u_1} [MeasurableSpace W] {C : Type u_2} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (w : W) (c : C) :
      (joint L π).real {(w, c)} = π.real {c} * (L c).real {w}
      theorem FutrellGibsonLevy2020.memJoint_real_singleton {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] [Fintype C] [Fintype W] (w : W) (r : R) :
      (memJoint L π mem).real {(w, r)} = ∑ c : C, π.real {c} * (L c).real {w} * (mem c).real {r}
      theorem FutrellGibsonLevy2020.measureMutualInfo_memJoint_le {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] [Fintype C] [Fintype W] [Fintype R] :
      theorem FutrellGibsonLevy2020.averageDifficulty_of_lossless {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] [Fintype C] [Fintype W] {mp : LossyContext.MemoryProcess C R W} (h : mp.IsLosslessFor L) :
      mp.averageDifficulty L π = InformationTheory.condEntropy Prod.fst Prod.snd (joint L π)

      The average difficulty of surprisal theory, a lossless comprehender who sees the context, is the conditional entropy of the next word given the context.

      noncomputable def FutrellGibsonLevy2020.bayes {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSpace R] [MeasurableSingletonClass R] (L : ProbabilityTheory.Kernel C W) (π : MeasureTheory.Measure C) (mem : ProbabilityTheory.Kernel C R) [Fintype R] :

      The Bayes-optimal comprehender: the memory kernel with the posterior predictive of the next word given the representation.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem FutrellGibsonLevy2020.averageDifficulty_bayes {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] [Fintype C] [Fintype W] [Fintype R] :
        (bayes L π mem).averageDifficulty L π = InformationTheory.condEntropy Prod.fst Prod.snd (memJoint L π mem)

        The average difficulty of the Bayes-optimal comprehender is the conditional entropy of the next word given the memory representation.

        theorem FutrellGibsonLevy2020.averageDifficulty_bayes_sub_lossless {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] [Fintype C] [Fintype W] [Fintype R] {mp : LossyContext.MemoryProcess C R W} (h : mp.IsLosslessFor L) :

        The average form of information locality: the Bayes-optimal comprehender's average difficulty exceeds surprisal theory's by exactly the predictive information memory loses.

        theorem FutrellGibsonLevy2020.averageDifficulty_lossless_le_bayes {W : Type u_1} [MeasurableSpace W] {C : Type u_2} {R : Type u_3} [MeasurableSpace C] [MeasurableSingletonClass C] [MeasurableSpace R] [MeasurableSingletonClass R] [MeasurableSingletonClass W] (L : ProbabilityTheory.Kernel C W) [ProbabilityTheory.IsMarkovKernel L] (π : MeasureTheory.Measure C) [MeasureTheory.IsProbabilityMeasure π] (mem : ProbabilityTheory.Kernel C R) [ProbabilityTheory.IsMarkovKernel mem] [Fintype C] [Fintype W] [Fintype R] {mp : LossyContext.MemoryProcess C R W} (h : mp.IsLosslessFor L) :
        mp.averageDifficulty L π ≤ (bayes L π mem).averageDifficulty L π

        Lossy memory cannot make comprehension easier on average.

        Erasure noise and information locality #

        noncomputable def FutrellGibsonLevy2020.pmi {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) (y w : W) :
        ℝ

        The pointwise mutual information of the next word w with the context word y, relative to the unigram distribution of the next word.

        Equations
        Instances For
          theorem FutrellGibsonLevy2020.surprisal_eq_sub_pmi {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) {y w : W} (h0 : (π.bind ⇑L).real {w} ≠ 0) (hy : (L y).real {w} ≠ 0) :
          InformationTheory.surprisal (L y) w = InformationTheory.surprisal (π.bind ⇑L) w - pmi L π y w

          Conditional surprisal is unigram surprisal less pointwise mutual information.

          noncomputable def FutrellGibsonLevy2020.erasure {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] (e : ↑unitInterval) :

          The erasure-noise memory process: the context word is erased with probability e, and the predictor reads a retained word through the language model and an erased one as the unigram distribution.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem FutrellGibsonLevy2020.expectedSurprisal_erasure {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {e : ↑unitInterval} {y w : W} (h0 : (π.bind ⇑L).real {w} ≠ 0) (hy : (L y).real {w} ≠ 0) :
            (erasure L π e).expectedSurprisal y w = InformationTheory.surprisal (π.bind ⇑L) w - (1 - ↑e) * pmi L π y w

            The exact single-dependency form of information locality: under erasure noise, difficulty is the unigram surprisal less the surviving fraction of the pointwise mutual information.

            theorem FutrellGibsonLevy2020.expectedSurprisal_erasure_sub_surprisal {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {e : ↑unitInterval} {y w : W} (h0 : (π.bind ⇑L).real {w} ≠ 0) (hy : (L y).real {w} ≠ 0) :
            (erasure L π e).expectedSurprisal y w - InformationTheory.surprisal (L y) w = ↑e * pmi L π y w

            The excess difficulty of erasure-noise processing over plain surprisal is the erased fraction of the pointwise mutual information.

            theorem FutrellGibsonLevy2020.locality {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {e e' : ↑unitInterval} {y w : W} (h : e ≤ e') (hpmi : 0 ≤ pmi L π y w) (h0 : (π.bind ⇑L).real {w} ≠ 0) (hy : (L y).real {w} ≠ 0) :
            (erasure L π e).expectedSurprisal y w ≤ (erasure L π e').expectedSurprisal y w

            Information locality: under progressive noise, a more distant context word having a larger erasure rate, difficulty increases with distance when the words are positively associated.

            theorem FutrellGibsonLevy2020.antilocality {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {e e' : ↑unitInterval} {y w : W} (h : e ≤ e') (hpmi : pmi L π y w ≤ 0) (h0 : (π.bind ⇑L).real {w} ≠ 0) (hy : (L y).real {w} ≠ 0) :
            (erasure L π e').expectedSurprisal y w ≤ (erasure L π e).expectedSurprisal y w

            Anti-locality: when the words are negatively associated, losing the context word lowers difficulty, so difficulty decreases with distance.

            theorem FutrellGibsonLevy2020.erasure_zero_isLosslessFor {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] :

            No erasure is the lossless comprehender who sees the context word.

            theorem FutrellGibsonLevy2020.erasure_zero {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {y w : W} :

            No erasure recovers surprisal.

            theorem FutrellGibsonLevy2020.erasure_one {W : Type u_1} [MeasurableSpace W] (L : ProbabilityTheory.Kernel W W) (π : MeasureTheory.Measure W) [MeasurableSingletonClass W] [Countable W] {y w : W} :
            (erasure L π 1).expectedSurprisal y w = InformationTheory.surprisal (π.bind ⇑L) w

            Certain erasure recovers the unigram prior: regression to prior expectations.