Anika is up to her wrists in dough in a Bengaluru kitchen. Her phone is propped against a steel canister on the far side of the counter, about two metres away, and the exhaust fan above the stove is running. A pan is hissing. Her hands are too wet and sticky to touch the screen, so she says, in the voice you use to talk across a room, "Hey Siri, set a timer for twelve minutes." The phone lights up, a small chime plays, and a timer appears.
That looks like a phone that heard a sentence. It isn't. For the whole hour before she spoke, the phone was also listening, to the fan, to the radio in the next room, to her husband on a call, and it did nothing with any of it. Somewhere in the device a program was asking, about a hundred times every second, whether the last fraction of a second of sound looked like the start of two particular words. Such a program is a wake word detector (Apple calls it a voice trigger), and its job is awkward in three ways at once. It has to run all day on a battery, so it can't use much power. It has to say yes to Anika's wet-handed, far-away, fan-drowned voice nearly every time. And it has to say no to nearly everything else it will ever hear, including people talking about Siri on television and a stranger in the room saying the same two words.
So the question this chapter answers is: how does a phone listen all day for two words, on a battery, and still wake up for Anika across a noisy kitchen while ignoring almost everything else?
We'll build the design the way an engineer would, starting from the most obvious version, a speech recogniser that never stops, and fix each failure in turn. That takes us to a tiny neural network that only knows one phrase, to the two-stage cascade in which a tiny model on a low-power chip decides when to wake a bigger one, and to the arithmetic of false accepts per hour against false rejects that sets the threshold. Then we cover speaker verification with embeddings, the shrinking of the network to a few kilobytes, the checks that run after the trigger, and how the data was collected and the system evaluated. We rely on Apple's published papers and posts and on Google's earlier work on the same problem, and we say plainly where Apple's internals are unpublished.
01What we're building, and how big
1.1 What it has to do
The detector sits between a microphone and the rest of the assistant. When the phrase is spoken it hands over control, and the rest of Siri, which in Apple's description runs mostly on servers for recognition and language understanding, handles whatever Anika says next. Everything the detector does has to be judged against four requirements that pull against each other.
First, it must be accurate in the right direction. Two different mistakes are possible. A false reject is Anika saying the phrase and nothing happening, which costs her a repeated sentence and a little trust. A false accept (or false alarm) is the phone waking up when nobody asked, which costs battery, and, worse, may send a stranger's audio to a server. Apple's 2017 post says it is trying to estimate false-alarm rates "as low as one per week", while a person who says the phrase on purpose expects it to work almost every time.
Second, it must run in a tiny power budget, because the microphone never stops. Third, it must be fast: the chime has to arrive close to when she finishes the phrase, and the detector also decides where the recording of her request begins. Fourth, it should work for her. In a house with several people it shouldn't wake for everybody who says the phrase. It also has to cope with devices as different as an iPhone on a counter, a watch on a wrist and a pair of earbuds.
1.2 How big is it?
Apple hasn't published how many devices run the detector or how often it triggers, so we won't invent either. What the sources do give us are the parameters of the problem. In the 2017 post the microphone is sampled at 16,000 values a second, and spectrum analysis turns that stream into frames, each describing about one hundredth of a second of sound. That makes 100 frames a second, 8.6 million a day. About twenty consecutive frames, a fifth of a second of audio, go into the network at a time.
On the other side is the battery. Google described the same constraint in a 2017 paper on its own cascade detector (Gruenstein et al., NIPS 2017). Typical mobile batteries hold between 1,000 and 2,400 milliamp-hours, and "in the best case our entire system must consume less than 1mA to consume less than 1% of the battery per day". Check it: 1 mA for 24 hours is 24 mAh, or 1% of 2,400 mAh. So the always-listening system gets about one milliamp, averaged over the day.
Suppose a model good enough to detect the phrase reliably costs, running on the phone's main processor, an illustrative 20 mA (neither Apple nor Google publishes such a figure). Run it continuously on a 2,400 mAh battery. What share of the battery does it use in a day, and how much cheaper does the always-on part need to be to meet a 1% budget?
Show the answer
20 mA for 24 hours is 480 mAh, which is 20% of the battery, just for listening. A 1% budget is 24 mAh a day, an average of 1 mA, so we have to cut the average by a factor of 20 at least. Making the model 20 times smaller would hurt its accuracy badly, so something else has to give: most of the time the big model should not be running at all.
That conclusion gives the whole design its shape. Something very small and very cheap must watch the audio continuously, and the large model should wake only when the small one has a reason to ask it.
Apple's papers give no power figures for its chips, only the structure of the solution, so we'll start from that. First, though, notice what the accuracy requirement implies for measurement. A false-alarm target of one per week is a statement about 168 hours of ordinary audio, so testing it takes weeks of recordings that don't contain the phrase. We come back to that in section 05, because it decides how the threshold is set.
02Version 1: a speech recogniser that never stops
The obvious first design uses what already exists. A phone can transcribe speech, so keep transcribing. Turn the microphone on, feed the audio to the speech recogniser, and every time the transcript contains "hey siri", start the assistant. It needs almost no new code and it handles any accent the recogniser handles.
It fails on power first. A large-vocabulary recogniser exists to turn any sentence in a language into text, so it's big. In the Google paper that introduced neural-network keyword spotting (Chen, Parada and Heigold, ICASSP 2014), the recogniser used to label training data had 50 million parameters. If each of those parameters were used once per frame, that is about 5 billion multiply-adds a second, roughly 4,000 times the work of the 13,979-parameter detector Apple's engineers later describe. That's an estimate from parameter counts, and it ignores everything a real recogniser does besides its network, so if anything it understates the gap. That paper also points out that keyword spotters built on full recognisers were designed for offline processing of recorded audio, since running one with no delay on a phone wasn't realistic.
Sending the audio to a server instead fixes the processing and breaks two other things. A phone that streams everything it hears to a server all day is a privacy problem that no amount of engineering makes comfortable, and a radio that stays on is a battery problem of its own. Apple's 2017 post describes the opposite design: the detector lives on the device, and Siri's servers only hear audio after the phrase has been detected.
Even with unlimited power, recognising whole sentences is more than the job needs. Our detector only has to answer one yes-or-no question, "did the last second contain these two words?", and a model that knows only that question can be thousands of times smaller than one that knows a language. The next few sections make that idea concrete.
| Where the listening happens | Plus | Minus |
|---|---|---|
| Full recogniser on the phone, always on | No new model; handles any wording | Far too much computation to run continuously on a battery |
| Stream audio to a server, always on | Phone does almost nothing | Radio and privacy costs; every sound leaves the device |
| A small model that knows one phrase, on the device | Cheap enough to run all day; audio stays local until it triggers | Needs its own training data; must be tuned for false alarms |
Apple chose the third row, and so did Google in the 2014 paper, which describes the goal as a system that "listens continuously for specific keywords" with a "small memory footprint, low computational cost, and high precision". Siri's detector still leans on the server in one way, which we meet in section 08: after the phone starts a request, the server's full recogniser can reject a false trigger and tell the phone to go back to sleep.
03Version 2: a small model that knows one phrase
We want a model that does nothing but recognise "Hey Siri", cheaply and continuously, and the way to get there is to chop the problem into the smallest repeated question we can. Every hundredth of a second, look at the last fifth of a second of sound and say which part of the phrase, if any, it sounds like. Doing that again and again produces a stream of answers, and a second, much simpler step watches the stream for the right answers arriving in the right order.
3.1 From sound to frame posteriors
Raw audio is 16,000 numbers a second, far too much detail and far too little structure. A signal-processing front end summarises each short stretch of sound as a vector describing how much energy it has in each of a few dozen frequency bands, roughly the way the ear separates pitch. Google's paper uses 40 such numbers (log filterbank energies) every 10 milliseconds over a 25 millisecond window. Apple's papers describe frames of about 0.01 seconds, and one of them uses 13 mel-frequency cepstral coefficients, a related summary. Either way we end up with a short vector per frame, 100 times a second.
One frame can't be recognised on its own, since a hundredth of a second is shorter than any speech sound. So the network sees a window of neighbouring frames glued together, about twenty of them (0.2 seconds) in Apple's 2017 post. That choice has a latency cost that's easy to miss. If the window includes frames after the current one, the system has to wait for them before it can answer about the current moment. Google's paper says so directly, "each additional frame of future context adds 10 ms of latency to the system", and so it used 30 frames of the past and only 10 of the future.
The network is a plain fully connected one. In Apple's account it has five hidden layers of identical size, 32, 128 or 192 units depending on the device's memory and power limits, and its output layer gives a probability for each of about 20 sound classes. Those classes come from the phrase itself. Each speech sound in "Hey Siri" is split into three states, a beginning, a middle and an end, so that the network learns separately what the start of a sound looks like and what its tail looks like. One more class stands for silence and one large class stands for every other speech sound. A later Apple paper (Higuchi et al., 2020) makes this concrete with a reference network of five layers of 32 units and 20 classes: one for silence, one for general speech and 18 for the phrase, from six sound units with three states each. It has 13,979 parameters.
At each frame the network outputs 20 probabilities that sum to one, the frame's posteriors: the probability of each class given the sound around that frame. Training needs the correct class for every frame, and this is where the big recogniser gets used, once. Apple's post says the frame-level labels come from the main speech recogniser, which aligns the transcript of each training recording with its audio, and Google's paper does the same with its 50-million-parameter recogniser. We then train the network to maximise the log probability of the right label at every frame, the standard cross-entropy criterion. In Chen's notation, with the network's posterior for label at frame and the label that alignment gave to frame :
Training moves the weights to make as large as possible. Each term is the log of the probability the network gave the correct answer for one frame, so a network that's confidently right everywhere scores near zero and every confident mistake costs a lot.
3.2 From posteriors to one score
We now have a stream of 20 probabilities every hundredth of a second and need one number that says how much the last second looks like the whole phrase. Google's recipe has two steps. First smooth each class's posterior by averaging it over the most recent 30 frames, since single-frame values are noisy. Then, over a longer window of 100 frames, take the largest smoothed value each phrase class reached and combine them as a geometric mean. In symbols, with the smoothed posterior of class at frame , the number of phrase classes, and the current frame:
With a geometric mean, one phrase class that never fired drags the product down, and we want that: every piece of the phrase must have been heard. That gives a number between zero and one, and the detector fires when it passes a threshold. Google chose the two window sizes on a development set, and "the performance was not very sensitive to the window sizes".
Notice what this formula doesn't check, as the paper itself says: it "does not enforce the order of the label sequence". Each class gets its best moment independently, so the pieces could arrive in any order. Stacked frames inside the network carry some context, but nothing in the score insists that "hey" comes before "siri". A later Google paper (Gruenstein et al., 2017) fixes this by taking the largest product of smoothed posteriors subject to the constraint that the units fire in the same order as in the keyword:
Here is the number of units in the keyword, is the posterior track for unit , is the smoothing window, and the times are the moments at which each unit is judged to have fired, forced into the right order. Searching all possible orderings sounds expensive, but it isn't. It's a dynamic programme: to find the best way to place the first units by time , extend the best way to place the first units by some earlier time. Apple's 2017 post describes its own version of the same idea, derived from hidden Markov models (HMMs). A recurrent top layer keeps, for each state of the phrase, the best accumulated score of any path through the states so far:
Here is the network's log probability that frame belongs to the sound class of state . One option in the maximum stays in state for another frame at a cost , and the second moves forward from state at a cost . Apple's post says the stay and move costs come from segment durations in the training data, so a phrase spoken with absurd rhythm scores worse. A frame's score is at the last state, and "the score peaks just after the full phrase has entered the system". Log probabilities turn products into sums, which is cheaper and more stable, and the post says the output layer is arranged to give log probabilities directly.
The experiment below makes the ordering point visible. It builds fake posterior streams for a six-unit phrase, with the units firing in the right order, in reverse and in random order, and scores each with both formulas.
Try it Score fake posteriors with and without the order constraint
import numpy as np
rng = np.random.default_rng(3)
M, T = 6, 150 # 6 phrase units, 150 frames of 10 ms
def frames(order):
# fake posteriors: 6 phrase units + background, one unit per 14 frames
z = rng.normal(0, 1, (T, M + 1))
z[:, M] += 2.0
for k, u in enumerate(order):
a = 30 + 14 * k
z[a:a + 14, u] += 5.0
z[a:a + 14, M] -= 4.0
p = np.exp(z)
return (p / p.sum(1, keepdims=True))[:, :M]
def smooth(p, w=30):
out = np.empty_like(p)
for j in range(T):
out[j] = p[max(0, j - w + 1):j + 1].mean(0)
return out
def any_order(p): # Chen et al. 2014, eq. (3)
return np.prod(smooth(p)[-100:].max(0)) ** (1 / M)
def in_order(p): # Gruenstein et al. 2017, eq. (1)
s = np.log(smooth(p)[-100:] + 1e-9)
best = s[:, 0]
for i in range(1, M):
best = np.maximum.accumulate(best) + s[:, i]
return np.exp(best.max() / M)
cases = {"phrase in order": list(range(M)),
"same units reversed": list(range(M))[::-1],
"units in random order": list(rng.permutation(M))}
print(f"{'':22}{'any order':>10}{'in order':>10}")
for name, order in cases.items():
r = np.mean([(any_order(p), in_order(p))
for p in (frames(order) for _ in range(200))], 0)
print(f"{name:22}{r[0]:10.2f}{r[1]:10.2f}")
p = rng.dirichlet(np.ones(M + 1) * .3, T)[:, :M]
print(f"{'background only':22}{any_order(p):10.2f}{in_order(p):10.2f}")
0.45 for the phrase, for the reversed phrase and for a random shuffle, because each unit fires strongly somewhere in the window and the formula can't tell where. The in-order score drops from 0.45 to 0.17 for the reversal and to 0.14 for the shuffle, close to the 0.17 it gives to background alone.Only the in-order score separates "hey siri" from the same sounds in a different arrangement, since every unit fires strongly somewhere in the window and the any-order formula can't tell where. That extra care is cheap: the dynamic programme needs one running value per phrase state per frame, a few dozen numbers.
| Turning frame posteriors into a decision | Plus | Minus |
|---|---|---|
| Keyword and filler HMM with Viterbi decoding | Needs no keyword-specific data at training time | Needs a decoder at run time; bigger network over thousands of states |
| Smooth, take the max, geometric mean (Google, 2014) | No decoder; one decision every 10 ms | Ignores the order of the sounds |
| Ordered score by dynamic programming (Apple 2017, Google 2017) | Rejects the right sounds in the wrong order; a few dozen running values | Needs sub-phrase labels and tuned stay and move costs |
Google's 2014 paper compared its direct approach with a keyword and filler HMM built on the same kind of network. At a false-alarm rate of 0.5% the direct approach had a 45% lower false-reject rate, and it kept a 39% advantage with babble noise added at 10 dB signal-to-noise ratio, without needing a decoder at all. Apple's 2017 post took the other route: its network estimates probabilities over sound classes and a dynamic programme over a left-to-right model of the phrase does the temporal integration, which the post calls "comparatively cheap" next to the network. Section 07 returns to networks that skip the separate scoring step.
Scoring a long stream as a sequence of small windows, then watching the small decisions for a pattern, is how almost every streaming detector works. Fraud systems score each event and then watch for a run of suspicious ones, and speech recognisers use the same dynamic programme over a much larger set of states.
04Two passes: a tiny model decides when to wake a bigger one
Our small network is cheap, but cheap is not the same as accurate. At the false-alarm rate we need, a 32-unit network misses more of Anika's phrases than a 192-unit one does, and the bigger network costs several times as much per frame. On the numbers from the previous section, five layers of 32 units over a 247-value input is about 13 thousand weights, and five layers of 192 units over the same input is roughly 200 thousand, roughly 15 times as many. (The second figure is our arithmetic on the same input size; the papers don't state it.) We want the accuracy of the large one with the power draw of the small one, and a cascade gives us a way to have both.
The two models get different jobs. The small one runs all the time, and its one duty is to not miss the phrase. It may be wrong in the other direction, firing on things that merely sound a bit like the phrase, as long as it doesn't do so often. Whenever it fires, it wakes the large model, which studies the recent audio and makes the careful final call. Since the large one runs only when the small one fires, its cost gets spread over many hours of silence.
4.1 The hardware half
A cascade only saves power if the first stage is on a different, cheaper piece of hardware, and the 2017 post describes that. On iPhones from the 6s onward, the first detector runs on the Always On Processor, "a small, low-power auxiliary processor, that is, the embedded Motion Coprocessor". It runs a small version of the acoustic model, in the post's first configuration five layers of 32 units. When its score passes a threshold, it wakes the main processor, which runs a second detector with five layers of 192 units. Apple Watch, which has far less compute to spare, uses a single detector with a model of intermediate size, takes only about 5% of the limited compute budget, and runs only after the watch's motion coprocessor detects a wrist-raise gesture. A wrist raise is a different kind of first stage, a cheap sensor event that says someone might be about to talk.
Google's 2017 paper shows the same split with more of the engineering exposed. Its first stage runs on a DSP, a low-power signal-processing chip with typically 128 kB of memory, "buffering enough audio to safely fit the keyword (typically 2 seconds)". When it fires it hands that buffer to a larger model on the main processor and keeps streaming the audio that follows. Two points in the paper explain why this works. The stages must be trained on the same data and have similar false-reject rates, so the combined rate is "very close to that of the second stage alone" instead of the sum of the two. And the first stage's false-alarm rate matters for power, because each run of the second stage "will briefly draw 1 to 2 orders of magnitude more current"; the authors tune the first stage "to only wake up a handful of times per hour, even when exposed continuously to speech".
4.2 The power arithmetic
Let the first stage draw milliamps all the time, and let each wake-up run the second stage, drawing , for seconds. If the first stage fires times an hour, the average current is
The second term is the fraction of the hour the big model is awake, times its current. With an illustrative mA, mA and seconds, the two terms are equal when wake-ups an hour. Below that rate the first stage dominates and above it the second does. That's why the first stage's false-alarm rate is a design parameter and not a detail.
Google's paper gives the matching accuracy side, in a table of real measurements. Google measured false alarms on 924 hours of television background noise and false rejects on 65,581 recordings of people saying a keyword.
| Stage 1 false alarms per hour | Stage 1 false reject | Cascade false alarms per hour | Cascade false reject |
|---|---|---|---|
| Stage 2 alone | n/a | 0.03 | 3.1% |
| 0.5 | 4.1% | 0.006 | 5.6% |
| 0.8 | 3.4% | 0.006 | 5.1% |
| 5.0 | 1.6% | 0.02 | 3.8% |
| 10.0 | 1.2% | 0.02 | 3.5% |
Read the table as a story with two ends. A strict first stage (0.5 false alarms an hour) wakes the second stage rarely, but it rejects 4.1% of real phrases by itself, and the cascade ends up rejecting 5.6%. A lenient one (10 an hour) costs more wake-ups but passes nearly everything, so the cascade's 3.5% comes close to the 3.1% of the second stage alone. Notice too that the cascade's false-alarm rate, 0.006 to 0.02, is lower than the 0.03 of the second stage alone, because the two stages don't make the same false alarms and a segment has to fool both.
Those false-reject numbers also tell us how the two stages' errors relate. If their mistakes were independent, the cascade at 0.8 an hour would reject 1 − (1 − 0.034)(1 − 0.031), about 6.4% of phrases, and it measured 5.1%. At 10 an hour independence predicts 4.3% against a measured 3.5%. Measured values come out lower because the two models tend to fail on the same recordings, the unclear and distant ones, so a phrase that gets past stage 1 is already more likely than average to get past stage 2.
We move the first stage's threshold so it fires more often, from 0.5 to 200 times an hour on ordinary audio, with the second stage fixed. What happens to the cascade's false-reject rate, and what happens to average current? Does power fall, rise, or stay flat?
- False rejects fall and power rises, at an increasing rate
- False rejects fall and power falls too
- Both stay about the same
Show the answer
A. A more lenient first stage lets more real phrases through, so the cascade rejects fewer of them, but it wakes the big model more often, so power rises, slowly at first and then quickly. The experiment below measures both on simulated scores for the two stages, with a shared difficulty term so their errors overlap, and the same illustrative currents as before.
Try it Sweep the first stage's threshold and watch accuracy and power
import numpy as np
rng = np.random.default_rng(7)
N, P, W = 20_000_000, 200_000, 3600 # windows; one window per second
rho = 0.7 # shared errors
def scores(n, y):
hard = rng.normal(0, 1, n) # "sounds like the phrase" for both
own = lambda: (1 - rho)**.5 * rng.normal(0, 1, n)
s1 = 5.0 * y + rho**.5 * hard + own()
s2 = 6.2 * y + rho**.5 * hard + own()
return s1, s2
n1, n2 = scores(N, 0) # negatives
p1, p2 = scores(P, 1) # positives
t2 = np.quantile(n2, 1 - 0.03 / W) # stage 2 alone: 0.03 FA per hour
I1, I2, SEC = 0.2, 20.0, 2.0 # mA stage 1, mA stage 2, s per wake
print(f"stage 2 alone: FA {np.mean(n2 > t2) * W:.3f}/hr, "
f"FRR {np.mean(p2 <= t2):.1%}, always on = {I2:.2f} mA")
print("stage-1 FA/hr wakes/hr cascade FA/hr cascade FRR avg mA")
for fa in [0.5, 2, 10, 50, 200]:
t1 = np.quantile(n1, 1 - fa / W)
wake = np.mean(n1 > t1) * W
cfa = np.mean((n1 > t1) & (n2 > t2)) * W
frr = 1 - np.mean((p1 > t1) & (p2 > t2))
mA = I1 + I2 * wake * SEC / 3600
print(f"{fa:12.1f}{wake:10.1f}{cfa:15.3f}{frr:12.1%}{mA:10.2f}")
2.9% at 0.030 false alarms an hour and would draw 20.00 mA all day. With a first stage firing 0.5 times an hour the cascade rejects 9.5% of phrases at 0.21 mA. At 10.0 wake-ups an hour it rejects 3.6% at 0.31 mA, nearly the big model's accuracy. At 200.0 accuracy is as good as it gets, 2.9%, but the average has climbed to 2.42 mA, over twice the 1 mA budget.The shape matches Google's table. A good operating point sits where the accuracy curve flattens and the power curve hasn't yet climbed, here a few to a few tens of wake-ups an hour, at roughly 1.5 times the first stage's own draw for 10 an hour. Notice also the third column: the cascade's false-alarm rate is lower than the second stage's alone, because a segment has to fool both models. (All of this is a simulation with illustrative currents, so only the shape carries over.)
| Where the wake-word model runs | Plus | Minus |
|---|---|---|
| One large model, main processor, always on | Best accuracy; simplest | Around 20 times over the always-on power budget in our example |
| One small model, low-power chip, alone | Fits the power budget | At a one-per-week false-alarm target it rejects many real phrases |
| Small model gates a large model (cascade) | Large-model accuracy at small-model power; two filters cut false alarms | Two models to train and keep aligned; audio must be buffered for the second look |
| A cheap sensor gates the model (wrist raise) | Zero listening cost until the sensor fires | Misses the phrase when the cue is absent |
Why not make the first stage strict, to save as much power as possible?
A strict first stage rejects real phrases before the second stage ever sees them, and the second stage can't bring them back. Google's table shows it: at 0.5 false alarms an hour the cascade rejects 5.6% of phrases against 3.1% for the second stage alone. Power saved by a strict first stage is paid for in repeated sentences, so the first stage is tuned to be lenient and the second stage supplies the strictness.
Apple used the cascade on iPhone and a single gated pass on Apple Watch, matching each design to the hardware, and its 2021 and 2023 write-ups still describe a high-recall first stage on the always-on processor followed by a high-precision second stage on the application processor. The same pattern shows up wherever something expensive has to be triggered by something rare: motion-activated cameras, anomaly detection that sends only suspicious events to a human, and search engines that retrieve cheaply and then rerank.
05Where to put the threshold
Every stage so far ends with the same step: a number is compared with a threshold. The threshold is the knob that turns a score into a decision, and moving it trades one kind of mistake for the other. Apple's 2017 post gives the units of the two errors: the false-accept rate is false activations per hour of audio, and the false-reject rate is the proportion of genuine attempts that fail. Since the units differ, there's no natural equal error rate to aim for, as the post notes. We choose a threshold by deciding how many false alarms a user can tolerate, which is a different question from asking where the two curves cross.
5.1 The DET curve
If we try every threshold and plot the false-reject rate against the false-alarm rate, we get a detection error tradeoff curve (DET curve). We usually draw the false-alarm axis on a log scale, because the range we care about spans several orders of magnitude, from one per hour down to one per week. A better model is a curve closer to the bottom left. Papers in this chapter compare models almost entirely by DET curves, and quote one number from each curve at a fixed operating point: Higuchi et al. report false rejects at 1 false alarm per hour, Garg et al. at one per 100 hours, and Gruenstein et al. in the table above.
The curves above come from a toy model with two Gaussian score distributions per detector (the same pair of detectors as in the section 04 experiment), and they show a general feature. Moving left along a curve, toward fewer false alarms, makes the false-reject rate rise slowly at first and then quickly. For the smaller detector, going from one false alarm an hour to one a week raises the false-reject rate from about 6% to about 36%. For the larger one the same move takes it from 0.3% to about 6%. Our larger detector's curve is lower everywhere, and the gap is widest at the strict end, exactly where the product has to operate.
| Setting | Operating point | Source |
|---|---|---|
| Stage 1 of a cascade | A handful of wake-ups an hour | Gruenstein et al., 2017 |
| Stage 2 alone, TV background | 0.03 false alarms an hour (about 1 per 33 hours) | Gruenstein et al., 2017 |
| Research comparison point | 1 false alarm per hour | Higuchi et al., 2020 |
| Research comparison point | 1 false alarm per 100 hours | Garg et al., 2021 |
| Product target for the full system | As low as about one per week | Apple, 2017 |
5.2 How many hours of audio does it take to know?
Now the awkward part. To set a threshold for one false alarm per week, we have to measure the false-alarm rate at a candidate threshold, and a rate that low is measured by counting events in recordings that don't contain the phrase. Apple's 2017 post says as much about its test data: "We need such a lot of data because we are trying to estimate false-alarm rates as low as one per week." It describes thousands of hours of recordings, including podcasts and non-trigger Siri requests in many languages.
Counting rare events has a standard statistical shape. If false alarms occur at an average rate per hour, then over hours the count follows a Poisson distribution with mean and standard deviation , so the relative error of the estimate is
where is the number of false alarms you expect to see. Relative error depends only on how many events you count, not on how long you listened: to know a rate within 10% you need to see about 100 events.
The target is one false alarm per week (168 hours). How many hours of negative audio do you need to measure that rate to within about 10%? Compare it with the roughly 2,800 hours of negative audio in Apple's 2018 personalised-trigger evaluation.
Show the answer
About 100 events at one per 168 hours is 16,800 hours of audio, nearly two years of continuous recording. With 2,800 hours you expect about 17 events, and a count of 17 has a relative error of about 24%. So a published test at that scale can tell one false alarm per week from one per day or one per month, but not one per week from 1.3 per week. The experiment below sets the threshold from such a test, then asks what false-alarm rate that threshold gives.
Try it Pick a threshold for one false alarm a week from a finite test set
import numpy as np
from statistics import NormalDist
rng = np.random.default_rng(11)
nd, W, WEEK = NormalDist(), 3600, 168 # windows/hour, hours/week
z0 = 3.0 # only simulate the tail
sf0 = 1 - nd.cdf(z0)
isf = np.vectorize(lambda u: nd.inv_cdf(1 - u))
def true_fa_per_week(thr):
return (1 - nd.cdf(thr)) * W * WEEK
print("FA per week at the threshold chosen for 1 per week")
print("neg. hours alarms allowed 10th median 90th")
for H in [100, 500, 2800, 17000]:
k = max(1, round(H / WEEK)) # alarms we allow in H hours
got = []
for _ in range(300):
n = rng.poisson(H * W * sf0)
x = isf(rng.uniform(0, sf0, n))
got.append(true_fa_per_week(np.sort(x)[-k]))
lo, med, hi = np.percentile(got, [10, 50, 90])
print(f"{H:10d}{k:16d}{lo:7.2f}{med:8.2f}{hi:7.2f}")
0.18 to 4.30 per week across the 10th to 90th percentile, with a median of 1.12. With 2,800 hours it narrows to 0.73 to 1.34, and with 17,000 hours to 0.87 to 1.12.Each row is one size of test set. The program picks the threshold that lets through exactly the target number of false alarms in that set (one per week of audio), computes the false-alarm rate that threshold has on unlimited fresh audio, and repeats this 300 times. With 100 hours the outcomes span more than twenty to one, so a team using such a set might ship a detector that fires four times as often as promised. So the amount of negative audio is part of the design, and Apple's thousands of hours reflect that. (The scores here are random normal numbers, so the experiment shows the statistics of the measurement and nothing about the real detector.)
5.3 A second chance for the borderline cases
A strict threshold fails visibly on hard cases, like Anika's far-away voice over the fan, whose score may land just short. Apple's 2017 post describes a two-threshold scheme: "a primary, or normal threshold, and a lower threshold that does not normally trigger Siri". If a score falls between the two, the detector doesn't fire, but it enters a more sensitive state for a few seconds, and if the user says the phrase again, Siri responds. Apple says this improves usability without much harm to false activations, because the lenient state is brief.
It treats the user's repetition as extra evidence: one borderline score is weak, two a few seconds apart are much stronger, and a single threshold can't express that.
| How to choose the operating point | Plus | Minus |
|---|---|---|
| Equal error rate | A single summary number; easy to compare models | The two errors have different units and costs; Apple says it is undefined here |
| Fixed false-alarm budget, read the false-reject rate | Matches what users and privacy care about | Needs thousands of hours of negative audio to verify |
| Fixed budget plus a lower second-chance threshold | Recovers borderline attempts; costs few false alarms | Adds state and a short window of extra sensitivity |
Apple chose a fixed false-alarm target, as the weekly goal in the 2017 post shows, and added the second-chance threshold in the same system. Fraud detection, medical screening and spam filters pick thresholds the same way.
06Is it Anika? Speaker verification
Back in the kitchen, her husband Rohan is on a call in the next room, and halfway through a sentence he says "hey, Siri is so slow today, isn't it". Our cascade, however careful, was trained to detect a phrase. It has no idea whose voice said it. A two-pass detector, so far, would wake Anika's phone for Rohan's remark about Siri, for the voice on the television, and for a visitor who says it on purpose. Apple's April 2018 post on Personalized "Hey Siri" states the goal as reducing false accepts by making each device "mostly wake only for the primary user".
Recognising a speaker takes a different kind of model from recognising a phrase. The phrase detector has to ignore who is talking, while the speaker model has to ignore what is said, or here to compare the same phrase spoken by different people. The usual tool is an embedding: a function that maps any utterance, whatever its length, to a fixed-length vector of numbers, trained so that utterances by the same person land close together and different people land far apart. After that we compare vectors and nothing else.
6.1 Enrolment and the profile
The device needs examples of Anika's voice, and in the 2018 post it gets them in two ways. In explicit enrolment she says a short script when she sets up Siri: "Hey Siri" three times, then "Hey Siri, how is the weather today?" and "Hey Siri, it's me". That gives an immediate profile, but it's recorded in a quiet moment close to the phone, so it lacks the variety of real use. In implicit enrolment the profile is updated over time with real triggers the device accepted. That's risky, since an early false accept could pollute the profile with the wrong voice, so Apple's approach starts from the explicit recordings and grows with accepted utterances up to 40 speaker vectors. A 2023 post describes enrolment with five sample phrases, such as "Hey Siri, get directions home".
Each device also keeps the waveform of the phrase portion of each enrolment, so when Apple ships an improved vector model in an update, the profile can be rebuilt without asking Anika to repeat the script.
6.2 From an utterance to a vector, and a vector to a decision
Turning a variable-length utterance into a fixed-length vector is the awkward step, and Apple's first version reuses what the detector already computes. Its second-pass detector knows which frames belong to which state of the phrase model. Averaging the acoustic features of all the frames in each state, and joining those averages in order, gives one vector of fixed length. In the 2018 post, 13 mel-frequency cepstral coefficients over 28 states give a 364-number vector, called a supervector. A linear transform learned from many speakers then maps it to a shorter vector of 150 numbers, using linear discriminant analysis (LDA), which picks the directions that best separate speakers by maximising the ratio of between-speaker spread to within-speaker spread:
Here runs over speakers, is the mean supervector of speaker , the mean of all of them, and the number of utterances from speaker . Within-speaker scatter measures how much one person's vectors vary from utterance to utterance, and between-speaker scatter measures how far apart different people's averages are. The columns of that make large are the directions where people differ more than any one person varies. Apple trained its 2018 transform on 800 users with more than 100 utterances each.
A neural network does the same job better. The improved design in the 2018 post trains a DNN as a speaker classifier: four layers of 256 sigmoid units, then a 100-unit linear layer, then a softmax over 16,000 training speakers (about 150 utterances each). After training the softmax is thrown away, and the 100-number output of the linear layer is the speaker vector. That classification task exists only to force that layer to carry what distinguishes speakers, and the same trick builds face and product embeddings. Weights are quantised to eight bits to fit in memory.
Scoring is then geometry. Anika's profile holds up to speaker vectors , and a new utterance produces a vector . The device computes the cosine score of against each profile vector, the dot product after dividing by both lengths, and averages the results:
When the average cosine passes a threshold , the device accepts. A cosine of one means the vectors point the same way and zero means unrelated, so the score measures the angle between voices and ignores loudness, which varies with distance from the phone. Raising lowers false accepts and imposter accepts and raises false rejects, so the trade-off from section 05 comes back, now on speakers.
Apple measured what each improvement bought in two ways. One is the equal error rate (EER) of the speaker comparison alone, the point where false accepts and false rejects are equal, on 200 users. The other is end-to-end behaviour, with 2,800 hours of negative audio and positive audio from 150 users, where imposter accepts are how often a different speaker saying the phrase gets in.
| Speaker transform | Speaker EER | False accepts | False rejects | Imposter accepts |
|---|---|---|---|---|
| Retrained linear (LDA) transform | 8.0% | 2 per month | 9.8% | 11.9% |
| DNN, one 100-unit sigmoid layer | 5.3% | 1 per month | 5.9% | 3.1% |
| DNN, four 256-unit layers and a 100-unit output | 4.3% | 1 per month | 5.2% | 3.2% |
Going from the linear transform to the larger DNN roughly halved false rejects and cut imposter accepts from 11.9% to 3.2%, the difference between Rohan's voice often waking Anika's phone and rarely doing so. The post also admits a limit: performance was "still weaker in reverberant rooms and noisy settings like cars", and a tiled kitchen with a fan on is probably not far from that. It points to 2018 follow-up work on training with many acoustic styles and on LSTM models (a kind of recurrent network) that use the whole "Hey Siri, …" utterance, not only the trigger. By 2023 Apple describes an LSTM speaker embedding that runs twice, early on the trigger alone and later on the trigger plus the request, and says training on data from all languages and locales improves accuracy.
Google's 2017 cascade paper gives an independent measure of what a speaker check is worth. It enrols on "N (typically 3) utterances" and compares LSTM speaker embeddings by cosine distance, and the authors report that the check "can reduce the overall FAR by a factor of 5 to 10 while adding less than 1% absolute additional FRR", since false alarms from other people, television and radio are almost always rejected.
| How the device decides whose voice it is | Plus | Minus |
|---|---|---|
| No speaker check | Works for any user at once; nothing to enrol | Anyone's voice, and any television, can wake the device |
| Check the phrase only, vectors by LDA (2018) | Cheap; reuses the detector's alignment | Higher imposter-accept and false-reject rates |
| Embedding from a DNN (2018) or LSTM (2023), on the phrase and the request | More accurate, uses more of the audio | Needs enrolment, per-user profile storage and more compute |
| Profile that grows with real use (up to 40 vectors) | Adapts to noise, distance and illness | A false accept can corrupt the profile |
Apple's published design combines the last three rows: a DNN embedding in 2018, a profile seeded by explicit enrolment and extended by accepted use, and the later LSTM. Comparing embeddings by cosine similarity is also how face unlock, voice banking and duplicate-photo detection work, and it is a close cousin of the dot-product scoring in the two-tower retrieval of chapter 41.
Why compare with cosine and not with the straight-line distance between vectors?
Recording conditions change the length of a vector as readily as its direction. A quiet phrase, a distant speaker or a different microphone gain can shrink or stretch the numbers without changing who's talking. An angle between two vectors ignores length, so those changes barely move it, and a length-normalised dot product is the cheapest way to compute it.
07Shrinking the model until it fits
The first pass has to fit on a chip that Google's paper says typically has 128 kB of memory in all, shared by the audio buffer, the program and the model. Our pipeline so far, a network that outputs sound classes plus a separate dynamic programme, also has two parts that are trained and tuned separately. Both problems suggest the same move: train one small network to output the phrase score directly, and build it from layers that need very few weights.
7.1 Factorising a layer over time and frequency
Suppose a layer looks at features per frame over consecutive frames. A standard fully connected unit has one weight for each of the inputs. A singular value decomposition filter (SVDF) replaces that grid with two short filters: one of length that boils each frame's features down to a single number, and one of length that mixes those numbers across time. For one unit:
Here is feature at frame , is the filter over features, is the filter over time, and is the activation. A unit's weights drop from to . With the 13 coefficients over 11 stacked frames in Higuchi et al. (2020), , and with a memory of frames a plain unit would have 1,287 weights against 152 for the SVDF, roughly 8.5 times fewer. (The paper doesn't give this unit count; it's our arithmetic on its settings.) The SVDF also remembers the past frames inside the layer, so a stack of layers sees frames of the past and produces a decision at every frame with no recurrent connections.
The stacked 1D convolution network (S1DCNN) that Apple's team proposed in 2020 builds the same factorisation from ordinary convolution layers: a one-dimensional convolution over the feature axis, then a depth-wise convolution over time with one filter per channel. The paper shows that the SVDF is a special case with zero biases and no future frames, and the extra freedom helps in two ways: the convolution form allows biases, and it allows some future context, frames, at the price of delay. In the paper's seven-layer network with , the receptive field is milliseconds into the past and milliseconds into the future. At that's 610 ms of past and 50 ms of future, enough to cover a phrase, and each step up in moves 70 ms of context from past to future.
Training is end to end. The output is a two-way probability of "trigger" or "not trigger", with the positive label placed 30 frames before the end of the phrase, and at test time the outputs over the last 30 frames are averaged. Training data is about 500,000 English utterances that start with the phrase and run on into a request, with the phrase cut out of the audio half the time to make negative examples. Evaluation used 6,509 phrase recordings and about 2,700 hours of audio without the phrase. At one false alarm per hour:
| Model (about 14 thousand parameters each) | Future context | False-reject rate |
|---|---|---|
| DNN with HMM-style scoring (baseline) | n/a | 4.99% |
| SVDF, end to end | 50 ms | 3.95% |
| S1DCNN, L = 0 | 50 ms | 3.20% |
| S1DCNN, L = 1 | 120 ms | 2.81% |
| S1DCNN, L = 3 | 260 ms | 3.77% |
| S1DCNN, L = 4 | 330 ms | 4.33% |
Three things stand out. Moving from separate classes plus scoring to one end-to-end network cut false rejects by 20.8% relative at the same size (4.99% to 3.95%). Convolutions then cut another 19.0% relative at the same latency (to 3.20%). And a little future context helped while too much hurt: at the model has only 400 ms of past, too short to cover a phrase, so the extra delay buys less than the lost history costs. The best setting spent 70 ms of extra delay than the baseline for another 12.2% relative improvement. All models were evaluated in 32-bit floating point.
7.2 Fewer bits per weight
The other lever is bits per weight. Google's paper describes a uniform linear quantiser: find the smallest and largest weight in a layer, divide the range into equal steps, and store each weight as the number of its nearest step. With bits and weights between and , a weight is stored as
where is the value used at inference time, within half a step of the original. Google used 8 bits, and Apple's 2023 post says the first-stage model is compressed to "4 bits per weight for inference". For the 13,979-parameter network the savings are easy to work out: about 56 kB at 32 bits, 14 kB at 8 bits and 7 kB at 4 bits. Google's DSP budget for its first-stage model was 13 kB (a different network), so 8 bits would slightly exceed that budget for this one and 4 bits would leave room. Integer arithmetic is also faster and cheaper on a signal-processing chip than floating point.
Quantisation has a catch, which Google's paper names: DSPs use 16, 24 or 32-bit arithmetic with "somewhat different results", so one model isn't bit-identical across chips. Google emulates each platform's arithmetic in C, so data-centre training matches each chip, and trains a model per platform.
| Network for the first pass | Plus | Minus |
|---|---|---|
| DNN over sound classes, separate scoring | Simple; phone-level targets are easy to inspect | Two parts trained and tuned separately |
| SVDF layers, end to end | Streaming, no recurrence, few parameters | No biases or future context |
| Stacked 1D convolutions, end to end | 19% fewer false rejects than SVDF at equal size; controllable delay | Quantised accuracy left for future work in the paper |
| Transformer encoder (second pass) | Best accuracy for the checker | Too big for the first pass |
Apple's 2023 post still describes a first-stage DNN-HMM keyword spotter, with 23 output states (21 for seven phonemes, one for silence, one for background) followed by a Conformer checker. So the always-on chip probably keeps the classic structure while the end-to-end models appear in papers, and which runs on which device generation is unpublished. Splitting a convolution into a per-feature part and a per-time part is also the idea behind depthwise-separable convolutions in mobile image models such as MobileNet, applied here to time and frequency. Google's earlier work points the same way: Sainath and Parada (2015) found that convolutional networks, built under fixed limits on multiplications or on parameters, cut the false-reject rate by 27 to 44% relative to a plain DNN at one false alarm an hour.
08Using what comes after the phrase
The cascade, the speaker check and the better first-pass model all look at the phrase itself, and some false triggers sound so much like it that no model of those few hundred milliseconds can tell them apart. Apple's 2017 post gives the standard example: "Hey Seriously" starts the same way as "Hey Siri". When the phone passes that audio on, Siri's server runs the full speech recogniser, hears the whole sentence, sees it isn't a request, and "the server sends a cancellation signal to the phone to put it back to sleep".
That check is accurate, but by the time it runs, audio has already left the device, the very thing the design tried to avoid. The natural improvement is to use the audio after the trigger, on the device. A true request tends to continue as a sentence addressed to the assistant, while a false trigger tends to be a fragment of someone else's conversation, so the next second or two of audio carries a lot of information.
Apple's 2021 paper (Garg et al.) builds this into one model. It's a transformer encoder, a network in which every frame looks at the others through attention, running over the audio in blocks and keeping what it has already computed. It has two outputs. One checks the phrase, as the second pass always did, and the other, the phrase discrimination branch, keeps scoring the audio that follows and decides whether it was a real request. Three design choices make it work on a phone. Attention runs over blocks of about 1.9 seconds that overlap by half, so cost grows in proportion to the audio length where ordinary attention grows with its square. The phrase discrimination loss is a plain cross-entropy on every frame, because the connectionist temporal classification loss used before tends to give "highly peaky and overconfident distributions" that misclassify look-alike triggers. And a small recurrent layer smooths the output over time.
The model was trained on 2,700 hours of transcribed audio, expanded to 8,100 hours by simulating rooms and echo, plus 140,000 true-trigger and 40,000 false-trigger utterances for the discrimination task. On two evaluation sets the joint model lowered false rejects, from 3.6% to 2.8% on a structured set of 100 participants at one false alarm per 100 hours, and from 5.9% to 5.1% on an unstructured set from 80 households over two weeks. For false trigger mitigation, giving the model one more second of audio after the trigger, at a cost of 1% additional false rejects, it suppressed 95.8% of unintended false triggers. On a 2019 phone the streaming form used 32% less memory and 56% less inference time than reprocessing the extra second from scratch.
A 2023 post, published as iOS 17 added support for saying just "Siri", describes how these pieces fit together on the device. The first stage, on the always-on processor, discards audio without the keywords. A Conformer encoder (a transformer variant that adds convolutions) rescores the candidate on the application processor. A speaker model runs early and late. Finally a stage called Siri directed speech detection examines the full utterance and can override the trigger, using three different views: a recurrent network over the speech recogniser's lattice of alternative transcriptions, in which a real request has few competing hypotheses and a false trigger often has several; an acoustic transformer that doesn't depend on the recogniser; and a text classifier that decides whether the words were addressed to the assistant, including cases where "Siri" is used as an ordinary noun. Apple gives no accuracy, power or latency figures for any of them.
Why would dropping "Hey" make the layered design matter more? Apple's post lists the short phrase among its challenges, and the logic holds even without numbers. A phrase with fewer sounds gives the first stage less evidence, so more everyday speech probably resembles it at a given threshold, and weight shifts onto the later, better-informed stages. That's our inference from the design, not a figure Apple gives.
| What checks a trigger after the phrase | Plus | Minus |
|---|---|---|
| Nothing; trust the phrase detector | Fastest; no extra compute | Look-alike speech goes through |
| The server's full recogniser (2017) | Strong model and the full sentence | Audio has already left the device |
| On-device acoustic model on the following second (2021) | No audio leaves; 95.8% of false triggers suppressed at +1% false rejects | Extra second of audio, extra compute |
| Also lattice and text models (2023) | Different views catch different mistakes | More models to run and keep in step |
Apple layers all of them, and each later check runs only on audio that passed the earlier ones, so every added filter costs compute on a small and shrinking share of the audio. Spam filtering, content moderation and fraud screening have the same shape: a cheap broad filter first, then progressively more expensive and better-informed checks.
Why not make the first pass itself accurate enough, and skip the later ones?
Our first pass sees a few hundred milliseconds, on a chip with kilobytes of memory. Later checks see more audio and use larger models, and they run rarely, so they can afford to. Pushing that much accuracy into the first pass would make it too large to run all day.
09Collecting the data: noise, distance and rare errors
All of this machinery learns from recordings, and the recordings have to look like Anika's kitchen. A model trained on clean speech near a microphone has never heard a fan, a pan and a voice two metres away at the same time, and it will reject her or fire on the fan. The sources describe four ways of getting data that looks like the real world, and some cheap ways of labelling it.
For positive examples, Apple's 2017 post says its initial training set was "Hey Siri" utterances from users who had pressed the button and said it, along with general speech used to train the main recogniser. For testing, it recorded native speakers in "kitchen (near and far), car, bedroom, and restaurant" settings. It did not use button-press recordings for testing, because the microphone is close and the user has already triggered Siri by hand, so they don't show the hard cases. Anika is the hard case: far away, noisy, speaking up.
Real far-field recordings are expensive, so most of the variety is synthesised. Garg et al. (2021) convolve clean recordings with room impulse responses, measurements of how a room smears a sound, and add echo residuals, what remains of the device's own speaker output after partial cancellation. Higuchi et al. add a third augmentation that changes the gain, scaling each utterance by 0, −20 or −32 dB. They say this closes the gap between the volume of server-side training audio and what the microphone receives on the device, and makes the model robust to volume. A quiet voice across a kitchen is a −20 dB case. In the Garg paper the room and echo augmentation turns 2,700 hours of clean audio into 8,100 hours.
Labels come cheaply from the main recogniser. Apple's post says the transcriptions of the training audio were produced automatically, with a subset checked by the team, and the frame-level labels, which sound class each frame belongs to, come from aligning transcript and audio. That post says the labels use only about 20 sound classes, including one large "everything else" class.
The "everything else" class is large, and that causes an imbalance. In ordinary speech the phrase sounds are a tiny share of all frames, so a network trained on raw frequencies is pushed to predict "other". The standard correction in a network-plus-HMM system divides each class's posterior by the class's overall frequency in the training data, turning the network's "probability of the class given the sound" into something proportional to "probability of the sound given the class":
where is the sound at frame , a sound class, and the class's share of the training frames. That constant is the same for every class at a given frame, so we can ignore it. If a phrase sound is one frame in 400 (an illustrative figure), subtracting its log prior adds about 6 to its log score, so rare classes aren't swamped. Apple's post says the outputs are adjusted "to compensate for uneven phone frequencies in the training data"; the formula above is the standard way to do it, and the post doesn't write it out. End-to-end models face the same imbalance differently: the streaming model of Alvarez and Park, which Higuchi et al. follow, repeats the positive label across many frames to avoid highly imbalanced targets.
The training set also has to cover the ways people say the phrase. For US English the post says two variants are trained, differing in the first vowel of "Siri" (as in "serious" and as in "Syria"), and a short pause in "Hey, Siri" is allowed. The phrase also changes by language, "Dis Siri" in French and "Siri 야" in Korean among them, so each language needs its own data. Each model takes about a day to train, and three come out together: a small one for the always-on processor, a larger one for the second pass and a medium one for the watch.
For the later checker, Garg et al. add 140,000 true-trigger and 40,000 false-trigger utterances for the discrimination task, and their paper doesn't say how the false triggers were gathered. Still, the principle is clear. Random negative audio contains few look-alikes, so the most useful negatives are the audio that fooled the previous model, which turns the data pipeline into a feedback loop: the failures of version become training data for version .
That loop has a privacy constraint, and Apple changed it publicly. In an August 2019 statement it said it would "no longer retain audio recordings of Siri interactions" by default, let users opt in to sharing audio samples, and "delete any recording which is determined to be an inadvertent trigger of Siri". How Apple gathers hard negatives today is unpublished. The 2017 post describes one monitoring mechanism, sampling production data each week on the latest iOS devices and Apple Watch to estimate false-alarm and imposter-accept rates, which section 11 returns to.
| Where wake-word training audio comes from | Plus | Minus |
|---|---|---|
| Button-press utterances from users | Plentiful, real voices and devices | Close to the microphone; no far-field or noise |
| Recorded sessions in kitchens, cars and bedrooms | The hard cases, with known labels | Costly; small compared with the need |
| Simulated rooms, echo and gain on clean audio | Multiplies data cheaply (2,700 to 8,100 hours) | Only as realistic as the simulation |
| Mined false triggers as negatives | Targets the model's actual look-alike mistakes | Depends on collecting audio users did not intend to send |
Apple's published practice is the combination: real recordings for the hard test conditions, simulation to multiply training data, automatic labels from the main recogniser and weekly production sampling. Simulated rooms and noise are standard in audio models, and mining the previous model's mistakes as the next one's negatives is the usual recipe wherever errors are rare, as in fraud, search ranking and content moderation.
Why not test on the button-press recordings, since there are so many?
Because they don't resemble the situations where the detector matters. A person who pressed the button is near the phone and has already started Siri, while the person who says "Hey Siri" is often across the room. An easy test set measures the wrong thing and reports accuracy the product doesn't have.
10On the device: memory, latency and one request
The model fits only if everything else on the chip fits too, and Google's paper shows the arithmetic. The first-stage DSP has about 128 kB. Program code takes about 25 kB, and another 12 kB goes on tables for the fast Fourier transform that makes the frequency summaries. The audio buffer has to hold the whole phrase: two seconds of 16-bit audio at 16,000 samples a second is 2 × 16,000 × 2 bytes, or 64 kB. That leaves 128 − 25 − 12 − 64 = 27 kB, of which the model takes 13 kB and the rest is working memory. Audio is roughly half the memory and the model a tenth.
Compute is just as tight. A network of about 13 thousand weights at 100 frames a second does about 1.3 million multiply-adds a second (Higuchi's table gives roughly 12.8 thousand per frame), a rounding error next to the billions the main processor does. The second stage is bigger but runs rarely, and it faces a different pressure: it works on audio that has already happened, so it has to run faster than real time. Google says it "must be able to process the buffered audio coming from the first stage as fast as possible to minimize detection latency".
Latency has several small contributions that add up. Each future frame in the input window adds 10 ms. Smoothing and the dynamic programme can't finish until the end of the phrase has been heard, and the score "peaks just after the full phrase has entered the system", in Apple's words. In the S1DCNN the delay is explicit: 50 ms of future context at the base setting and 120 ms at the best one. Then the second stage runs and, in the 2021 design, can use another second of audio to confirm. A detector has one more duty beyond yes or no: it must say where the phrase ended, so the recording of the request starts in the right place. Google's paper notes that the spotter's alignment "can improve start-of-speech detection", which shows up as better recognition of the request itself.
Here's Anika's request step by step, with published numbers where they exist and a flag where they don't. Apple publishes no end-to-end latency for "Hey Siri" and no power figure for its chips, so the steps carry none.
- AlwaysThe microphone samples 16,000 values a second and the front end makes a frame every 10 ms. The first-pass network on the always-on processor scores a window of about 20 frames (0.2 s) at every step. While Anika kneads it hears the fan, the pan and the radio, and nothing passes its threshold.
- PhraseShe says "Hey Siri" from two metres. Smoothed scores for the phrase's sound states climb in order, and the running score peaks just after she finishes. A score between the two thresholds would only raise sensitivity for a few seconds; this one clears the main threshold.
- WakeThe first stage wakes the main processor and hands it the buffered audio, about two seconds in Google's design, while the microphone keeps streaming the rest. Apple's post doesn't give the buffer length, though a 2023 overview mentions a ring buffer (a fixed-size store that keeps overwriting its oldest audio), so it probably holds a similar couple of seconds.
- CheckThe larger second-pass network, five layers of 192 units in the 2017 configuration, rescores the audio. In the same pass the device makes a speaker vector from the phrase and compares it with the stored profile by cosine score. Both must pass. Published timing for this step: none.
- ListenSiri starts and the device streams "set a timer for twelve minutes" to Siri's servers. In the 2021 design an extra second of post-trigger audio is scored on the device, and in the 2017 design the server's recogniser could still cancel the request. If the utterance isn't addressed to Siri, the phone is told to go back to sleep.
- ActThe request is understood and a twelve-minute timer is set. So the detector's part ended at step 4. Everything from here is speech recognition and language understanding, covered in chapters 13 and 39.
Notice how little of this happens on the main processor. Most of a day's audio is handled by the cheapest part of the chip and never leaves the device, and the larger network sees only the few seconds around each wake-up.
| What to spend the on-device budget on | Plus | Minus |
|---|---|---|
| A longer audio buffer | Second stage sees the whole phrase and some context | Memory the first-stage model could have used |
| More future frames | More accurate scores (best at 70 ms more in Higuchi) | Each frame adds 10 ms of delay |
| A larger first-stage model | Fewer wake-ups for the second stage | Memory and power on a chip with kilobytes |
| More bits per weight | Less quantisation error | Twice the memory at 8 bits instead of 4 |
Every row trades one scarce thing for another, and the published designs sit at different points: Google's 13 kB model at 8 bits in 2017 and Apple's 4 bits per weight in 2023. Splitting a fixed memory and time allowance among competing parts is how any on-device model gets designed, from keyboard prediction to camera effects.
11How anyone knows it works: offline sets and production sampling
We have a detector with many dials: the two thresholds, the stage-1 operating point, the speaker threshold, the model sizes. Turning any of them changes both kinds of mistake, so we need a test that measures both honestly, and that's harder than it looks, because the two mistakes are measured on very different audio.
11.1 Offline: positives that are hard, negatives that are many
False rejects are measured on recordings that contain the phrase, and those need to look like real use. False accepts are measured on recordings that don't, and there must be a great many hours of them. Published test sets show both pressures.
| Source | Positive audio | Negative audio |
|---|---|---|
| Chen et al., 2014 | About 1,000 examples per keyword, plus babble noise at 10 dB SNR | 70,000 examples, a 1.4% positive-to-negative ratio, chosen to match expected use |
| Gruenstein et al., 2017 | 65,581 recordings of US English speakers | 924 hours of television background |
| Apple, 2017 | Native speakers in kitchen (near and far), car, bedroom, restaurant | Thousands of hours: podcasts, non-trigger Siri requests, many languages |
| Apple, 2018 (personalised) | Phrases from 150 users | 2,800 hours |
| Higuchi et al., 2020 | 6,509 phrase utterances | About 2,700 hours in a range of noise conditions |
| Garg et al., 2021 | 100 participants on a smart speaker, with noise and playback conditions; plus 80 households using a smart speaker daily for two weeks | 2,000 hours of general speech |
Look at the ratios. In Chen's test set the phrase is 1.4% of the examples, and real audio is more lopsided still: the phrase is spoken a few times a day while the microphone hears hours of everything else. Plain accuracy is meaningless on such data, since a detector that never fires would be right more than 99.99% of the time. That's why every paper reports the pair of false-alarm and false-reject rates, or the DET curve of section 05.
The two Apple test sets in the 2021 paper show a trick for measuring realistic false alarms. One is a controlled recording session, the structured set. The other, the unstructured set, is 80 households that used a smart speaker daily for two weeks, with a first-pass system at a deliberately low threshold marking every segment that sounded at all like the phrase. Evaluators could then count both real phrases and everything the household produced that tripped the first pass, a way to get realistic false triggers without recording for years. The paper notes it reports a different operating point from before because the "unstructured evaluation set has increased in past year", which also shows that these sets keep growing.
One more habit matters for a cascade: measure it as a cascade. Section 04's table showed that the combined false-reject rate isn't the sum of the stages' rates and the combined false-alarm rate isn't either stage's, so each stage's own curve can't predict how the full system behaves. Published evaluations run the full pipeline on the full sets.
11.2 In production: counting the misses you never heard
After launch the system faces a measurement problem of an unusual shape. False accepts leave a trace, since Siri turned on, and a sample of those can be examined. False rejects leave none: Anika said the phrase, nothing happened, and nothing was recorded. Apple's 2017 post says how it handles the asymmetry. Each week the team estimates false-alarm and imposter-accept rates "by sampling from production data, on the latest iOS devices and Apple Watch". It says plainly that "this does not give us rejection rates", and describes two proxies: the proportion of activations just above the threshold that turn out to be valid, and "a sampling of just-below threshold events on devices carried by development staff".
The first proxy has a clean logic. Activations just above the threshold are the borderline ones. If most of them are real phrases, nudging the threshold up would have rejected many real phrases, so the share that are valid tells you how dense real attempts are at the edge. Together with the staff devices, whose borderline misses can be inspected, that gives an estimate of how many valid attempts sit just below the line.
Apple hasn't published how it runs live experiments on the trigger, so there's no A/B result to quote, but we can say what a test would need. A rare event is easier to count online than offline, because events multiply with every device. If each of a million devices false-alarms once a week, the fleet produces about 6,000 alarms an hour, and a few days of data hold thousands of events, the sample that took 17,000 hours of audio offline. Online, the bottleneck is labels: working out which alarms were real takes either retained audio, which Apple stopped keeping by default in 2019, or a proxy such as whether the user cancelled the request.
Why not take the false-reject rate from users who repeat themselves?
A repeated phrase signals a miss, but it's a biased sample. Users who give up after one try leave nothing behind, and a request that fails for another reason looks identical. Apple's rejection estimate uses activations the device did record, just above the threshold or on staff devices, because those can be checked against what was said.
| Way to measure the detector | Plus | Minus |
|---|---|---|
| Offline sets with recorded phrases and negative hours | Both error types measured directly, fully labelled | Thousands of hours needed; sets drift from real use |
| Take-home recordings from real households | Realistic noise, speakers and false triggers | Small number of homes; consent and storage needed |
| Weekly production sampling of activations | The real population; counts false alarms and imposter accepts | Cannot see rejections directly |
| Borderline activations plus staff devices | Estimates rejections from what was recorded | Indirect; the staff are not typical users |
Apple's 2017 and 2021 papers between them describe all four. Pairing a fully labelled offline set with a sampled, partly observed production stream is common wherever failures are silent, as in fraud screening, where blocked transactions can't be checked, or in search, where nobody records the results they didn't click.
12What went wrong, and what it cost
The sources record several failures, in the papers' own words and, in one case, in a company statement. None is a dramatic outage. Each is a way a detector that scored well on a test set did something unwelcome in the world, and together they show where the design was strained.
The costliest failure was about privacy. In August 2019 Apple said it had "immediately suspended human grading of Siri requests" while it reviewed its practices. Its statement of August 28, 2019 said it would "no longer retain audio recordings of Siri interactions" by default, would make audio sharing opt-in, with only Apple employees allowed to listen, and would "delete any recording which is determined to be an inadvertent trigger of Siri". For a detector, the lesson is that a false accept is a privacy event as well as a battery one. What it cost was a change in how Apple collects improvement data, so the loop in section 09, where one model's errors feed the next, had to work under a new constraint. Apple hasn't said how it adjusted.
The design also stumbled in smaller, technical ways, each documented. Personalised "Hey Siri" was "still weaker in reverberant rooms and noisy settings like cars" in 2018. In 2021, the authors found that streaming attention trained with a CTC loss on the phrase discrimination branch gave "highly peaky and overconfident distributions" that misclassified look-alike audio. In the S1DCNN experiments, adding too much future context made the model worse, because the left receptive field shrank below the length of the phrase. Google's engineers noted that a first stage with too high a false-alarm rate would drain the battery, and that DSPs from different vendors gave slightly different numerical results from the same model.
| What happens | What the user sees | What the design does |
|---|---|---|
| Fan and pan noise, speaker two metres away | Anika repeats herself | Far-field training data, simulated rooms and gain; second chance threshold |
| Look-alike speech such as "Hey Seriously" | Siri starts and then goes back to sleep | Server check (2017), on-device post-trigger check (2021, 2023) |
| Rohan says the phrase | Anika's phone wakes for him | Speaker embedding compared with the profile by cosine score |
| Early false accept pollutes the profile | The profile drifts toward the wrong voice | Start from explicit enrolment; cap at 40 vectors; keep waveforms to rebuild |
| First stage fires too often | Battery drains faster | Tune stage 1 to a handful of wake-ups an hour |
| Different chip, slightly different arithmetic | Accuracy differs by device | Emulate each chip's arithmetic in training and evaluation |
| Inadvertent trigger audio retained | Recordings the user never intended to share | No retention by default, opt-in review, deletion of inadvertent triggers (2019) |
Most of these costs aren't published. Apple gives no figures for how many false accepts occurred, what rework the 2019 change required, or what accuracy was given up. What the record does show is where the pressure fell: on the false-accept side, at every stage, from the Always On Processor to the privacy policy.
| Decision | Chosen | Given up | Why it was worth it |
|---|---|---|---|
| Where to listen | On the device, on a low-power chip | A larger model for the always-on part | Battery and privacy; audio stays local until a trigger |
| How many passes | Two on iPhone, one gated on Watch | Simplicity | Large-model accuracy at small-model power |
| Threshold | Fixed false-alarm target, plus a second-chance threshold | A single clean number such as equal error rate | The user cares about false alarms per week |
| Speaker check | Embedding and cosine score against a growing profile | Convenience for guests, some false rejects | Imposter accepts fell from 11.9% to about 3% |
| After the phrase | Check the following audio on the device | An extra second of audio and compute | 95.8% of false triggers suppressed at +1% false rejects |
| Test data | Thousands of hours of negatives | Cost of collecting and storing them | A one-per-week rate cannot be measured with less |
13The whole system
Now we can draw the full design. On the left is Anika's request, from the microphone through the two passes and the speaker check to the point where Siri starts, with the checks that continue afterwards. On the right is the offline loop that decides what each of those parts has learned and how its thresholds were chosen.
| Component | What it does | Added because |
|---|---|---|
| Front end and frame window | Turns 16,000 samples a second into 100 frames a second, 20 at a time | The network needs a short, structured input (section 03) |
| First-pass network, low-power chip | Scores the phrase at every frame | The big model cannot run all day (sections 01, 02, 04) |
| Ordered scoring and two thresholds | Turns posteriors into one score; second chance for borderline cases | Order matters; strict thresholds miss hard cases (sections 03, 05) |
| Second-pass network | Rescores the buffered audio with a bigger model | First pass is lenient by design (section 04) |
| Speaker embedding and profile | Compares the voice with the owner's by cosine score | Other people say the phrase too (section 06) |
| Post-trigger checks | Server and on-device checks on what follows | Look-alike speech passes the phrase stages (section 08) |
| Augmented, labelled training data | Far-field, noisy examples with frame labels | Real kitchens are not studios (section 09) |
| Negative hours and production sampling | Set and verify thresholds | A weekly false-alarm rate needs thousands of hours (sections 05, 11) |
| Level | The choice | Algorithm or data structure |
|---|---|---|
| System | Spend little all day and a lot rarely | Cascade across processors; gating by a cheap sensor |
| Model | One frame classifier, one score | Fully connected network (about 14 thousand weights); dynamic programme over phrase states |
| Smaller | Fewer weights and bits | SVDF and stacked 1D convolutions; 4 to 8 bits per weight |
| Threshold | Fix the false-alarm rate, read the miss rate | DET curves; Poisson counting over thousands of hours |
| Speaker | Compare embeddings | LDA or DNN bottleneck; mean cosine score against up to 40 vectors |
| After the phrase | Use the following audio | Streaming transformer encoder with block attention; lattice and text models |
Several parts of this picture are unpublished: end-to-end latency, the power draw of each pass, how often models are updated over the air, how Apple now mines hard negatives, and which end-to-end architecture runs on which device. Our sources describe the system as of 2017 (the first post), 2018 (personalisation), 2020 and 2021 (the papers) and 2023 (the voice trigger overview), and the current system will have moved on.
14Summary
- Always-on listening is a power problem first. A budget of about 1 mA for 1% of a 2,400 mAh battery a day (Google, 2017) rules out running a speech recogniser or any large model continuously.
- A small frame classifier plus a score replaces transcription. Every 10 ms a network of about 14 thousand weights estimates which sound of the phrase the last 0.2 seconds resembles, and a second step turns the stream into one number.
- The score should respect order. Smoothing and taking maxima ignores order, while a dynamic programme over the phrase's states, as in Apple's 2017 recurrence, rejects the right sounds in the wrong order.
- A cascade buys large-model accuracy at small-model power. A lenient first pass on a low-power processor wakes a bigger second pass, and average current is , so the first stage's false-alarm rate is a design parameter.
- The thresholds come from a false-alarm budget. With different units, the two errors have no equal error rate. You pick the false alarms per week you can tolerate and read the false-reject rate off the DET curve.
- Rare errors need many hours to measure. Relative error of a count is , so one false alarm per week to within 10% takes about 16,800 hours, and a 2,800-hour test gives about 24%.
- Speaker verification is embeddings and cosine scores. Apple's 2018 DNN embeddings cut imposter accepts from 11.9% to about 3%, using a profile of up to 40 vectors, and Google measured a 5 to 10 times lower false-alarm rate for under 1% extra false rejects.
- Small models come from factorising layers and cutting bits. SVDF and stacked 1D convolutions reduce a unit from to weights, and 4 to 8 bits per weight fit the model in a few kilobytes beside a 64 kB audio buffer.
- Later stages use what comes after the phrase. A streaming transformer on the following second suppressed 95.8% of false triggers for 1% extra false rejects (Apple, 2021), and the 2023 system adds lattice and text checks.
- The data has to look like the kitchen. Far-field recordings, simulated rooms, echo and gain augmentation (2,700 to 8,100 hours) and automatic frame labels from the main recogniser do that job, with prior correction for the dominant background class.
- Misses are measured indirectly and false accepts are a privacy matter. Production sampling counts false alarms but not rejections, which Apple estimates from borderline activations, and the 2019 policy change shows that an inadvertent trigger has costs beyond battery.
15Build this
The tradeoffs in this chapter are easy to nod along to and easy to get wrong. You can rebuild a miniature of the whole system in a day with a public dataset, a laptop and no GPU, and watch each design decision change the numbers.
Pick one word from the Speech Commands dataset (Warden, 2018), such as "marvin", as your wake word. Everything else in the dataset, other words and the background noise recordings, is the negative class, and the file names carry speaker IDs, which you will use for the speaker check.
- Compute log-mel features with 10 ms frames, stack 20 frames, and train a first-stage network of five layers of 32 units to output "phrase" or "other" per window. Train a second-stage network of five layers of 192 units on the same data.
- Build a long negative stream: at least 20 hours made by joining non-wake words over the background noise at random levels. Sweep each model's threshold and draw both DET curves, with false alarms per hour on a log axis.
- Connect the two as a cascade. Set stage 1 to fire a few times an hour, run stage 2 only on those windows, and compare the cascade's false-reject rate and false alarms with stage 2 alone. Count what share of windows stage 2 saw, and compute the average current with the formula in section 04 and numbers of your choice.
- Pick the threshold for one false alarm per hour from 1 hour of negatives and then from 20 hours. Test both on a fresh stream and compare with the Poisson prediction from section 05.
- Add the speaker check: for each speaker, average the features of three wake-word clips as a profile, score other clips by cosine, and measure how much it lowers false alarms from other speakers and how many of the speaker's own clips it rejects.
16Interview questions
BeginnerWhy can't a phone just run speech recognition all day and look for the wake word?
A full recogniser is far too large to run continuously on a battery. A detector only has to answer whether a short phrase was just said, and a model that knows one phrase can be thousands of times smaller. Google's 2017 paper puts the budget at about 1 mA for under 1% of battery a day, and in Chen et al.'s paper the recogniser used for labelling had 50 million parameters, against about 14 thousand weights for the small first-pass detector in Apple's later papers. Streaming everything to a server would also send every sound a person makes to the cloud, and that's why Apple's detector runs on the device.
BeginnerWhat are a false accept and a false reject, and why is there no equal error rate in the product?
A false accept is the device waking without the phrase, measured per hour of audio, and a false reject is a real phrase that fails to trigger, measured as a share of attempts. Since the units differ, the crossing point where they're equal means nothing, as Apple's 2017 post notes. We choose a threshold by fixing a false-alarm budget, such as one a week, and reading off how many real phrases are rejected there.
IntermediateWhy use two stages, and how do you choose the first stage's operating point?
Accurate models are too expensive to run all day and cheap models aren't accurate enough, so a small model on a low-power chip runs continuously and wakes a bigger one. Average current is , where is wake-ups per hour. A strict first stage saves power but rejects real phrases that the second stage can never recover, and a lenient one passes nearly everything but wakes the big model too often. Google tuned the first stage to a handful of wake-ups an hour with similar false-reject rates in both stages, and its table shows cascade false rejects falling from 5.6% to 3.5% as the first stage's false alarms rose from 0.5 to 10 an hour, close to the second stage alone at 3.1%.
IntermediateHow do per-frame probabilities become a detection, and why does order matter?
The network gives posteriors over sound classes every 10 ms. Chen et al. smooth each over 30 frames and take the geometric mean of each phrase class's maximum over a 100-frame window, which ignores order. Apple's 2017 post and Gruenstein et al. use a dynamic programme that forces the units in sequence, with in Apple's case. In a simulation of a six-unit phrase, the any-order score is the same for the phrase and its reverse (0.45), while the ordered score falls from 0.45 to 0.17.
IntermediateHow many hours of negative audio do you need to verify one false alarm per week?
Counting rare events is a Poisson problem: the relative error is , so you need to see about 100 events for 10% accuracy. At one per 168 hours that is about 16,800 hours. A 2,800-hour set, like Apple's 2018 evaluation, expects about 17 events and has about 24% error. In a simulation of choosing the threshold from a finite set, 100 hours gave actual rates from 0.18 to 4.30 per week and 2,800 hours gave 0.73 to 1.34.
IntermediateHow does speaker verification for the trigger work, and what are its tradeoffs?
The device turns the phrase into a fixed-length speaker vector, in Apple's 2018 version a 100-number DNN bottleneck output, stored in a profile of up to 40 vectors seeded by five enrolment phrases. Each new utterance is scored by the mean cosine similarity to the profile vectors against a threshold . Raising lowers false and imposter accepts and raises false rejects. Apple's DNN cut imposter accepts from 11.9% to 3.2% and false rejects from 9.8% to 5.2% over an LDA transform, but the system was weaker in reverberant rooms and cars, and implicit enrolment risks learning a wrong voice.
DeepExplain how an SVDF or stacked 1D convolution layer saves parameters, and what limits it.
A unit over features and frames normally has weights. The factorised layer applies a length- filter across features to get one number per frame, then a length- filter across time, so it has weights, about 8.5 times fewer for and . Stacking layers gives a receptive field of past frames with no recurrence. Higuchi et al. found the convolution form (with biases and optional future context ) cut false rejects 19% relative to the SVDF at one false alarm an hour, and that above 1 hurt because the left receptive field fell below the phrase length, while every extra future frame adds delay.
DeepHow can audio after the trigger reduce false triggers on a device with tight memory?
A streaming transformer encoder processes audio in overlapping blocks of about 1.9 seconds, keeping the keys and values of the previous block, so cost grows linearly with audio length where full attention grows quadratically. A second output scores every frame with cross-entropy and a unidirectional LSTM smooths it, avoiding the peaky overconfident outputs that a CTC loss gives. Garg et al. report 95.8% of false triggers suppressed for 1% extra false rejects with one more second of audio, and 32% less memory and 56% less inference time than non-streaming processing on a 2019 phone.
DeepProduction false alarms per week go up after a model update though the offline DET curve improved. What do you check?
First, whether the offline negatives resemble current traffic, since test sets drift and the unstructured sets keep growing. Second, the size of the test: at 17 expected events, a 24% change is within noise. Third, a mismatch in the cascade, since the stages' errors are correlated and each stage's curve alone doesn't predict the whole. Fourth, quantisation and platform effects, as the S1DCNN results were in 32-bit floating point and Google saw per-chip differences. Fifth, new conditions in the field such as reverberant rooms or other languages. Finally, the speaker profile, if implicit enrolment has drifted. Production sampling of false alarms, as Apple describes, is the direct check.
DeepWhy did supporting "Siri" without "Hey" need more than a new threshold?
Apple's 2023 post lists the short phrase among the challenges. With fewer sounds the first stage has less evidence, so more ordinary speech resembles it at a given threshold, an inference from the design and not a published figure. Apple's published response is more weight on later stages: a Conformer checker, speaker identification that runs early and late, and a directed-speech stage using lattices, acoustics and text, including a classifier for non-vocative uses of the word "Siri". It gives no accuracy numbers.