Professional model card with full documentation
Browse files
README.md
CHANGED
|
@@ -8,84 +8,269 @@ tags:
|
|
| 8 |
- family-law
|
| 9 |
- ohio
|
| 10 |
- modernbert
|
| 11 |
-
-
|
|
|
|
|
|
|
| 12 |
base_model: answerdotai/ModernBERT-base
|
| 13 |
datasets:
|
| 14 |
- Roderick3rd/OhioCustodyBERT-corpus
|
| 15 |
pipeline_tag: fill-mask
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
# OhioCustodyBERT
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
| | |
|
| 25 |
|---|---|
|
| 26 |
-
| **Base Model** | answerdotai/ModernBERT-base (149.7M params) |
|
|
|
|
|
|
|
| 27 |
| **Domain** | Ohio family law, child custody, domestic relations |
|
| 28 |
-
| **
|
| 29 |
-
| **Hardware** | 2× NVIDIA Tesla T4 (Kaggle) |
|
| 30 |
-
| **Corpus** | 864 curated custody case analyses |
|
| 31 |
| **Developer** | [Phoenix Intelligence LLC](https://github.com/rodneymullins) |
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
Fine-tuned on the [OhioCustodyBERT-corpus](https://huggingface.co/datasets/Roderick3rd/OhioCustodyBERT-corpus), which contains structured analyses of Ohio custody cases including:
|
| 36 |
|
| 37 |
-
-
|
| 38 |
-
- **Best-interest factor analysis** under Ohio Revised Code § 3109.04
|
| 39 |
-
- **Guardian ad litem recommendations**
|
| 40 |
-
- **Custody modification standards**
|
| 41 |
-
- **Shared parenting plan evaluations**
|
| 42 |
|
| 43 |
## Usage
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
```python
|
| 46 |
from transformers import pipeline
|
| 47 |
|
| 48 |
fill = pipeline("fill-mask", model="Roderick3rd/OhioCustodyBERT")
|
| 49 |
|
| 50 |
-
# Predict custody terms
|
| 51 |
-
|
| 52 |
-
for r in
|
| 53 |
-
print(f"{r['token_str']:
|
| 54 |
```
|
| 55 |
|
| 56 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
## Training Details
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
|
| 73 |
-
-
|
| 74 |
-
-
|
| 75 |
-
- Not
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
## License
|
| 78 |
|
| 79 |
-
Apache 2.0
|
|
|
|
|
|
|
| 80 |
|
| 81 |
## Citation
|
| 82 |
|
| 83 |
```bibtex
|
| 84 |
@misc{ohiocustodybert2026,
|
| 85 |
-
title={OhioCustodyBERT: Domain-Adapted Language Model for Ohio Family Law},
|
| 86 |
-
author={Phoenix Intelligence LLC},
|
| 87 |
year={2026},
|
| 88 |
publisher={Hugging Face},
|
| 89 |
-
|
| 90 |
}
|
| 91 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- family-law
|
| 9 |
- ohio
|
| 10 |
- modernbert
|
| 11 |
+
- masked-lm
|
| 12 |
+
- domain-adapted
|
| 13 |
+
- encoder
|
| 14 |
base_model: answerdotai/ModernBERT-base
|
| 15 |
datasets:
|
| 16 |
- Roderick3rd/OhioCustodyBERT-corpus
|
| 17 |
pipeline_tag: fill-mask
|
| 18 |
+
library_name: transformers
|
| 19 |
---
|
| 20 |
|
| 21 |
# OhioCustodyBERT
|
| 22 |
|
| 23 |
+
<p align="center">
|
| 24 |
+
<em>A domain-adapted legal language model for Ohio family law and child custody proceedings</em>
|
| 25 |
+
</p>
|
| 26 |
|
| 27 |
+
## Table of Contents
|
| 28 |
+
|
| 29 |
+
- [Model Summary](#model-summary)
|
| 30 |
+
- [Usage](#usage)
|
| 31 |
+
- [Training Data](#training-data)
|
| 32 |
+
- [Training Details](#training-details)
|
| 33 |
+
- [Results](#results)
|
| 34 |
+
- [Intended Use & Limitations](#intended-use--limitations)
|
| 35 |
+
- [Roadmap](#roadmap)
|
| 36 |
+
- [License](#license)
|
| 37 |
+
- [Citation](#citation)
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## Model Summary
|
| 42 |
+
|
| 43 |
+
OhioCustodyBERT is a **domain-adapted bidirectional encoder** fine-tuned from [ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) on a curated corpus of Ohio family law and child custody case analyses. It inherits ModernBERT's architectural improvements — Rotary Positional Embeddings (RoPE), Local-Global Alternating Attention, Flash Attention, and 8,192-token context — while specializing in the legal domain of domestic relations.
|
| 44 |
|
| 45 |
| | |
|
| 46 |
|---|---|
|
| 47 |
+
| **Base Model** | [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) (149.7M params) |
|
| 48 |
+
| **Architecture** | Encoder-only, Pre-Norm Transformer, GeGLU, RoPE |
|
| 49 |
+
| **Context Length** | Up to 8,192 tokens |
|
| 50 |
| **Domain** | Ohio family law, child custody, domestic relations |
|
| 51 |
+
| **Task** | Masked Language Modeling (MLM) |
|
| 52 |
+
| **Training Hardware** | 2× NVIDIA Tesla T4 (Kaggle, 32GB VRAM total) |
|
|
|
|
| 53 |
| **Developer** | [Phoenix Intelligence LLC](https://github.com/rodneymullins) |
|
| 54 |
+
| **Version** | v0.1 (proof-of-concept) |
|
| 55 |
|
| 56 |
+
OhioCustodyBERT is designed to understand the specialized vocabulary, reasoning patterns, and statutory references found in Ohio custody proceedings — including best-interest factors under ORC § 3109.04, guardian ad litem recommendations, shared parenting plans, and modification standards.
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
## Usage
|
| 61 |
|
| 62 |
+
Install transformers ≥ 4.48.0:
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
pip install -U transformers>=4.48.0
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
For best performance, install Flash Attention:
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
pip install flash-attn
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### Fill-Mask (MLM)
|
| 75 |
+
|
| 76 |
```python
|
| 77 |
from transformers import pipeline
|
| 78 |
|
| 79 |
fill = pipeline("fill-mask", model="Roderick3rd/OhioCustodyBERT")
|
| 80 |
|
| 81 |
+
# Predict custody-specific legal terms
|
| 82 |
+
results = fill("The court granted [MASK] custody to the mother.")
|
| 83 |
+
for r in results[:5]:
|
| 84 |
+
print(f" {r['token_str']:20s} (score: {r['score']:.4f})")
|
| 85 |
```
|
| 86 |
|
| 87 |
+
### As a Feature Extractor
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
from transformers import AutoTokenizer, AutoModel
|
| 91 |
+
import torch
|
| 92 |
+
|
| 93 |
+
tokenizer = AutoTokenizer.from_pretrained("Roderick3rd/OhioCustodyBERT")
|
| 94 |
+
model = AutoModel.from_pretrained("Roderick3rd/OhioCustodyBERT")
|
| 95 |
+
|
| 96 |
+
text = "The guardian ad litem recommended supervised visitation based on the best interest of the child."
|
| 97 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
|
| 98 |
|
| 99 |
+
with torch.no_grad():
|
| 100 |
+
outputs = model(**inputs)
|
| 101 |
+
|
| 102 |
+
# Use [CLS] embedding for classification or retrieval
|
| 103 |
+
cls_embedding = outputs.last_hidden_state[:, 0, :]
|
| 104 |
+
print(f"Embedding shape: {cls_embedding.shape}") # [1, 768]
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### Fine-Tuning for Downstream Tasks
|
| 108 |
+
|
| 109 |
+
OhioCustodyBERT can be further fine-tuned for:
|
| 110 |
+
|
| 111 |
+
- **Custody outcome classification** — predict custody type from case facts
|
| 112 |
+
- **Legal NER** — extract parties, statutes, dates, custody terms
|
| 113 |
+
- **Semantic search** — retrieve relevant precedent from case databases
|
| 114 |
+
- **Document classification** — categorize motions, orders, GAL reports
|
| 115 |
+
|
| 116 |
+
Fine-tuning follows standard BERT recipes. See [Hugging Face fine-tuning tutorial](https://huggingface.co/docs/transformers/training).
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
## Training Data
|
| 121 |
+
|
| 122 |
+
Fine-tuned on the [OhioCustodyBERT-corpus](https://huggingface.co/datasets/Roderick3rd/OhioCustodyBERT-corpus), containing **864 curated training examples** and **95 validation examples** of structured Ohio custody case analyses.
|
| 123 |
+
|
| 124 |
+
### Corpus Contents
|
| 125 |
+
|
| 126 |
+
| Category | Description |
|
| 127 |
+
|----------|-------------|
|
| 128 |
+
| **Case Law** | Excerpts from Ohio appellate custody decisions (e.g., *In re M.J.C.*, *Davis v. Davis*) |
|
| 129 |
+
| **Best-Interest Analysis** | Factor-by-factor analysis under Ohio Revised Code § 3109.04(F)(1) |
|
| 130 |
+
| **GAL Reports** | Guardian ad litem recommendation patterns and reasoning |
|
| 131 |
+
| **Modification Standards** | Change-of-circumstances analysis for custody modifications |
|
| 132 |
+
| **Shared Parenting** | Shared parenting plan evaluations and court reasoning |
|
| 133 |
+
| **Statutory References** | ORC § 3109.04, § 3109.051, § 3109.052, and related provisions |
|
| 134 |
+
|
| 135 |
+
### Data Format
|
| 136 |
+
|
| 137 |
+
Each example is structured as a system-prompted analysis:
|
| 138 |
+
- **System prompt**: Legal research assistant context for Ohio family law
|
| 139 |
+
- **Case content**: Extracted custody-relevant passages with analytical commentary
|
| 140 |
+
|
| 141 |
+
### Planned Corpus Expansion (v0.2+)
|
| 142 |
+
|
| 143 |
+
| Source | Status | Estimated Size |
|
| 144 |
+
|--------|--------|----------------|
|
| 145 |
+
| CourtListener (6.7M opinions) | 🔄 Downloading | ~50,000 family law cases |
|
| 146 |
+
| GovInfo US Code (family law titles) | ✅ Downloaded | Federal statutes |
|
| 147 |
+
| LeXFiles (19B tokens) | ✅ Downloaded | Broad legal foundation |
|
| 148 |
+
| Ohio Revised Code (lawriter.net) | ⏳ Planned | Ohio-specific statutes |
|
| 149 |
+
| Ohio Supreme Court slip opinions | ⏳ Planned | Latest case law |
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
|
| 153 |
## Training Details
|
| 154 |
|
| 155 |
+
### Configuration
|
| 156 |
+
|
| 157 |
+
| Parameter | Value |
|
| 158 |
+
|-----------|-------|
|
| 159 |
+
| **Epochs** | 3 |
|
| 160 |
+
| **Per-device batch size** | 4 |
|
| 161 |
+
| **Gradient accumulation** | 32 (effective batch: 128) |
|
| 162 |
+
| **Learning rate** | 5e-5 |
|
| 163 |
+
| **LR scheduler** | Cosine with 10-step warmup |
|
| 164 |
+
| **Weight decay** | 0.01 |
|
| 165 |
+
| **Precision** | bf16 mixed precision |
|
| 166 |
+
| **Gradient checkpointing** | Enabled |
|
| 167 |
+
| **MLM probability** | 15% |
|
| 168 |
+
| **Max sequence length** | 512 tokens |
|
| 169 |
+
|
| 170 |
+
### Training Infrastructure
|
| 171 |
+
|
| 172 |
+
- **Hardware**: 2× NVIDIA Tesla T4 (15.6 GB VRAM each) on Kaggle
|
| 173 |
+
- **Training time**: ~7 minutes
|
| 174 |
+
- **Framework**: Hugging Face Transformers + Accelerate
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
## Results
|
| 179 |
+
|
| 180 |
+
### Training Metrics
|
| 181 |
+
|
| 182 |
+
| Step | Training Loss |
|
| 183 |
+
|------|---------------|
|
| 184 |
+
| 5 | 1.0149 |
|
| 185 |
+
| 10 | 0.9345 |
|
| 186 |
+
| 15 | 0.8611 |
|
| 187 |
+
| 20 | 0.8364 |
|
| 188 |
+
| **Final** | **0.9089** |
|
| 189 |
+
|
| 190 |
+
Loss decreased **17.4%** from step 5 to step 20, indicating the model is learning custody-specific language patterns. With only 864 examples and 3 epochs, this is a proof-of-concept demonstrating the training pipeline works end-to-end.
|
| 191 |
+
|
| 192 |
+
### Expected Improvements (v0.2)
|
| 193 |
+
|
| 194 |
+
- **10-100x more training data** from CourtListener + GovInfo family law filtering
|
| 195 |
+
- **More epochs** with larger dataset
|
| 196 |
+
- **Downstream task evaluation** on custody classification benchmarks
|
| 197 |
+
- **Comparison** against base ModernBERT and legal-specific models (LegalBERT, SaulLM)
|
| 198 |
+
|
| 199 |
+
---
|
| 200 |
+
|
| 201 |
+
## Intended Use & Limitations
|
| 202 |
+
|
| 203 |
+
### Intended Use
|
| 204 |
+
|
| 205 |
+
- **Legal research augmentation**: Enhanced understanding of custody terminology for RAG pipelines
|
| 206 |
+
- **Document analysis**: Feature extraction for custody case classification systems
|
| 207 |
+
- **Academic research**: Study of judicial reasoning patterns in family law
|
| 208 |
+
- **Legal tech prototyping**: Foundation for custody-aware NLP applications
|
| 209 |
+
|
| 210 |
+
### Limitations
|
| 211 |
|
| 212 |
+
⚠️ **This is v0.1 — a proof-of-concept model.**
|
| 213 |
|
| 214 |
+
- **Small corpus**: 864 training examples is insufficient for robust legal understanding. Production use requires the expanded corpus (v0.2+).
|
| 215 |
+
- **Ohio-specific**: Trained on Ohio case law; may not generalize to other states' custody standards, which vary significantly.
|
| 216 |
+
- **Not legal advice**: This model does not provide legal advice and should not be relied upon for legal decision-making.
|
| 217 |
+
- **MLM only**: Currently trained for masked language modeling. Task-specific fine-tuning (classification, NER, QA) is needed for downstream applications.
|
| 218 |
+
- **Bias**: May reflect biases present in the training data, including historical patterns in judicial decision-making.
|
| 219 |
+
|
| 220 |
+
### Ethical Considerations
|
| 221 |
+
|
| 222 |
+
Family law involves sensitive matters affecting children and families. Any application of this model in production systems should:
|
| 223 |
+
- Include human oversight for all outputs
|
| 224 |
+
- Be transparent about AI involvement
|
| 225 |
+
- Not be used to predict outcomes in active custody proceedings without legal professional review
|
| 226 |
+
- Comply with applicable rules of professional conduct
|
| 227 |
+
|
| 228 |
+
---
|
| 229 |
+
|
| 230 |
+
## Roadmap
|
| 231 |
+
|
| 232 |
+
| Version | Target | Key Changes |
|
| 233 |
+
|---------|--------|-------------|
|
| 234 |
+
| **v0.1** ✅ | Feb 2026 | Proof-of-concept, 864 examples, MLM training pipeline |
|
| 235 |
+
| **v0.2** | Mar 2026 | 10,000+ examples from CourtListener + GovInfo, improved loss |
|
| 236 |
+
| **v0.3** | Apr 2026 | Task fine-tuning: custody outcome classification |
|
| 237 |
+
| **v1.0** | Q2 2026 | Production-ready with evaluation benchmarks |
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
|
| 241 |
## License
|
| 242 |
|
| 243 |
+
Released under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0), consistent with the base ModernBERT model.
|
| 244 |
+
|
| 245 |
+
---
|
| 246 |
|
| 247 |
## Citation
|
| 248 |
|
| 249 |
```bibtex
|
| 250 |
@misc{ohiocustodybert2026,
|
| 251 |
+
title={OhioCustodyBERT: A Domain-Adapted Language Model for Ohio Family Law and Child Custody},
|
| 252 |
+
author={Mullins, Roderick and Phoenix Intelligence LLC},
|
| 253 |
year={2026},
|
| 254 |
publisher={Hugging Face},
|
| 255 |
+
howpublished={\url{https://huggingface.co/Roderick3rd/OhioCustodyBERT}},
|
| 256 |
}
|
| 257 |
```
|
| 258 |
+
|
| 259 |
+
### Base Model Citation
|
| 260 |
+
|
| 261 |
+
```bibtex
|
| 262 |
+
@misc{modernbert,
|
| 263 |
+
title={Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference},
|
| 264 |
+
author={Benjamin Warner and Antoine Chaffin and Benjamin Clavié and Orion Weller and Oskar Hallström and Said Taghadouini and Alexis Gallagher and Raja Biswas and Faisal Ladhak and Tom Aarsen and Nathan Cooper and Griffin Adams and Jeremy Howard and Iacopo Poli},
|
| 265 |
+
year={2024},
|
| 266 |
+
eprint={2412.13663},
|
| 267 |
+
archivePrefix={arXiv},
|
| 268 |
+
primaryClass={cs.CL},
|
| 269 |
+
}
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
---
|
| 273 |
+
|
| 274 |
+
<p align="center">
|
| 275 |
+
<em>Built by <a href="https://github.com/rodneymullins">Phoenix Intelligence LLC</a> • Part of the Antigravity AI Infrastructure</em>
|
| 276 |
+
</p>
|