We study the a.s. exponential stability of the optimal filter w.r.t. i
ts initial conditions. A bound is provided on the exponential rate (eq
uivalently, on the memory length of the filter) for a general setting
both in discrete and in continuous time, in terms of Birkhoff's contra
ction coefficient. Criteria for exponential stability and explicit bou
nds on the rate are given in the specific cases of a diffusion process
on a compact manifold, and discrete time Markov chains on both contin
uous and discrete-countable state spaces. A similar question regarding
the optimal smoother is investigated and a stability criterion is pro
vided.