Autoregressive sequence models #
An autoregressive sequence model over an alphabet α gives, after every prefix, a distribution
over the next symbol or the end of the string, none [DTHP+23]. The prefix probability of a
string is the product of the conditional probabilities along it, and the probability of the
string itself multiplies in the probability of ending after it. The string probabilities need not
sum to one: the remaining mass leaks to sequences that never end. A model is tight when they do.
Tightness is a statement about survival, the probability that no end symbol appears in the first
n steps. The probabilities of the strings shorter than n and the survival at n sum to one,
so a model is tight exactly when survival tends to zero. Survival is the product of one minus the
end probability at each step given survival to it, so a model is tight exactly when that
conditional end probability reaches one or has a divergent sum; an end probability bounded below
by a divergent series suffices.
The model is a prediction rule on the extended alphabet, the end of the string absorbing, and
the Ionescu–Tulcea theorem gives the law of its whole trajectory, a probability measure on
infinite sequences of units or ends. Survival is the probability that none of the first n
units is the end, a string's probability is that of the trajectories that spell it and then end,
and the model is tight exactly when the trajectory ends almost surely, which is how
[DTHP+23] define tightness.
Main definitions #
AutoregressiveSequenceModel α: a Markov kernel from prefixes toOption α.condPrefixProb,prefixProb,stringProb,stringMeasure.IsTight: the string probabilities sum to one.survival,stopProb,eosHazard.after: the model after a context.rule,trajectory: the model as a prediction rule on the extended alphabet, and the law of its whole trajectory.
Main results #
condPrefixProb_append: the chain rule for prefix probabilities.sum_range_stopProb_add_survival,isTight_iff_tendsto_survival.survival_eq_prod: survival is a product over the conditional end probabilities.isTight_iff: tight exactly when the conditional end probability reaches one or has a divergent sum ([DTHP+23], Theorem 4.7).isTight_of_le_next_none: a divergent lower bound on the end probability gives tightness ([DTHP+23], Proposition 4.3).survival_le_pow: a constant lower bound makes survival decay geometrically.isTight_iff_of_next_none_eq: the criterion when the end probability depends only on length.stringMeasure_setOf_length_le,IsTight.stringMeasure_setOf_length_le: survival is at least, and in a tight model exactly, the probability of a string of at least that length.lintegral_length_le,IsTight.lintegral_length,lintegral_length_le_div: the expected length is at most, and in a tight model exactly, the total survival after the first step, and at most(1 - c) / cunder an end probability of at leastc.IsTight.tsum_prefixProb: in a tight model the prefix probabilities sum to the expected length plus one ([OCCW24]).trajectory_setOf_forall_lt_ne_none,trajectory_cylinder: survival and string probabilities as probabilities of the trajectory.isTight_iff_trajectory_setOf_forall_ne_none: tight exactly when the trajectory ends almost surely ([DTHP+23]'s definition).stringProb_append,IsTight.after,IsTight.stringMeasure_setOf_prefix: a string's probability factors through the model after its prefix, which inherits tightness, so in a tight model the strings extending a prefix have total probability its prefix probability.
Implementation notes #
- The alphabet need only be countable with measurable singletons; [DTHP+23] take it finite.
- The product criterion behind
isTight_iffisENNReal.tendsto_prod_range_one_sub_nhds_zero_iff, [DTHP+23]'s Corollary 4.6 extended to factors that may vanish. - [DTHP+23] count steps from one, so their conditional end probability at step
tiseosHazard (t - 1). Where survival is zero the ratio is0by the convention ofℝ≥0∞division; the characterization is unaffected, since survival first reaching zero forces a conditional end probability of one. - [DTHP+23] define tightness as zero mass on the infinite sequences under the trajectory
measure;
IsTightis the equivalent condition that the string probabilities sum to one, andisTight_iff_trajectory_setOf_forall_ne_noneis the equivalence.
References #
An autoregressive sequence model over the alphabet α: after each prefix, a distribution over
the next symbol, or the end of the string, none.
- next : ProbabilityTheory.Kernel (List α) (Option α)
The distribution of what follows a prefix.
- isMarkovKernel_next : ProbabilityTheory.IsMarkovKernel self.next
Instances For
Prefix and string probabilities #
The probability that the continuation of the context c begins with x: the product of the
conditional probabilities along x.
Equations
- M.condPrefixProb x✝ [] = 1
- M.condPrefixProb x✝ (a :: x_2) = (M.next x✝) {some a} * M.condPrefixProb (x✝ ++ [a]) x_2
Instances For
The chain rule: a continuation begins with x ++ y when it begins with x and the
continuation of c ++ x begins with y.
The prefix probability of x: the probability that a generated string begins with x.
Equations
- M.prefixProb x = M.condPrefixProb [] x
Instances For
The probability of generating exactly x: its prefix probability times the probability of
ending after it.
Equations
- M.stringProb x = M.prefixProb x * (M.next x) {none}
Instances For
The law of the generated string, carried by the finite strings.
Equations
- M.stringMeasure = MeasureTheory.Measure.sum fun (x : List α) => M.stringProb x • MeasureTheory.Measure.dirac x
Instances For
An integral against the law of the string is a sum weighted by the string probabilities.
A model is tight when its string probabilities sum to one: no mass leaks to sequences that never end.
Equations
- M.IsTight = (∑' (x : List α), M.stringProb x = 1)
Instances For
Continuations #
The model after the context c: after each prefix u it continues as the model does after
c ++ u.
Equations
Instances For
A model whose every continuation has positive probability gives every prefix positive probability.
The strings extending x have total probability the prefix probability of x times the
total probability of the model after x.
Survival #
The probability that no end symbol appears in the first n steps: the total prefix
probability of the strings of length n.
Equations
- M.survival n = ∑' (x : { x : List α // x.length = n }), M.prefixProb ↑x
Instances For
The probability of generating a string of length n.
Equations
- M.stopProb n = ∑' (x : { x : List α // x.length = n }), M.stringProb ↑x
Instances For
The probability of ending after n symbols given survival to that point, the end
probability at step n + 1 of [DTHP+23].
Instances For
After any prefix the model either ends or continues with some symbol.
The conditional end probability #
A model is tight exactly when the conditional end probability reaches one or has a divergent sum ([DTHP+23], Theorem 4.7).
The strings of length n end with probability at least c times survival to n when every
prefix of length n ends with probability at least c.
A model whose end probability after every prefix of length t - 1 is at least f t, for a
divergent series of bounds, is tight ([DTHP+23], Proposition 4.3).
When the end probability after a prefix depends only on its length, survival is the product of one minus it.
When the end probability after a prefix depends only on its length, the model is tight exactly when that probability reaches one or has a divergent sum.
An end probability of at least c after every prefix makes survival decay geometrically.
The string probabilities of any model sum to at most one.
Surviving n steps after x is surviving n + |x| steps through x.
The model after a prefix of positive probability inherits tightness.
In a tight model the strings extending x have total probability its prefix probability.
Expected length #
The law of the generated string is a sum of point masses, so an integral against it is a sum
weighted by the string probabilities. Survival to n is at least the probability of a string of
length at least n, with equality in a tight model, so the tail-sum formula bounds the expected
length by the total survival after the first step.
Survival to n is at least the probability of a string of length at least n.
In a tight model survival to n is the probability of a string of length at least n.
The expected length of the generated string is at most the total survival after the first step.
In a tight model the expected length is the total survival after the first step.
In a tight model the prefix probabilities sum to the expected length plus one, the normalizing constant of the prefix distribution ([OCCW24], Proposition 1).
An end probability of at least c after every prefix bounds the expected length by
(1 - c) / c.
The trajectory #
The model is a prediction rule on the extended alphabet, with the end absorbing, and the law of its whole trajectory is the Ionescu–Tulcea trajectory measure of that rule.
The model as a prediction rule on the extended alphabet: after a history of units it draws the next unit, and after the end of the string it stays at the end.
Equations
Instances For
After a history of units the rule is the model's next-unit distribution.
The mass of a history of units is its prefix probability.
Survival to n is the law of the first n draws on the histories of units.
The law of the whole trajectory of the model: the units it generates one after another, with the end of the string absorbing.
Equations
Instances For
Survival to n is the probability that none of the first n units is the end.
The probability that the string never ends is the infimum of survival.
A model is tight exactly when its trajectory ends almost surely, [DTHP+23]'s definition of tightness.
The probability of generating exactly the string List.ofFn f is the probability that the
trajectory begins with its units and then ends.