[Voyage AI](/ai-gateway/models/labs/voyage)

# Voyage Law 2

Voyage Law 2 is Voyage AI's legal-specialized embedding model trained on one trillion legal tokens. It outperforms OpenAI text-embedding-3-large by 6% across eight legal datasets and achieves 84.44 NDCG@10 on long-context legal retrieval versus 68.40 for OpenAI. Your use is subject to Voyage AI's [Terms](https://www.voyageai.com/tos) & [Privacy](https://www.voyageai.com/privacy) Policies.

[Use with AI Gateway](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Futm_source%3Dgateway-model-page%26utm_campaign%3Dai-gateway-models&title=Get+Started+with+Vercel+AI+Gateway) [View docs](https://vercel.com/docs/ai-gateway)

```
1import { embed } from 'ai';
2

3const result = await embed({
4  model: 'voyage/voyage-law-2',
5  value: 'Sunny day at the beach',
6})
```

[Read docs](https://vercel.com/docs/ai-gateway/sdks-and-apis/ai-sdk)

[Overview](/ai-gateway/models/voyage-law-2) [About](/ai-gateway/models/voyage-law-2/about) [Providers](/ai-gateway/models/voyage-law-2/providers) [Similar](/ai-gateway/models/voyage-law-2/similar) [FAQ](/ai-gateway/models/voyage-law-2/faq)

## [Copy link to heading](#about-voyage-law-2)About Voyage Law 2

Voyage Law 2 is Voyage AI's legal-specialized embedding model, released April 15, 2024. Voyage AI trained it on one trillion high-quality legal tokens using specifically designed positive pairs and a contrastive learning algorithm. The model handles diverse legal content including contracts, congressional bills, court cases, and statutes across multiple jurisdictions: U.S., Chinese, German, and Indian.

Across eight legal retrieval datasets, Voyage Law 2 outperforms OpenAI text-embedding-3-large by 6% on average, with improvements exceeding 10% on LeCaRDv2, LegalQuAD, and GerDaLIR. On long-context legal retrieval, Voyage Law 2 achieves 84.44 NDCG@10 compared to 68.40 for OpenAI. That's a 23% relative improvement reflecting the model's strength on lengthy legal documents.

Voyage AI intentionally mixed legal training data with finance, technology, and intellectual property domains. This ensures Voyage Law 2 performs well on non-legal retrieval tasks while maintaining its legal specialization. Teams with mixed legal and business content don't need a separate general-purpose model for non-legal documents in the same index.