Active Inference InstituteSimulations

Beyond the textbookIntermediateNew edition

The cochlea listens

Hearing is active. The inner ear amplifies faint sounds far more than loud ones, and the brain can turn that amplifier up or down. In this model the brain predicts the next tone, turns the ear down where it knows what is coming, and turns it up where it expects to learn something.

Tone, and the lower of two tones. Moves the glowing place.
The model’s input in decibels. Your loudspeaker is not calibrated.
How far the brainstem turns the amplifier down, everywhere.
Or click the cochlea. The ring marks it.

Measurements from the same model

Now

AII: EduActive · Watch, then do

Three short clips, three things to try

These three passages come from the Institute’s book and model streams, where members talk through a textbook chapter and a published tutorial. Each is between one and a half and three minutes. They are about the listener in this model, the part that predicts the next tone, and not about the mechanics of the inner ear. Watch one, then press its button and look for the same thing on the stage.

  1. Plays here, from 2:42. Nothing loads from YouTube until you press play.Open on YouTube at 2:42

    Before you start

    Predicting the next note

    When you listen to a tune you are already guessing the next note. What stands out is the gap between the note you expected and the note that was played. A listener can be modelled as something that makes these guesses and then compares them with what arrives.

    Listen for
    the predictions we get from our anticipation of the following notes, as opposed to the actual notes that’s being played
    Then try
    One tone is about to repeat, with a higher one now and then. Before each tone, say which you expect. Then watch the red flashes, which show how surprised the listener is, and see what happens to them as the sequence goes on.
    In the model equation 4

    The passage introduces the first example in chapter 7 of the textbook: a person listening to an amateur musician. That model has a likelihood matrix A, from the true note to the note heard, and a transition matrix B, which gives the probability of going from one note to the next.

    The listener on this page is simpler. It has no transitions. It keeps a count of the tones heard in each of eight bands, and its prediction for the next tone is each band’s share of the counts. Surprise is the negative log of the probability it gave to the tone that came. It can learn which tones are common and cannot learn a melody.

    Equation 4, the listener’s prediction

  2. Plays here, from 105:50. Nothing loads from YouTube until you press play.Open on YouTube at 105:50

    While it runs

    Beep, beep, beep, boop

    Play the same beep several times and a listener comes to expect it. A different sound, a boop, then breaks that expectation. There can also be a slower pattern in how often the boops come, and a listener who has learned that pattern can be surprised when it is broken.

    Listen for
    At the fast time scale you could be surprised that there’s a boop at the end of four beeps.
    Then try
    Run the sequence again and count the standard tones before each deviant. Predict which deviant will flash brighter: one that comes early, or one that comes after a long run of standards. Then check the surprise trace below the stage.
    In the model equation 4

    In the task described, tones come in groups of five. A listener can be surprised at two time scales: by the last tone of a group, or by a group that breaks the pattern of the groups before it. The tutorial’s model has two levels for that reason, and it goes on to simulate brain responses measured at the scalp.

    This page has one level. Its tones are not grouped: each tone is the 1,000 Hz standard or, with probability 0.15, the 2,000 Hz deviant. The listener keeps a single count for each band over the whole sequence, so it registers the fast kind of surprise and has nothing with which to learn a slower pattern. The trace shows its surprise in nats. The page does not claim that this is a brain response.

    Equation 4, the listener’s prediction

    Further viewing: the same task introduced, with the two brain responses it is used to separate, 103:07

  3. Plays here, from 43:07. Nothing loads from YouTube until you press play.Open on YouTube at 43:07

    Afterwards

    Attention as precision

    Attention can be described as a setting of confidence. To attend to something is to treat the signal from it as more reliable, so that it changes your beliefs more. The example in this clip is visual, not auditory: a square on a screen that people often miss while they are busy watching something else.

    Listen for
    We just manipulated attention, where attention corresponds to basically how precise the model’s A matrix was.
    Then try
    On this page attention is given to a band of pitch, not to a place on a screen. Predict what the glow will do when a deviant arrives in the attended band. Then watch a few deviants and read the gain of that band.
    In the model equation 5

    In the tutorial, attention is the precision of the likelihood matrix A: how sharply an outcome points to one hidden state. The task is a visual one, inattentional blindness, and what the model is asked to reproduce is a late brain response, the P3, together with whether the square is reported.

    Here precision is a number for each band, Πb. Attention multiplies the attended band’s precision by 2, and the amplifier’s small-signal gain in that band rises in proportion. That step from precision to the gain of the inner ear is this page’s own illustration, as the notes under “What this model leaves out” say. The listener’s likelihood is not made sharper, and no brain response is simulated.

    Equation 5, precision sets the gain

