Downloads · 30 days
27
46% of all-time downloads
ajaysdhillon14/minbert-sts-nli-meanpool
minbert-sts-nli-meanpool is a sentence similarity model from ajaysdhillon14. Use it when you need a score for how close two texts are. The card lists the license as apache-2.0.
A bert-base-uncased encoder fine-tuned in two stages for Semantic Textual Similarity (STS-B style regression, labels in [0, 5]):
Downloads · 30 days
27
46% of all-time downloads
All-time downloads
59
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
How the weights are stored.
F32109M · 100%
From the Hugging Face model README
A bert-base-uncased encoder fine-tuned in two stages for Semantic Textual
Similarity (STS-B style regression, labels in [0, 5]):
Scoring. There is no learned similarity head. A sentence is represented by
masked mean pooling over last_hidden_state (including the [CLS]/[SEP]
positions), and the similarity score is the cosine of the two sentence
vectors, rescaled from [-1, 1] to [0, 5]:
score = (cosine_similarity(mean_pool(s1), mean_pool(s2)) + 1) * 2.5
Mean pooling was chosen over the [CLS]/pooler-output representation because it outperformed CLS at every layer in a pooling-strategy sweep on this project's STS dev set.
| Seed | Pearson | Spearman |
|---|---|---|
| 11711 | 0.7432 | 0.7457 |
| 2026 | 0.7436 | 0.7460 |
| 42 | 0.7388 | 0.7411 |
| mean (n=3) | 0.7419 | 0.7443 |
The seed=11711 checkpoint published here (Pearson 0.7432, Spearman 0.7457) is the one submitted for this project; report the 3-seed mean above, not the single-seed number, as the figure the method should be judged on -- std over 3 seeds is a rough sense of spread, not a precise estimate.
This checkpoint stores only the BERT encoder (bert.*); there is no separate
classification head to load. To reproduce the pooling/scoring exactly, use
this project's bert.BertModel and multitask_classifier.masked_mean_pool
(https://github.com/nirish2407/dnlp), or replicate the same masked mean
pooling + cosine recipe with any BERT loader.
See config.json in this repository for the full recorded training recipe
(learning rate, epochs, dropout, warmup, weight decay, and the NLI checkpoint
this model was initialised from), and the STS section of the project README
(https://github.com/nirish2407/dnlp) for the full experimental writeup,
including the ablations that motivated each choice (NLI-pretraining control
run, pooling-strategy sweep, layer-wise readout analysis, and a residualized
probe checking the gains are not just lexical overlap).