Instructions to use Hanno-Labs/dinghy-law-8b-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Hanno-Labs/dinghy-law-8b-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Hanno-Labs/dinghy-law-8b-v1") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
dinghy-law-8b
An 8B-parameter multilingual text-embedding model for legal retrieval, adapted from nvidia/Nemotron-3-Embed-8B-BF16 for statute, case-law, contract, and legal-question retrieval. It is intended for first-stage retrieval, reranking, semantic search, and legal RAG over self-hosted corpora.
On MTEB(Law, v1), this model scores 72.58 Mean(Task) nDCG@10. Its leaderboard-snapshot Borda score is 1,898. Both figures come from our leaderboard-faithful reproduction; they are not an official MTEB leaderboard placement.
Results
MTEB(Law, v1)
Per-task nDCG@10 from the full eight-task public-repository validation run:
| Task | Pinned NVIDIA base | dinghy-law-8b |
|---|---|---|
| AILACasedocs | 49.42 | 49.55 |
| AILAStatutes | 58.26 | 62.72 |
| GerDaLIRSmall | 53.69 | 54.71 |
| LeCaRDv2 | 75.45 | 75.94 |
| LegalBenchConsumerContractsQA | 87.68 | 87.54 |
| LegalBenchCorporateLobbying | 96.02 | 96.47 |
| LegalQuAD | 77.18 | 77.14 |
| LegalSummarization | 76.66 | 76.56 |
| Mean(Task) | 71.79 | 72.58 |
Per-task values are rounded to two decimals. The aggregate values were calculated from the unrounded task outputs. Borda is field-dependent; the 1,898 figure uses the MTEB(Law, v1) leaderboard cache captured for the July 31, 2026 evaluation.
Why a different base
This release uses NVIDIA's Nemotron-3 embedding model rather than Qwen/Qwen3-Embedding-8B. In our
base-model testing, the pinned 8B Nemotron model was the stronger legal-retrieval
starting point than the size-matched Qwen/Qwen3-Embedding-8B. The untuned Nemotron base alone produced
the eight task scores reported above and 71.79 Mean(Task) on our frozen evaluation snapshot.
The base is pinned to revision
dd9d06b1852ef836d3dc2fbd2b71a34356912759
so the model origin, configuration, and license are reproducible.
Open data and process
The legal training data and the full adaptation process are open. All training sources are permissively licensed or public-domain legal text, and the released dataset cards retain source-level licensing and attribution:
- legal-retrieval-pairs-v2: German Schleswig-Holstein court decisions and Chinese CAIL cases, released under MIT with source attribution.
- legal-retrieval-pairs-dewiki: German Wikipedia legal articles, retained as a separate CC-BY-SA-4.0 dataset.
- legal-retrieval-pairs-v1: the English, German, Chinese, European, U.S., and public-domain Indian-law retrieval mix.
No non-commercial training source was added for this model. Compilation, curation, and pair construction are © 2026 Clause Logic Inc.; the underlying sources retain their original licenses.
The recipe is fully specified:
- Start from the pinned NVIDIA base and preserve its native
query:andpassage:roles, mask-aware mean pooling, and 4096-dimensional normalized embeddings. - Train on the same public legal-pair mixture with InfoNCE in-batch negatives, an effective batch of 256,
GradCache chunks of 32, 20% public retrieval replay, SIGReg weight 1.0, learning rate
2e-4, and eight 30-step epochs. Training uses a maximum sequence length of 512 tokens. - Average the eight epoch checkpoints into a uniform model soup.
- Sweep WiSE interpolation weights
0, 0.2, 0.3, 0.5, 0.7, 0.85, 1.0against the pinned base. Select by MTEB(Law, v1) Borda on the frozen six-task selection set, then confirm once on all eight tasks. - The selected model is 80% pinned base + 20% uniform soup. No task-specific ensemble or routing is used at inference time.
- Sweep inference caps of 4096, 8192, 16384, and 32768 tokens on the same frozen six-task selection set. The 8192-token cap wins by Borda and is then confirmed on all eight tasks.
The training and evaluation machinery is built with LangSet, released under Apache-2.0. That software license is separate from the model-weight license described below.
Usage
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Hanno-Labs/dinghy-law-8b-v1")
query = "What is the punishment for criminal breach of trust by a public servant?"
documents = [
"Whoever, being in any manner entrusted with property, commits criminal breach of trust ...",
"A contract of sale is a contract whereby the seller transfers property in goods ...",
]
query_embedding = model.encode_query(query)
document_embeddings = model.encode_document(documents)
scores = model.similarity(query_embedding, document_embeddings)
print(scores)
Queries use the query: role and documents use the passage: role. Embeddings are 4096-dimensional and
L2-normalized, so dot product and cosine similarity are equivalent. The published Sentence Transformers
package is configured for inputs up to 8192 tokens.
Evaluation protocol
The reported result uses mteb==2.18.3, the MTEB(Law, v1) task definition, bf16 inference, cosine
similarity, query/document role prefixes, mask-aware mean pooling, and a maximum evaluation length of 8192
tokens. The six-task selection set was frozen before the alpha and context-cap sweeps; the remaining two
tasks were held for the full-suite confirmation. Every task persisted frozen inputs, exact model-facing token tensors, raw
top-1000 scores, per-query metrics, and a content-addressed manifest. The artifacts were downloaded into a
clean environment and their hashes, schemas, row counts, and semantic samples were verified before the
numbers in this card were accepted.
Limitations
- This is a retrieval model, not a generative model. It does not produce legal advice.
- The adaptation is strongest on the English, German, and Chinese legal distributions represented in the released data. Other languages and jurisdictions may be out of distribution even when supported by the multilingual base.
- The model improves the aggregate legal benchmark while making small task-level tradeoffs against the already-strong base, as shown transparently in the results table.
- Borda depends on the comparison field and can change when the leaderboard cache changes.
License and attribution
The model weights and associated model materials are released under the
OpenMDW License Agreement, version 1.1, matching the NVIDIA base. This is
different from the Apache-2.0 license of Qwen/Qwen3-Embedding-8B: the model weights in this repository are
not Apache-2.0.
The model is derived from nvidia/Nemotron-3-Embed-8B-BF16, revision
dd9d06b1852ef836d3dc2fbd2b71a34356912759, © 2026 NVIDIA CORPORATION & AFFILIATES. The repository retains
the OpenMDW-1.1 text and NVIDIA's applicable copyright and origin notices. Hanno Labs / Clause Logic Inc.'s
training data, software, and original contributions retain the separate licenses stated in their
respective repositories; those licenses do not relicense the model weights.
Citation
@misc{dinghy-law-8b,
title = {dinghy-law-8b: an 8B multilingual legal text-embedding model},
author = {Solka, Stephen},
year = {2026},
note = {Hanno Labs / Clause Logic Inc.},
howpublished = {\url{https://huggingface.co/Hanno-Labs/dinghy-law-8b-v1}}
}
References
- Nemotron-3-Embed-8B-BF16 — model card
- OpenMDW-1.1 — license
- WiSE-FT — arXiv:2109.01903
- Model soups — arXiv:2203.05482
- InfoNCE — arXiv:1807.03748
- Dense Passage Retrieval — arXiv:2004.04906
- GradCache — arXiv:2101.06983
- MTEB — arXiv:2210.07316
- Downloads last month
- -
Model tree for Hanno-Labs/dinghy-law-8b-v1
Base model
mistralai/Ministral-3-8B-Base-2512