CaseLawModernBERT-large is a legal domain-adapted version of
ModernBERT-large, further pre-trained on US court opinions using the masked language modeling objective. It supports sequences up to 8,192 tokens, enabling full-length court opinion processing.
This model was obtained by further pre-training the ModernBERT-large checkpoint on 8.3 million US court opinions (13 billion words) from the
Collaborative Open Law Data (COLD). Pre-training used a masked ratio of 30%, a learning rate of 3e-4 with a linear scheduler, and weight decay of 8e-5, with a batch size of 512 and a maximum sequence length of 8,192 tokens.
The model architecture and training setup are analogous to
ModernBERT, incorporating flash attention, ROPE embeddings, and alternating local/global attention layers. To run the model, install the environment described in
ModernBERT.
1from transformers import AutoTokenizer, AutoModelForMaskedLM
2
3model_id = "ai-law-society-lab/CaseLawModernBERT-large"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForMaskedLM.from_pretrained(model_id)
See the paper for full results including confidence intervals and additional benchmarks.
Apache 2.0, consistent with the base
ModernBERT license.