← All models

audio-feature-extraction Β· audio Β· WASM (WebGPU when available) Β· ~95 MB

HuBERT β€” speech as clusters, not words

Like every self-supervised speech model here, HuBERT hands you numbers, not text: for every ~20 ms frame of audio it emits a 768-dimensional embedding describing what the sound is. What sets HuBERT apart is how it learned. It was trained by masked cluster prediction β€” an offline k-means groups audio frames into discrete acoustic units, and the model must predict the unit id of masked frames, BERT-style. That objective pushes its features to organise speech into phone-like clusters. Compare two clips, search a recording for a sound, or cluster audio by ear β€” entirely on this device.

At a glance

ModelXenova/hubert-base-ls960 (facebook/hubert-base-ls960)
Task / pipelineaudio-feature-extraction β€” loaded as AutoModel so we can read the raw last_hidden_state frames
ArchitectureSelf-supervised speech transformer: a CNN feature encoder over raw 16 kHz audio (7 conv layers, 320Γ— downsampling β†’ one frame per ~20 ms) β†’ a 12-layer transformer. ~94.4M params. No text head β€” the output is per-frame embeddings.
Pretraining objectiveMasked cluster prediction (HuBERT). An offline k-means over acoustic features (MFCCs first, then the model's own hidden states in later iterations) assigns each frame a discrete cluster id; the model predicts those ids for MASKED frames. This "predict the self-discovered unit" task is the whole difference vs WavLM.
Outputlast_hidden_state β€” shape [1, T, 768]: one 768-dim vector per ~20 ms frame
Quantizationq8 (8-bit) ONNX β€” onnx/model_quantized.onnx
BackendWebAssembly (WebGPU when a real adapter is present), honest fallback
Download~95 MB (single encoder), cached after first load
LicenseApache-2.0 β€” Meta AI (Fairseq / HuBERT)
Web APIsWebAssembly / WebGPU, Web Workers, Web Audio (decode + resample to 16 kHz)

Same task and 768-dim output as the WavLM demo, but a different pretraining objective: HuBERT predicts offline k-means cluster ids for masked frames; WavLM predicts masked speech with an added denoising / overlapped-speech objective. Compare their frame-embedding heatmaps and similarity scores on the two pages.

Run it β€” how alike are two sounds?

Pick a clip for A and one for B (or upload your own), then Compare. Each clip is embedded on-device into a single 768-dim vector; their cosine similarity says how close they are in HuBERT's feature space. Same speaker or same words score high; different voices/content score lower.

Clip A

Clip B

See inside β€” the frame embeddings

This is what HuBERT actually produces. Below is clip A's last_hidden_state painted as a heatmap: time runs left→right (one column per ~20 ms frame), the 768 embedding dimensions run top→bottom, and colour is each value (dark = low, bright = high). There's no vocabulary here — just structure. Because HuBERT was trained to predict discrete cluster units, the same phone tends to paint the same vertical texture wherever it recurs; silence looks flat. The single vector we compare is this whole map averaged over time.

Compare two clips above to paint clip A's frame-embedding heatmap.

Why it matters

A transcript throws almost everything away β€” who spoke, how, in what language, over what noise. HuBERT's self-supervised embeddings keep it. Because they were learned by predicting self-discovered acoustic clusters for masked frames, a single 768-dim vector captures speaker, phonetic content and acoustic conditions at once β€” and you can do maths on it without any labelled training data of your own. HuBERT is the backbone the entire SUPERB benchmark (ASR, speaker id, emotion, intent) fine-tunes from.

Use cases

Basics

Audio similarity: embed a bank of clips and read the full pairwise cosine matrix.

Practical

Find a sound: brush a query on a recording and search for where it recurs.

Wild

Cluster by ear: project every clip's embedding to 2D and watch voices group.

Multi-model

HuBERT retrieves the nearest clip by sound β†’ wav2vec2 reads out what it says.

How the API works

There's no pipeline for "give me the frames" β€” so we load the model directly and read last_hidden_state, then mean-pool + L2-normalise into one comparable vector:

import { AutoProcessor, AutoModel } from "@huggingface/transformers";

const processor = await AutoProcessor.from_pretrained("Xenova/hubert-base-ls960");
const model = await AutoModel.from_pretrained(
  "Xenova/hubert-base-ls960",
  { device: "wasm", dtype: "q8" },
);

// audio = 16 kHz mono Float32Array
const inputs = await processor(audio);
const { last_hidden_state } = await model(inputs); // [1, frames, 768]

// one comparable vector per clip: average over time, then normalise
const emb = meanPool(last_hidden_state);           // 768-dim
const score = cosine(embA, embB);                  // -1 … 1

Inference and the heatmap composite both run in a Web Worker, and the RGBA heatmap is transferred back (not copied) so the UI never janks β€” nothing is faked or pre-computed.

References

Sample clips: JFK inaugural (public domain) + TED excerpt, and Spanish/German/Russian Spoken-Wikipedia excerpts (CC BY-SA) β€” see the model page credits.