Token Classification
Transformers
Safetensors
gec_tagger
feature-extraction
liquid
lfm2
lfm2.5
bidirectional
masked-lm
encoder
grammatical-error-correction
gec
spell-check
gector
custom_code
Instructions to use LiquidAI/LFM2.5-Encoder-350M-Spellchecker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2.5-Encoder-350M-Spellchecker with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="LiquidAI/LFM2.5-Encoder-350M-Spellchecker", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("LiquidAI/LFM2.5-Encoder-350M-Spellchecker", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update spellchecker model card and license
#1
by iamleonie - opened
- README.md +1 -2
- config.json +2 -2
- reranker/README.md +28 -0
- reranker/scorer_config.json +2 -2
README.md
CHANGED
|
@@ -48,8 +48,7 @@ base_model:
|
|
| 48 |
|
| 49 |
# LFM2.5-Encoder-350-Spellchecker
|
| 50 |
|
| 51 |
-
A full fine-tune of [LFM2.5-Encoder-350M](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M) with a subword-level **GECToR-style grammatical-error-correction tagger**.
|
| 52 |
-
It covers grammar, spelling, punctuation, and casing in English.
|
| 53 |
|
| 54 |
Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).
|
| 55 |
|
|
|
|
| 48 |
|
| 49 |
# LFM2.5-Encoder-350-Spellchecker
|
| 50 |
|
| 51 |
+
A full fine-tune of [LFM2.5-Encoder-350M](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M) with a subword-level **GECToR-style grammatical-error-correction tagger** (~357M params). It predicts a per-BPE-piece edit tag and applies edits iteratively (`KEEP / DELETE / REPLACE / APPEND`), covering grammar, spelling, punctuation, and casing across 11 languages. Selected automatically as the best checkpoint by the **MASTER composite** (a weighted aggregate over native, learner, robustness, precision and multilingual evals; leaderboard rank **#1**, source run `en/stage3_ptv2`).
|
|
|
|
| 52 |
|
| 53 |
Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).
|
| 54 |
|
config.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
"AutoConfig": "modeling_gectagger.GecTaggerConfig",
|
| 8 |
"AutoModel": "modeling_gectagger.GecTaggerForGEC"
|
| 9 |
},
|
| 10 |
-
"encoder_name": "LiquidAI/
|
| 11 |
"num_tags": 128802,
|
| 12 |
"hidden_size": 1024,
|
| 13 |
"tie_replace": true,
|
|
@@ -18,4 +18,4 @@
|
|
| 18 |
"qat_group_size": 32,
|
| 19 |
"dropout": 0.1,
|
| 20 |
"torch_dtype": "float16"
|
| 21 |
-
}
|
|
|
|
| 7 |
"AutoConfig": "modeling_gectagger.GecTaggerConfig",
|
| 8 |
"AutoModel": "modeling_gectagger.GecTaggerForGEC"
|
| 9 |
},
|
| 10 |
+
"encoder_name": "LiquidAI/mlm_phase2_bidir2_step140800",
|
| 11 |
"num_tags": 128802,
|
| 12 |
"hidden_size": 1024,
|
| 13 |
"tie_replace": true,
|
|
|
|
| 18 |
"qat_group_size": 32,
|
| 19 |
"dropout": 0.1,
|
| 20 |
"torch_dtype": "float16"
|
| 21 |
+
}
|
reranker/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Edit reranker (EditScorer)
|
| 2 |
+
|
| 3 |
+
Per-edit filter that lets the tagger over-generate (negative `keep_confidence`) and restores
|
| 4 |
+
precision by scoring each proposed edit — Tier 1b of the architecture roadmap. Pairwise scorer:
|
| 5 |
+
encodes the EDITED sentence and the ORIGINAL sentence (same LFM2.5 backbone as the tagger, encoder
|
| 6 |
+
seeded from the shipped checkpoint) and pools both edit spans.
|
| 7 |
+
|
| 8 |
+
**Shipped operating point: `keep_confidence=0.0`, `tau=0.3` -> MASTER composite 0.6587**
|
| 9 |
+
(tagger alone at fixed thresholds: 0.631). fp_clean (clean-text false-flag guard) = 1.0.
|
| 10 |
+
Pooled English M2 at this point: P=0.6636 R=0.3076 (tagger baseline: P=0.544 R=0.269 — the
|
| 11 |
+
reranker buys ~+8pts precision at equal recall).
|
| 12 |
+
|
| 13 |
+
## Usage (with the `spellchecker` repo)
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from spellchecker.predict import GecPredictor
|
| 17 |
+
from spellchecker.reranker import EditScorer, RerankedPredictor
|
| 18 |
+
|
| 19 |
+
base = GecPredictor.from_pretrained("<tagger>", device="cuda",
|
| 20 |
+
keep_confidence=0.0, max_iter=4)
|
| 21 |
+
scorer = EditScorer.load("<this folder>").to("cuda")
|
| 22 |
+
pred = RerankedPredictor(base, scorer, tau=0.3)
|
| 23 |
+
pred.correct(["She go to school every day ."])
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Training: candidates harvested from the tagger's own over-generations on real learner data
|
| 27 |
+
(bea/fce/lang8) + clean anchors, labelled by gold-edit match. See eval report in
|
| 28 |
+
`operating_point.json` and `docs/ARCHITECTURE_ROADMAP.md` (Phase 2) in the training repo.
|
reranker/scorer_config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"encoder_name": "LiquidAI/
|
| 3 |
"hidden_size": 1024,
|
| 4 |
"mode": "cross",
|
| 5 |
"type_feature": true
|
| 6 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"encoder_name": "LiquidAI/mlm_phase2_bidir2_step140800",
|
| 3 |
"hidden_size": 1024,
|
| 4 |
"mode": "cross",
|
| 5 |
"type_feature": true
|
| 6 |
+
}
|