Inferensys

Glossary

Time-Frequency Tokenizer

A preprocessing module that converts a raw time-series signal into a sequence of tokens representing localized time-frequency patches, enabling a standard transformer backbone to process spectral content efficiently.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
SIGNAL PREPROCESSING

What is Time-Frequency Tokenizer?

A preprocessing module that converts a raw time-series signal into a sequence of tokens representing localized time-frequency patches, enabling a standard transformer backbone to process spectral content efficiently.

A Time-Frequency Tokenizer is a preprocessing module that transforms a raw, one-dimensional time-series signal into a sequence of discrete tokens representing localized time-frequency patches. By applying a Short-Time Fourier Transform (STFT) or wavelet transform, the signal is decomposed into a two-dimensional spectrogram, which is then segmented into a grid of patches. Each patch is flattened into a vector and linearly projected into an embedding space, creating a token sequence that a standard transformer backbone can process natively.

This approach bridges the gap between raw signal processing and sequence-based architectures like the Spectrogram Vision Transformer. The tokenizer inherently captures the non-stationary spectral content of signals, making it ideal for tasks like Automatic Modulation Classification and RF Fingerprinting. Unlike raw IQ sample tokenization, time-frequency tokens provide explicit frequency locality, allowing the transformer's self-attention mechanism to learn correlations between specific frequency bands and temporal events without requiring the model to infer the Fourier basis from scratch.

ARCHITECTURE

Key Features

The Time-Frequency Tokenizer bridges raw signal processing and transformer-based sequence models by converting continuous waveforms into discrete, learnable tokens that capture localized spectral energy.

01

Short-Time Fourier Transform (STFT) Frontend

The tokenizer begins with an STFT to decompose the raw IQ or real-valued time-series into a 2D time-frequency representation. This step localizes spectral content into overlapping or non-overlapping windows, producing a complex-valued spectrogram. The magnitude and phase components are then separated or processed jointly, depending on the downstream architecture. This frontend is critical for exposing the non-stationary characteristics of communication signals, such as frequency hops or transient pulses, that a raw waveform tokenizer would miss.

02

Patch Embedding and Linear Projection

Inspired by the Vision Transformer (ViT), the 2D spectrogram is divided into a grid of non-overlapping time-frequency patches. Each patch—a small matrix of spectral bins spanning a short time window—is flattened into a 1D vector. A learned linear projection then maps this vector to a fixed-dimensional embedding space, creating a patch token. This process aggressively compresses the raw spectrogram while preserving local correlations between adjacent frequency bins and time steps.

03

Learnable Frequency Positional Encoding

Standard positional encodings are insufficient for spectral data. The tokenizer injects a learnable frequency-domain positional encoding (FPE) that encodes the absolute center frequency of each patch. This allows the transformer backbone to understand the ordering of subcarriers or frequency bins. For multi-channel systems, a separate antenna index embedding can be added. This encoding ensures the model distinguishes between identical spectral patterns occurring at different carrier frequencies, a crucial capability for wideband spectrum analysis.

04

Complex-Valued Token Preservation

For applications requiring phase coherence, such as beamforming or digital pre-distortion, the tokenizer preserves the complex nature of the signal. Instead of separating magnitude and phase into two real channels, the patch embedding and subsequent linear projection operate in the complex domain using complex-valued neural network layers. This preserves the IQ imbalance and phase rotation information that would be lost in a real-valued conversion, enabling the transformer to learn physically meaningful representations of the wireless channel.

05

Overlapped Patching for Temporal Continuity

To avoid boundary artifacts and capture transient events that fall on patch borders, the tokenizer employs overlapped patching in the time dimension. Adjacent time-frequency patches share a percentage of their temporal bins. This redundancy ensures that a short pulse or frequency hop is fully captured within at least one token. The overlap ratio is a tunable hyperparameter, balancing the trade-off between token sequence length and the risk of missing critical, short-duration signal features.

06

Hierarchical Multi-Scale Tokenization

A single patch size cannot optimally capture both narrowband tones and wideband bursts. A hierarchical tokenizer generates tokens at multiple resolutions by using different STFT window lengths and patch sizes in parallel. Fine-scale tokens capture rapid micro-Doppler modulations, while coarse-scale tokens represent long-term spectral occupancy. These multi-scale token sequences are fused using cross-attention or concatenated before being fed to the transformer, providing a rich, scale-invariant representation of the electromagnetic environment.

TIME-FREQUENCY TOKENIZATION

Frequently Asked Questions

Core concepts and operational mechanics behind converting raw electromagnetic waveforms into discrete token sequences for transformer-based signal processing architectures.

A Time-Frequency Tokenizer is a preprocessing module that converts a raw time-series signal into a sequence of discrete tokens, each representing a localized time-frequency patch. The process begins by computing a time-frequency representation—typically a Short-Time Fourier Transform (STFT) or wavelet transform—which maps the 1D waveform into a 2D spectrogram. This spectrogram is then divided into a grid of overlapping or non-overlapping patches, analogous to how a Vision Transformer (ViT) processes images. Each patch is flattened into a vector, projected through a learned linear embedding layer, and combined with a Frequency-Domain Positional Encoding that encodes the temporal and spectral coordinates of the patch. The resulting sequence of token vectors is fed directly into a standard transformer backbone, enabling self-attention mechanisms to model both short-term spectral events and long-range temporal dependencies without requiring specialized recurrent or convolutional inductive biases.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.