SambaASR<T>

Models & Types · AiDotNet.SpeechRecognition.LLMIntegrated

Samba-ASR: Mamba-based state-space model for speech recognition

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

Implements: ISpeechRecognizer<T>

For Beginners

Samba-ASR applies the Mamba selective state-space model architecture to speech recognition. Unlike Transformer-based ASR with quadratic attention complexity, Mamba’s linear-time SSM layers process sequences efficiently. The model uses selective sc…

How It Works

References:

  • Paper: “An Exploration of State Space Models and Mamba for Speech Recognition” (Miyazaki et al., 2024)

Samba-ASR applies the Mamba selective state-space model architecture to speech recognition. Unlike Transformer-based ASR with quadratic attention complexity, Mamba’s linear-time SSM layers process sequences efficiently. The model uses selective scan mechanisms that dynamically filter speech features based on content, achieving competitive WER with significantly lower computational cost for long-form audio processing.

Example

// Create a Samba-ASR model using Mamba state-space architecture
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.SpeechRecognition,
    inputHeight: 16000, inputWidth: 1, inputDepth: 1, outputSize: 5000);
var model = new SambaASR<double>(architecture);
            
// Or load a pre-trained ONNX model for linear-complexity ASR
var onnxModel = new SambaASR<double>(architecture, "sambaasr.onnx");

Constructors

Constructor Summary
SambaASR(NeuralNetworkArchitecture<T> architecture, SambaASROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
SambaASR(NeuralNetworkArchitecture<T> architecture, string modelPath, SambaASROptions 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)
TranscriptionResult<T> Transcribe(Tensor<T> audio, string language, bool? includeTimestamps) Transcribes audio using Mamba SSM encoder with CTC decoding.
string DetectLanguage(Tensor<T> audio)