The quoted lines are taken from the automatic captions, with punctuation added and hesitations removed. The speakers are discussing a textbook example and a tutorial model, not this page; where the two differ, the notes say so. Each clip stops at the end of the passage. The full recordings are listed under Sources.

Learn by doing

Try this

  1. Play a quiet tone, then a loud one. Before you press, guess which gets more help from the amplifier. Watch how bright and how narrow the glow is each time. In the measurements below the stage, the pale dashed outline on the ribbon is the same ear with its amplifier off. Compare the two, and read “Gain from the amplifier”.
  2. Sweep a chirp. A chirp glides from high to low pitch. Predict which way the light will travel along the spiral. High frequencies peak near the base, by the middle ear, and low ones near the apex.
  3. Run the oddball sequence. The same tone repeats, and now and then a higher one replaces it. Each tone flashes red in proportion to its surprise. Watch the flashes shrink as the listener learns the standard, and jump at each deviant. Watch the violet row of outer hair cells too: it dims in the band the listener can predict. The surprise trace and the violet bars below the stage give the numbers.
  4. Attend to the deviant’s band. Attention here means affording a band more precision. Predict what happens to the glow when a deviant arrives.
  5. Switch the amplifier off. Guess what a quiet tone will look like without outer hair cells at work. The glow turns dim and broad, the violet row goes dark and the resting shimmer stops. Then read the gain, the growth of response and the sharpness of tuning.
  6. Lose the outer hair cells of the basal turn, then restore them. Damage often takes this pattern, with high frequencies going first. Move the selected place across the damaged edge and read the threshold shift. Press “Hair cells” on the stage to look at the damaged stretch closely.

The mathematics

What is being computed

Five equations run this page. The numbers under each are the current ones, so you can check the arithmetic.

1 · Where each frequency lands (Greenwood 1990) F(x)=A(10ax−k),x=1alog10(FA+k)

x is the position along the basilar membrane as a proportion of its length, measured from the apex. F is the frequency, in hertz, that excites that place best. For a human ear A = 165.4, a = 2.1, k = 0.88, and the membrane is 35 mm long.

2 · The amplifier at one place (Eguíluz et al. 2000; Hudspeth 2008) z˙=(μ+iω0)z−|z|2z+Feiωt R2[(μ−R2)2+d2]=F2,d=ω−ω0=ω0(fCF−1)

Each place on the membrane is an oscillator with complex amplitude z. Its own frequency is ω₀, the sound drives it with force F at frequency ω, and μ says how close it sits to the point where it would start to ring by itself (the Hopf bifurcation, at μ = 0). The second line is the steady size R = |z| of the response; d is the mistuning between the tone f and the place’s best frequency CF. Time at each place is counted in its own unit, so that ω₀ = 8 everywhere. The force is F = |μon|3/2·10(L−30)/20 for an input of L decibels. When several tones sound together, each sees μ lowered by twice the summed R² of the others.

3 · Compression: quiet sounds get the most gain R(R2−μ)=F,dlnRdlnF=R2−μ3R2−μ

This is equation 2 for a tone exactly at the place’s best frequency (d = 0). At the bifurcation, μ = 0, it gives R = F1/3: the response grows by only one third of a decibel per decibel, and the gain R/F = F−2/3 is largest for the faintest sounds. Far from the bifurcation the response is F/|μ|: one decibel per decibel, and no gain.

4 · The listener’s prediction and its two surprises P(b∣past)=αbα0,surprise=−lnP(b∣past) DKL[posterior‖prior]=−lnP(b∣past)+ψ(αb+1)−ψ(α0+1)

