﻿# W2v-BERT input preparation: stacked filterbank frames are not raw waveform samples

Follow the released W2v-BERT processor configuration through filterbank extraction, frame stacking, sequence masks, and the model input_features boundary.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-w2v-bert-filterbank-frame-stacking-input-contract/
Language: en

## Select the actual encoder artifact

The [released W2v-BERT card](https://huggingface.co/facebook/w2v-bert-2.0) identifies a speech encoder and demonstrates preparation through its processor. The family name resembles waveform-input models, but that resemblance is not an input specification. Inspect the artifact's preprocessing assets before reusing another encoder's request wrapper. This guide concerns the feature boundary and temporal packing rather than a general comparison of recognition quality across speech models.

## Read the shipped preprocessing configuration

The [checkpoint configuration](https://huggingface.co/facebook/w2v-bert-2.0/blob/main/preprocessor_config.json) selects `SeamlessM4TFeatureExtractor`, a sampling rate of 16000, mel-bin configuration of 80, and stacking stride of 2. Those fields jointly identify the preparation path. They should not be replaced by a generic waveform normalizer simply because both processors accept decoded audio at their public boundary. The public processor input and the neural encoder input are different levels of the pipeline.

## Follow frame stacking into features

The [feature extractor implementation](https://raw.githubusercontent.com/huggingface/transformers/main/src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py) extracts filterbank features and reshapes successive frames so that temporal length and feature width change together. This is more than attaching a batch axis to waveform samples. A custom frontend must preserve frame construction, normalization, stacking, and the corresponding attention mask. Guessing model time positions directly from raw sample indices skips the transformations that define the effective sequence consumed by the encoder.

## Diagnose a superficially valid port

Suppose an exported encoder accepts a tensor of the expected rank after a wrapper reshapes a waveform into rows. The rank check alone does not establish acoustic compatibility. Compare the prepared features against the reference processor on a known recording, including effective frame count and padded positions. Inspect the first disagreement before evaluating downstream text. This makes frontend mistakes observable without pretending that matching shapes or a plausible recognition fragment proves equivalent preprocessing.

## Version the frontend with the weights

Store the processor configuration, implementation revision, sampling preparation, feature sequence, mask, and encoder artifact together. Guides to [tensor axes](/journal/tensor-axes-batch-sequence-hidden/) and [inference evaluation](/journal/inference-benchmark-method/) support the comparison. Include recordings of differing lengths to exercise stacking boundaries. A faithful deployment reproduces the meaning of each feature frame, rather than treating every speech encoder as a universal raw-waveform interface whose inputs can be exchanged by renaming tensor arguments.
