AssemblyAIUniversal2<T>

Models & Types · AiDotNet.SpeechRecognition.ProprietaryAPI

AssemblyAI Universal-2: a 600M-parameter Conformer RNN-T, the configuration of Universal-1 (Ramirez et al. 2024).

Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → AssemblyAIUniversal2<T>

Implements: ISpeechRecognizer<T>

For Beginners

AssemblyAI Universal-2 turns 16 kHz audio into an 80-band log-mel spectrogram, shortens it 4x with two convolutions, and encodes it with Conformer blocks, each mixing self-attention (long-range context) with a convolution (local patterns). A small LSTM remembers the words written so far and a joint network combines it with each audio frame to pick the next token or “nothing yet”.

How It Works

AssemblyAI states that Universal-2 keeps the configuration and capacity of Universal-1, whose paper (“Anatomy of Industrial Scale Multilingual ASR”, section 3.2) describes it: 80-dimensional log-mel input, two convolutions for 4x reduction, 24 bidirectional Conformer layers of width 1024 with 8 heads, absolute sinusoidal positions and chunk-wise attention over 8-second chunks (following Zhang et al. 2023, whose 5-wide depthwise kernel is used here), an RNN-T decoder and 2,048 WordPiece tokens. The encoder is pre-trained with BEST-RQ in the paper; the prediction and joint network sizes are not stated, so these use the Conformer paper’s 640-unit LSTM and 640-wide joint network. SpecAugment masks the features in training (section 3.1). The RNN-T decoder (Graves 2012) trains with the transducer loss and decodes greedily, at most ten labels per frame.

Example

var architecture = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.SpeechRecognition,
    inputSize: 16000, outputSize: 34);
var model = new AssemblyAIUniversal2<float>(architecture);
var text = model.Transcribe(waveform).Text;

Constructors

Constructor Summary
AssemblyAIUniversal2(NeuralNetworkArchitecture<T> architecture, AssemblyAIUniversal2Options options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
AssemblyAIUniversal2(NeuralNetworkArchitecture<T> architecture, string modelPath, AssemblyAIUniversal2Options options)

Properties

Property Summary
IReadOnlyList<string> SupportedLanguages { get; }
bool SupportsStreaming { get; }
bool SupportsWordTimestamps { get; }

Methods

Method Summary
IReadOnlyDictionary<string, T> DetectLanguageProbabilities(Tensor<T> audio)
IStreamingTranscriptionSession<T> StartStreamingSession(string language)
ModelMetadata<T> GetModelMetadata()
Task<TranscriptionResult<T>> TranscribeAsync(Tensor<T> audio, string language, bool? includeTimestamps, CancellationToken cancellationToken)
Tensor<T> ForwardForTraining(Tensor<T> input)
TranscriptionResult<T> Transcribe(Tensor<T> audio, string language, bool? includeTimestamps) Transcribes audio: the encoder and the transducer with greedy decoding.
string DetectLanguage(Tensor<T> audio)