Write-Budgeted Codebook Adaptation for On-Device Speech Anonymization

Speech anonymizers hide who is speaking while keeping what is said. Many strong ones pass speech through a discrete bottleneck: each short audio frame is replaced by the nearest entry in a small learned dictionary of sound prototypes, called a codebook. A small dictionary can store which phoneme was said but not the fine detail of a particular voice. These codebooks are fit once in the lab and then frozen. Deployed on a phone or hearing device, they meet new microphones, accents and noise, and their prototypes drift away from the incoming speech. The natural fix is to update the codebook on the device as speech arrives. That fix runs into two problems at once.

The first problem is hardware. The large, dense, always-on memories in edge chips are increasingly non-volatile memories (memory that keeps its contents without power, such as phase-change or magnetic RAM). In these memories a write is far slower, costs far more energy, and wears out the cell, while reads are cheap. The second problem is privacy. A codebook adapted on one person's voice slowly absorbs that person's timbre, and because the memory persists, it keeps a voiceprint stored on the device. This note argues that the two problems share a solution. If persistent codebook writes are rationed, and each write is allowed to carry only the speaker-independent part of the drift, the write budget also acts as a cap on how much identity the device can store.

Core Claim

The claim is that online adaptation of a discrete content codebook can be run under an explicit persistent-write budget. Under that budget it should recover most of the recognition accuracy lost under domain shift and keep output privacy at chance level. It should also leave a stored codebook from which a speaker cannot be identified. This depends on deciding which updates reach persistent memory, not merely how often.

The proposed commit rule has three parts. First, it accumulates centroid statistics in a few kilobytes of volatile scratch memory. Second, it reads the stored centroid, which is cheap, and computes the pending displacement. Third, it projects out directions known to encode speaker variation. A write happens only when the remaining displacement crosses a threshold that grows each time that centroid is committed.

Nothing in the file connects discrete speech bottlenecks with asymmetric memory costs. The adjacent work also differs in kind. Non-Volatile Memory Array Based Quantization- and Noise-Resilient LSTM Neural Networks maps 4-bit scalar-quantized weights onto memory crossbars for inference only, and explicitly leaves on-chip updating open because of write overheads. Its quantization also lowers numeric precision; it is not a dictionary bottleneck meant to remove identity.

Research Program

The mechanism is assembled from three prior results, each used in a different role.

The cost principle, spending reads to avoid writes, comes from Sorting with Asymmetric Read and Write Costs. That paper models writes as costing $\omega > 1$ and reads as costing 1, and shows sorting can be done with $O(n)$ writes instead of $O(n\log n)$. A related practical tactic, reading data first to see whether a write can be skipped, appears in NVMSorting. Here the principle is applied to a learned statistic rather than to sorted keys.

The growing threshold borrows from Streaming Algorithms with Few State Changes. That paper uses Morris-style probabilistic counters, which change their stored value only logarithmically often, to bound how many times a streaming estimator modifies its state. We do not inherit its moment-estimation bounds. We inherit only the design pattern. If centroid $k$ has been committed $c_k$ times, the next commit requires a projected displacement of at least $\tau\gamma^{c_k}$ for some growth factor $\gamma > 1$. For a stationary stream this gives commits per centroid that grow only logarithmically in the number of frames, for the same reason a Morris counter's updates do.

The speaker-removal step needs a subspace of speaker directions. It is estimated on training data: for each code we compute the covariance of the per-speaker mean of the frames assigned to it, which captures between-speaker spread within a code. $P$ is the projection onto the complement of its top directions. The commit test for centroid $k$ is then

$$\| P(\hat{\mu}_k - \mu_k) \| \ge \tau \gamma^{c_k},$$

where $\mu_k$ is the stored centroid, $\hat{\mu}_k$ is the running mean of recently assigned frames held in volatile scratch, $\tau$ is a base threshold, and $c_k$ counts past commits. A commit writes $\mu_k + P(\hat{\mu}_k - \mu_k)$. The written delta can optionally be coarsely quantized, which shrinks the bytes written.

The backbone is the streaming anonymizer of DarkStream. It is a causal content encoder with a 140 ms lookahead, an optional k-means bottleneck, and generated pseudo-speaker embeddings, reimplemented if code is unavailable. Its k-means bottleneck admits the running-mean centroid updates above directly. As a second backbone we test the factorized vector-quantization encoder of TVTSyn. Both papers run on desktop GPUs and treat all state as free volatile memory.

The audio frame buffers stay in volatile memory throughout. A 140 ms buffer is tiny, and nothing here claims it belongs in persistent memory. The persistent object is the codebook, which must survive power cycles if the adaptation is to be worth anything.

