AI
SSM models rival transformers for legal AI tasks while processing text 3-4x faster
A new benchmark shows that selective state-space models like Mamba can match transformer performance on legal document classification and case retrieval while dramatically outpacing them in speed.
The volume of legal statutes and court decisions is outpacing the ability of lawyers and legal professionals to review them manually. A key challenge: many individual judicial documents exceed the input limits of widely-used encoder models, forcing systems to truncate or split documents in ways that undermine their ability to reason about complete cases.
While transformer-based models dominate legal AI benchmarks today, their computational architecture—which uses quadratic attention mechanisms—makes them expensive to scale to long sequences. An emerging alternative, selective state-space models (SSMs) such as Mamba, promise linear-time processing that could handle entire documents without fragmentation. Yet their effectiveness on real legal tasks remained largely untested.
Comparing SSMs and transformers on legal benchmarks#
Researchers at arXiv published a preliminary evaluation pitting Mamba and SSD-Mamba against established models—BERT, DeBERTa, and Longformer—across six legal AI tasks. Four involved document classification (European Court of Human Rights, EU legislative corpus, U.S. Supreme Court, and Indian courts); two focused on retrieving relevant case law.
The strongest SSM performed within approximately 1.3 percentage points of the best transformer across tasks and metrics. More strikingly, SSD-Mamba delivered top results on most measures for European Court classification, Indian court classification, and European Court retrieval, while DeBERTa remained superior for U.S. Supreme Court and EU legislative documents.
Speed advantage reshapes the equation#
The speed differential proved decisive. SSD-Mamba processed roughly 3 times more tokens per second than DeBERTa and 4 times more than Longformer, a gap that compounds when handling the lengthy, complex documents typical in legal practice. This efficiency gain could enable faster case analysis and retrieval at scale.
Caveats and next steps#
The authors emphasize their results remain preliminary. The benchmark lacked variance estimates across multiple random initialization seeds and statistical significance testing—meaning apparent differences between models may not represent genuine gaps. To move beyond initial findings, future work must include repeated experiments with proper statistical controls, capacity parity checks between models, and rigorous computational efficiency analysis.

