FireRedASR<T>
Models & Types · AiDotNet.SpeechRecognition.LLMIntegrated
FireRedASR-AED (Xu et al. 2025): a Conformer encoder with a Transformer decoder for Mandarin and English recognition.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → FireRedASR<T>
Implements: ISpeechRecognizer<T>
For Beginners
FireRedASR-AED 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 linear layer gives every frame a probability for each token; collapsing repeats and blanks gives the transcript.
How It Works
The defaults are FireRedASR-AED-L (section 2.1 and Table 1): 80-dimensional log-mel features, two stride-2 3x3 convolutions of 32 channels with ReLU, 16 Conformer blocks of width 1280 with relative attention and a 33-wide depthwise kernel, and a 16-layer pre-norm Transformer decoder with fixed sinusoidal positions whose output layer shares the token embedding. The vocabulary is 7,832 tokens (1,000 English BPE tokens, 6,827 Chinese characters and 5 special tokens) and training is cross-entropy. The paper does not state the head count or feed-forward width; these use 20 heads (64 dimensions each) and four times the width. FireRedASR-LLM, the paper’s encoder-adapter-LLM variant, is a separate class. SpecAugment masks the features in training (section 3.1). Training minimizes the decoder’s cross-entropy and transcription decodes greedily. The paper’s blocks use relative
positional encoding; these use rotary position encoding, the relative scheme
ConformerBlockLayer provides.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.SpeechRecognition,
inputSize: 16000, outputSize: 34);
var model = new FireRedASR<float>(architecture);
var text = model.Transcribe(waveform).Text;
Constructors
| Constructor | Summary |
|---|---|
FireRedASR(NeuralNetworkArchitecture<T> architecture, FireRedASROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
FireRedASR(NeuralNetworkArchitecture<T> architecture, string modelPath, FireRedASROptions 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 decoder with greedy decoding. |
string DetectLanguage(Tensor<T> audio) |