The listener divides the membrane into eight bands of equal length and keeps a count αb of the tones heard in each band, starting from one in each (a Dirichlet distribution). α₀ is the sum of the counts. Its prediction for the next tone is the share of counts in each band. Surprise is the negative log of the probability it gave to the tone that came. Bayesian surprise is how far that one tone moved its beliefs: the Kullback–Leibler divergence from the beliefs before to the beliefs after; ψ is the digamma function. Both are exact here.

5 · Precision sets the gain lnΠb=κ(−lnPb−lnB)+lnab−Eln1020,μb=μonΠb,ξ=Πbε

Πb is the precision the listener affords band b: the weight it gives to what arrives there. A band predicted more strongly than chance (Pb above 1/B, with B = 8 bands) is turned down; a band where a tone would be surprising is turned up; κ = 0.5. Attention multiplies the attended band’s precision by ab = 2. The first two terms together are kept within a factor of four either way. E is the efferent attenuation in decibels. Because the small-signal gain of the oscillator is 1/|μ|, dividing μ by Π makes gain proportional to precision. ε = 1 − P is the prediction error for the band that sounded, and ξ is that error weighted by precision. Where outer hair cells are lost, μ stays at μoff whatever Π is.

Reading

Where this comes from

What is established

Each frequency excites one stretch of the basilar membrane best, high frequencies near the base and low ones near the apex. Greenwood (1990) fitted the map used here to measurements in several species.

The ear has an active process. Outer hair cells feed energy into the membrane’s motion. The result is amplification of faint sounds, sharp tuning, and compression of a very wide range of sound levels into a narrow range of motion. Hudspeth (2008) reviews the evidence, and Eguíluz and colleagues (2000) showed that these features follow together if each place sits close to a Hopf bifurcation.

The brain controls this process. Medial olivocochlear fibres run from the brainstem to the outer hair cells and reduce the amplifier’s gain, most of all for quiet sounds (Guinan 2006).

In active inference, precision is the confidence placed in a signal, and it acts as a gain on prediction errors. Attention is the setting of that gain (Feldman & Friston 2010). Turning the gain down on sensations one can predict is called sensory attenuation (Brown et al. 2013). The brain’s response to an unexpected tone, the mismatch negativity, has been modelled as a prediction error or belief update (Garrido et al. 2009; Lieder et al. 2013). Friston and colleagues (2021) and Holmes and colleagues (2021) treat listening itself, and selective attention to speech, as active inference.

What this model leaves out

The link between the listener and the ear is this page’s own simplest choice. No published model fits a rule from predicted probability to olivocochlear gain, and experiments on whether attention changes the human cochlea give mixed results. Read equation 5 as an illustration of precision as gain, not as a finding.

The surprise trace is the listener’s exact surprise. That such quantities map onto an evoked potential measured at the scalp is the modelling claim tested by Lieder and colleagues (2013). This page does not demonstrate it. Their models are also richer: they learn transitions between tones and include forgetting, and they compare several candidate quantities. This listener only counts.

The oscillators here are not coupled through the cochlear fluid. Each responds on its own, at its steady state, so onsets and ringing are left out. The delay that makes the fine structure appear to travel is drawn in, as three cycles of each place’s best frequency; it is not computed. A single oscillator also ties gain to sharpness: both change by the same factor. A real ear has more gain than the 26 dB here, and a real passive membrane cuts off steeply on the apical side of the peak.

Tones that sound together interact only through suppression. Distortion tones made by the ear, and spontaneous emissions (μ above zero), are left out. Harmonics of a vowel are treated as unrelated tones. The middle ear, the inner hair cells’ own transduction and the auditory nerve are not modelled; the hair cells on the stage move with the computed membrane response, with their motion enlarged, and the nerve pulses are drawn at a rate set from that response by the rule stated under the stage. The resting shimmer, the afterglow and the blood moving in the stria are illustrative. The spiral is a plan view with proportions close to those of a human cochlea, not a reconstruction of one. Input levels are the model’s own decibels: a loudspeaker or microphone on a web page is not calibrated.