Train an audio signature detector
Course · Data modalities · Notebook
Learn from 128 actual waveform samples. Play the generated tones, poison accepted labels and shift the waveform phase without retraining.
Optional self-paced practice; not used in the lectures. Predict first, change one thing, compare, then explain. No account, installation or API key.
Enable JavaScript for local training. The paper route below preserves the reasoning if the worker is unavailable.
Ten-minute route
Use 2 minutes to inspect and predict; 2 to train and inspect weights; 2 to poison and retrain; 2 to change the input with frozen models; 2 to restore and explain. R means needs review; N means no review in this supplied case. Use the same threshold throughout. Stop playback before switching views.
Teaching steps: predict, do, observe, explain
-
Reset; keep 0 label edits and threshold 0.50. Play original. PCM means sound amplitude samples; inspect the waveform and its frequency spectrum.
-
Train both 500 updates. Compare their scores and evaluation catches. At 0 label edits the two copies receive identical examples.
-
Open Weights & loss: one weight per sample position. Training labels shows the actual waveforms and R/N labels; loss fits accepted labels.
-
Change 9 review labels to no review. Inspect R→N, then retrain both. Compare catches on the same unchanged evaluation examples.
-
Input & scores: set shift to 4, press Shift audio phase, then Play current. Compare scores, unchanged energy/spectrum and 500 updates. The tone may sound the same.
-
Restore input; set label edits to 0 and retrain. Explain poisoning versus phase evasion; a tone signature does not authenticate a speaker.
Next/Back changes the instruction only. Train both performs actual gradient updates in a local Web Worker. Playback changes neither weights nor labels. Changing accepted labels resets both copies for a matched retraining; changing a threshold only changes routing.
What reaches the model?
128 PCM amplitudes at 8,000 samples/s, spanning a 16 ms block. PCM means sampled sound amplitude. Playback repeats that block for 0.512 seconds with a short fade at low gain. The known beacon tone is 1,000 Hz; the approved service tone is 250 Hz. These are supplied acoustic security signatures, not recordings, speech or authenticated speakers.
One learned weight belongs to each sample position. A four-sample circular shift changes phase by half a cycle for the review tone, preserving the frequency spectrum and total squared amplitude. The model learned a phase-sensitive shortcut; this exercise does not establish a robust acoustic intrusion detector. The poisoned copy can react differently to the same shift; compare both scores.
Record one comparison
| Run | Label edits | Updates each | Clean review catches /8 | Poisoned catches /8 | Original/current clean score | Invariant checked |
|---|---|---|---|---|---|---|
| Matched clean training | 0 | 500 | ||||
| Label poisoning | 9 | 500 | ||||
| Input evasion with frozen models | 9 | 500 | ||||
| Trusted labels restored | 0 | 500 |
Keep threshold 0.50 for the reference comparison. Write which surface changed: accepted learning labels, presented input, or routing threshold. Explain one security observation still missing before an action.
Each learner uses 24 training and 16 separately seeded development examples from two authored families. Both models start at zero and use the same 500-update budget; evaluation labels never train them. Scores are not calibrated attack probabilities. These small development cases cannot establish real-world detection performance.
If training or media playback is unavailable
Draw a sine wave and mark 128 sample positions. Move the start by four samples; the frequency is unchanged but each position receives a different amplitude. Use the supplied clean reference if playback or the worker is unavailable. A waveform drawing is not a completed training run.
Explain it to your partner
Question: The tone can sound similar while the score changes. Which observation explains that?
Take 30 seconds each: point to the input, name the one change, then cite an observation from your run. A useful explanation: The phase shift changed sample positions while the input magnitude spectrum and squared amplitude stayed fixed.
Read next: Concept and research connection. The reading is optional; you do not need its mathematics for this exercise.