Md. Asif Uddin
    Problem I.10.B03

    How long a forget gate remembers

    limit▲▲△

    Exact values where possible; six decimal places for non-exact numerical results.

    STATEMENT

    Turn a constant forget value into a number of steps, bound that number, and find the forget value and bias a given horizon requires.

    GIVEN

    One coordinate’s forget value is f∈(0,1)f\in(0,1) at every step. The carry-line factor after nn steps is fnf^n. The memory horizon is m=−1/ln⁡fm=-1/\ln f.

    FIND

    (a) f100f^{100} and f1000f^{1000} for f=0.99f=0.99, with its horizon and half-life. (b) Bounds on mm in terms of ff. (c) The smallest ff with m≥100m\geq100, and the bias that produces it when the gate’s other inputs are zero. (d) The behaviour of mm as f→1f\to1 and as the bias grows.

    STRATEGY

    Write fn=enln⁡ff^n=e^{n\ln f} and use ln⁡x≤x−1\ln x\leq x-1 twice. For the bias, invert the sigmoid.

    SOLUTION

    (a) Directly, 0.99100=0.3660320.99^{100}=0.366032 and 0.991000=4.317125×10−50.99^{1000}=4.317125\times10^{-5}. The horizon is −1/ln⁡0.99=99.499162-1/\ln0.99=99.499162 steps. The half-life solves fn=1/2f^n=1/2, so n1/2=ln⁡2/(−ln⁡f)=mln⁡2=68.967564n_{1/2}=\ln2/(-\ln f)=m\ln2=68.967564 steps.

    (b) The inequality ln⁡x≤x−1\ln x\leq x-1 is strict for x≠1x\neq1. At x=fx=f it gives −ln⁡f>1−f-\ln f>1-f. At x=1/fx=1/f it gives ln⁡(1/f)<1/f−1\ln(1/f)<1/f-1, that is, −ln⁡f<(1−f)/f-\ln f<(1-f)/f. Taking reciprocals,

    f1−f<m<11−f.\frac{f}{1-f}<m<\frac{1}{1-f}.

    The two bounds differ by exactly one, so 1/(1−f)1/(1-f) gives the horizon to within a step. For f=0.99f=0.99 they are 9999 and 100100.

    (c) The condition m≥100m\geq100 is −ln⁡f≤1/100-\ln f\leq1/100, so f≥e−1/100=0.990050f\geq e^{-1/100}=0.990050. A gate with only its bias has f=σ(b)f=\sigma(b), so b=ln⁡(f/(1−f))=4.600166b=\ln\big(f/(1-f)\big)=4.600166.

    (d) As f→1f\to1, −ln⁡f→0+-\ln f\to0^+ and m→∞m\to\infty; by (b), mm grows like 1/(1−f)1/(1-f). With f=σ(b)f=\sigma(b), (I.10.5) gives 1/(1−f)=1+eb1/(1-f)=1+e^b. Each extra unit of bias multiplies the horizon by about ee, but no finite bias reaches f=1f=1.

    Answer

    (a) 0.3660320.366032, 4.317125×10−54.317125\times10^{-5}; horizon 99.49916299.499162; half-life 68.96756468.967564. (b) f/(1−f)<m<1/(1−f)f/(1-f)<m<1/(1-f). (c) f≥0.990050f\geq0.990050, bias at least 4.6001664.600166. (d) m→∞m\to\infty like 1/(1−f)=1+eb1/(1-f)=1+e^b, never infinite at finite bb.

    Check — sanity

    At f=1/2f=1/2 the bounds give 1<m<21<m<2, and indeed m=1/ln⁡2≈1.44m=1/\ln2\approx1.44. A zero forget bias forgets most of a value within two steps.

    Where this breaks

    A trained gate’s value changes with the input, so the horizon of a real cell is a distribution over steps, not a constant. The bound also concerns the carry line only; I.10.B02 shows the full derivative can be several times larger or smaller.

    Variation

    For a horizon of exactly mm in the sense of 1/(1−f)=m1/(1-f)=m, set b=ln⁡(m−1)b=\ln(m-1). For m=100m=100 that is ln⁡99=4.595120\ln99=4.595120, slightly below the answer to (c), because 1/(1−f)1/(1-f) exceeds −1/ln⁡f-1/\ln f.

    Draws on