AILACasedocs
0,4619
Один прогон
Направление метрики неизвестно, сравнение не строится
Составлено на русском по карточке модели и метаданным Hugging Face
Дообученная на юридических текстах модель Qwen3 для семантического поиска и сопоставления законов, судебных решений и договоров.
dinghy-law-4b-v1 — модель плотных текстовых эмбеддингов от Hanno Labs, дообученная на базе Qwen/Qwen3-Embedding-4B для поиска по юридическим корпусам. Она предназначена для извлечения релевантных законов, судебных решений и договорных фрагментов, а также для сопоставления, кластеризации и дедупликации юридических текстов. Модель содержит около 3,7 млрд параметров, использует архитектуру Qwen3 и выдаёт вектор размерности 2560. Для запросов поддерживается инструкция задачи; документы кодируются без неё. По умолчанию модель обрабатывает до 8192 токенов, а настройка позволяет использовать контекст базовой модели до 40960 токенов.
Модель оптимизирована для англоязычных, немецкоязычных и китайскоязычных юридических текстов. В собственной оценке разработчика на MTEB(Law, v1) она получила 71,24 по Mean(Task) nDCG@10; это результат измерения автора, а не официальное место в таблице лидеров. Модель подходит для первого этапа поиска и ранжирования в юридических RAG-системах, включая локальные и изолированные развёртывания. Она формирует эмбеддинги, но не генерирует ответы и не предоставляет юридические консультации. Лицензия — Apache-2.0.
Оптимизирована для юридических текстов на английском, немецком и китайском языках; другие языки и юрисдикции находятся вне обучающего распределения. На отдельных задачах поиска немецких статутов и китайских прецедентов модель уступает лидирующим системам; она создаёт эмбеддинги и не генерирует юридические ответы.
Результаты из открытых лидербордов в сравнении с лидерами каталога на 2 декабря 2026
0,4619
Один прогон
Направление метрики неизвестно, сравнение не строится
0,7856
Один прогон
Направление метрики неизвестно, сравнение не строится
0,4691
Один прогон
Направление метрики неизвестно, сравнение не строится
0,762
Один прогон
Направление метрики неизвестно, сравнение не строится
0,8547
Один прогон
Направление метрики неизвестно, сравнение не строится
0,9539
Один прогон
Направление метрики неизвестно, сравнение не строится
Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста
Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.
Напишите запросы, при необходимости приложите файлы и эталонные ответы.
Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.
Разделы каталога профессий, в задачах которых используется эта модель
README от автора на Hugging Face, как он его опубликовал
A 4B-parameter text-embedding model for legal retrieval, fine-tuned from Qwen/Qwen3-Embedding-4B for statute, case-law, and contract text. It is intended for retrieval, reranking, and semantic search over legal corpora, and is the larger sibling of dinghy-law-0.6b.
On MTEB(Law, v1) it scores 71.24 by Mean(Task) nDCG@10. In our reproduction of the benchmark it is the highest-scoring model we measured, edging a 7.6B legal fine-tune and every commercial legal embedding API on the benchmark, at roughly half the parameter count of the next-best model. These are our own measurements against published scores, not an official leaderboard placement (see Evaluation protocol), and Mean(Task) is one view of the benchmark — the MTEB leaderboard also ranks by a rank-aggregation (Borda) that requires the full field of models.
Mean nDCG@10 (Mean(Task)) over the eight MTEB(Law) tasks. This model is measured with a leaderboard-faithful harness (see Evaluation protocol); scores for the other models are their published MTEB(Law) results. The ordering below reflects those numbers, not an official leaderboard submission.
| Rank | Model | Params | Mean(Task) |
|---|---|---|---|
| 1 | dinghy-law-4b (this model) | 4.03B | 71.24 |
| 2 | Mira190/Euler-Legal-Embedding-V1 | 7.57B | 70.37 |
| 3 | voyageai/voyage-law-2 (commercial) | — | 65.39 |
| 4 | codefuse-ai/F2LLM-v2-14B | 13.99B | 64.66 |
| 5 | voyageai/voyage-3 (commercial) | — | 64.13 |
| 6 | infly/inf-retriever-v1 | 7.07B | 63.68 |
| 7 | codefuse-ai/F2LLM-v2-8B | 7.57B | 63.54 |
Per-task nDCG@10 in this evaluation:
| Task | Score |
|---|---|
| LegalQuAD | 73.96 |
| GerDaLIRSmall | 46.91 |
| AILAStatutes | 78.56 |
| AILACasedocs | 46.19 |
| LeCaRDv2 | 76.20 |
| LegalBenchConsumerContractsQA | 85.56 |
| LegalBenchCorporateLobbying | 95.39 |
| LegalSummarization | 67.11 |
Qwen3-Embedding-4B. The untuned base already scores near the top of the
benchmark; the adaptation described below adds legal specificity — most visibly on case-to-case precedent
retrieval — without disturbing the base's general strength.Top-of-benchmark legal retrieval has generally meant a 7–14B model or a commercial API. dinghy-law-4b
reaches the top of the legal benchmark in our measurements at 4B parameters — smaller than the models it
surpasses — which lowers the hardware cost of competitive legal-domain retrieval for self-hosted,
on-premise, and air-gapped deployments. Where 4B is still too large, the
0.6b sibling runs on a commodity CPU.
Typical uses: first-stage retrieval and reranking for legal RAG, statute and precedent search, clause and contract matching, and clustering or deduplication of legal text. It produces a single dense vector per input; it is a retrieval model, not a generative model, and does not produce legal advice.
The model is a contrastive fine-tune of Qwen3-Embedding-4B, specialized for legal retrieval and then merged back toward the base to preserve general capability.
A strong instruction-following base. Qwen3-Embedding-4B is an LLM-derived embedding model that already accepts a task instruction on the query side [Qwen3-Embedding, 2506.05176]. Untuned it already ranks near the top of the legal benchmark, so the adaptation only has to add legal specificity, not general retrieval competence.
Contrastive domain fine-tuning with large-batch in-batch negatives. The model is fine-tuned with an InfoNCE objective [1807.03748] and in-batch negatives [DPR, 2004.04906] on query→passage pairs from public legal corpora. A large effective batch — the source of the negatives — is held in memory with gradient caching [GradCache, 2101.06983], which decouples the negative count from GPU memory and sharpens the contrastive signal at 4B scale.
Instruction conditioning. Queries carry a task-specific instruction, matching the base model's native interface and the instruction-tuned-embedding line of work [INSTRUCTOR, 2212.09741]. The document side is encoded without an instruction.
Case-to-case precedent pairs. Precedent retrieval (finding relevant cases for a case, as in LeCaRDv2 and GerDaLIR) has a different shape from question→passage retrieval, and question-answering-shaped pairs actively hurt it. Positives for these tasks are built as case→most-similar-same-category case pairs, using nearest-neighbor pairing within a shared legal category, which matches the precedent-retrieval objective and lifts case-to-case tasks without cost elsewhere.
Multilingual legal coverage. Beyond the English and Indian-statute mix of the 0.6b lineage, the training data adds German case law and legal reference text (Schleswig-Holstein court decisions; German Wikipedia legal articles) and Chinese criminal-case text, broadening the encoder's legal register across its three languages.
Uniform soup and weight-space merge-back. Eight epoch checkpoints are averaged into a single model [Model Soups, 2203.05482], then interpolated back toward the base, θ = (1 − α)·θ_base + α·θ_finetuned, at α = 0.6 [WiSE-FT, 2109.01903]. The soup averages diverse epochs, and the merge recovers general retrieval capability in weight space — in a single step, with no retraining — while keeping the legal gains.
The specialization uses standard contrastive methods; the case-to-case pairing and the soup plus merge-back are what let the model add precedent-retrieval and multilingual legal strength while keeping the base's general retrieval competence.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Hanno-Labs/dinghy-law-4b-v1")
query = "What is the punishment for criminal breach of trust by a public servant?"
docs = [
"Whoever, being in any manner entrusted with property ... commits criminal breach of trust ...",
"A contract of sale is a contract whereby the seller transfers ... the property in goods ...",
]
# The query-side instruction is applied to queries and omitted from documents.
q_emb = model.encode_query(query)
d_emb = model.encode_document(docs)
scores = model.similarity(q_emb, d_emb) # cosine
print(scores)
The query-side instruction is stored in the model config (prompts), so encode_query applies it and
encode_document omits it. For MTEB(Law) and other retrieval tasks, a task-specific instruction can be
passed on the query side (documents are always embedded raw); the leaderboard-faithful per-task instructions
are documented in our MTEB submission. The model emits 2560-dimensional embeddings, uses cosine similarity,
and encodes sequences up to 8192 tokens by default (extensible to the base model's 32k context via
model.max_seq_length).
Loading and serving. These results, and the exact embeddings, come from loading the model through
sentence-transformers, which applies the model's final projection head. Runtimes that pool and normalize
without a post-pooling projection — vLLM, Text Embeddings Inference, and GGUF/llama.cpp — omit that head;
their embeddings agree with the reference to about 0.997 cosine (a small retrieval difference on MTEB(Law)).
A GGUF/llama.cpp build is published at
dinghy-law-4b-v1-gguf.
All training sources are permissively licensed or public-domain legal text; each retains its original license. The training data is released as three datasets — legal-retrieval-pairs-v2 (MIT: German Schleswig-Holstein court decisions and Chinese CAIL cases), legal-retrieval-pairs-dewiki (German Wikipedia legal articles, CC-BY-SA-4.0, used with attribution and kept as a separate share-alike dataset), and the 0.6b-lineage legal-retrieval-pairs-v1 — whose cards carry per-source license and attribution tables. Public-domain and CC-BY-4.0 material is used with attribution; no CC-BY-NC (non-commercial) sources are used. Compilation, curation, and pair construction are © 2026 Clause Logic Inc.
This model's MTEB(Law) number is produced with a leaderboard-faithful harness: query-side instruction only,
raw documents, EOS token appended, max sequence length 8192, bf16, cosine similarity — matching the recipe
the MTEB leaderboard uses for instruction embedders, and run through the same mteb library and
InstructSentenceTransformerModel loader a leaderboard reviewer uses. The exported model reproduces the
training-time evaluation geometry to 0.9999 cosine, and the number above is the mteb library's own
Mean(Task). Scores quoted for other models are their published MTEB(Law) results; comparing our harness
measurement against those published numbers is a reproduction, not an official leaderboard submission.
Released under Apache-2.0. Copyright © 2026 Clause Logic Inc. The base model, Qwen3-Embedding-4B, is licensed by its authors under Apache-2.0; this fine-tune does not relicense it.
@misc{dinghy-law-4b,
title = {dinghy-law-4b: a 4B legal text-embedding model},
author = {Solka, Stephen},
year = {2026},
note = {Hanno Labs / Clause Logic Inc.},
howpublished = {\url{https://huggingface.co/Hanno-Labs/dinghy-law-4b-v1}}
}
На своей GPU в ailist. Цена — по текущим предложениям провайдеров
GPU в ailist
Универсальный рантайм · sentence-transformers
Подбираем GPU…