Real hardware is replaced by a trace-driven cost model. Every persistent write is logged at cache-line granularity, and wall-time and energy proxies are computed for $\omega$ swept from 10 to 100, the 10x–100x range given in the file's background. We also report the maximum writes to any single line as a wear proxy. Micro-architectural Analysis of OLAP Systems on Persistent Memory motivates this caution. It finds that even small intermediate-write traffic stalls processors for up to 90% of cycles and causes a 1.4x slowdown. We do not transfer those numbers to our setting.

Baselines

The naive reference is the frozen factory codebook trained on LibriTTS and LibriSpeech. It performs zero persistent writes and sets the floor that any adaptation must beat on shifted data. The closest published systems report, on in-domain evaluation, about 47% EER under lazy-informed attack, 2.09% WER without quantization and within 9% under heavy quantization, and MOS 3.79 (DarkStream). TVTSyn reports 47.55% EER and MOS 3.82 (TVTSyn). We have no reported shifted-domain results for either system and no reported result found on Lacuna for persistent codebook write traffic in any speech model. The frozen system will therefore be re-measured under our shift protocol.

The unconstrained upper reference writes every running-mean update straight to persistent memory. It shows the best accuracy adaptation can buy and the worst write cost and identity absorption.

The strongest competitor is volatile batching. It accumulates the same statistics in scratch memory and flushes all changed centroids every $T$ seconds. $T$ is tuned so its total bytes written match our method's at each budget level. It is the honest engineering default, and it is the baseline the core claim must beat. All adaptive methods share the backbone, training data, scratch-memory size, user streams and hyperparameter-search budget.

Two ablations isolate the key ingredient. One keeps our growing threshold but drops the projection $P$. The other keeps $P$ but commits a random subset of centroids at the same budget. Beating batching means matching its shifted-domain WER within 0.5 absolute points at an equal write budget, while cutting speaker identification from the stored codebook by a clear margin with confidence intervals over speakers.

Why not just…?

Why not just keep the codebook frozen? If shift does not hurt a k-means content bottleneck much, adaptation is pointless, and that is a real threat. DarkStream's WER rising from 2.09% toward 9% under heavy quantization shows the bottleneck is sensitive to how well its prototypes fit the data, but that result is in-domain. The first experiment therefore measures the frozen system on accented, noisy and emotional speech. If the frozen system loses under one absolute WER point there, the proposal shrinks to a negative result about the value of adaptation.

Why not just batch updates in volatile memory and flush periodically? Periodic batching handles write count about as well as any clever rule, so write count alone cannot be our selling point. What batching does not control is content: each flush commits the full drift, speaker directions included. The budget-matched comparison decides this. If batching with a projection added matches the full method, the growing threshold contributes nothing and we will say so. The remaining contribution is then the projection, along with showing that persistent codebooks leak identity.

Why not just adapt a small continuous adapter, or use scalar quantization, instead of the codebook? Lower-bit continuous states still carry speaker detail. VoicePrivacy 2020's non-discrete baselines fell from 47–58% to 26–37% EER under informed attack (Introducing the VoicePrivacy Initiative). Adapting before the bottleneck would let identity re-enter upstream of the filter, and dense adapter updates touch many more lines per step. We run a write-matched encoder low-rank adapter as an extra baseline to show this directly.

Proposed Experiments

The models are trained on LibriTTS (LibriTTS) and LibriSpeech. Deployment is simulated as hours-long single-user streams built by concatenating each speaker's utterances. VCTK and CMU ARCTIC supply accent shift, CommonVoice supplies microphone and recording shift, and IEMOCAP supplies emotional shift. Outputs are scored with the VoicePrivacy protocol for lazy-informed and semi-informed ASV EER, ASR WER, and a naturalness MOS on a subset.

We add a device-capture attacker who reads the persistent codebook. It computes the delta between the adapted and factory codebooks and trains a classifier to identify which user produced it. It also runs verification against deltas obtained by adapting on that user's enrollment speech, and we report both identification accuracy and EER. The outcomes are plotted as curves of WER, output EER and capture EER against persistent bytes written per hour, at several values of $\omega$.

Three checks decide the proposal. Does any adaptation beat the frozen codebook on shifted streams? At equal write budget, does the projected commit rule match batching's WER while pushing capture EER toward 50%? Does capture EER rise as the budget tightens, which is what the claim that the write budget caps stored identity predicts? If the third check fails, the privacy half of the claim is wrong. What would remain is a modest result on write-efficient adaptation.