Instructions to use mydeskmate/grammar-v7d with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mydeskmate/grammar-v7d with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("mydeskmate/grammar-v7d") model = AutoModelForSeq2SeqLM.from_pretrained("mydeskmate/grammar-v7d", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Grammar-V7D: Fast, Accurate English Grammar Correction
Grammar-V7D is a production-grade English Grammar Error Correction (GEC) model fine-tuned from T5-base (220M parameters). Built for speed and safety on CPU, it delivers clean corrections without over-editing correct text.
Key Features
- π Fast on CPU: ~95-104ms per sentence with ONNX Runtime (int8)
- π‘οΈ Safe & conservative: Only 2.8% of clean text touched (35x safer than LanguageTool)
- π― Fluency-focused: Achieves 62.73 GLEU on JFLEG, prioritizing natural, readable corrections
- π¦ Production-ready: Exact ONNX graphs used in live serving included
- π Transparent evaluation: All benchmarks measured with official scorers, including failures
Quick Start
Using Transformers
from transformers import T5ForConditionalGeneration, T5Tokenizer
tokenizer = T5Tokenizer.from_pretrained("mydeskmate/grammar-v7d")
model = T5ForConditionalGeneration.from_pretrained("mydeskmate/grammar-v7d")
text = "He go to school yesterday and dont know what to do."
input_text = "gec: " + text
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
outputs = model.generate(**inputs, max_length=512, num_beams=4)
corrected = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(corrected)
Using the Live Demo
Try it instantly at tools.mydeskmate.in/grammar.html
Performance Benchmarks
Pre-registered Promotion Results (GPU, beams=4)
All gates passed as per pre-registered criteria (tested before promotion):
| Metric | Score | Threshold | Status |
|---|---|---|---|
| JFLEG GLEU (Official) | 62.73 | β₯ 62.30 | β PASS |
| CoNLL-2014 F0.5 (m2scorer) | 49.04 | > 47.35 (vs v5) | β PASS |
| BEA-2019-dev F0.5 (ERRANT) | 35.41 | > 33.90 (vs v5) | β PASS |
| Do-No-Harm (Clean text) | 2.80% touched | < 5% | β PASS |
Live Serving Performance (ONNX Runtime int8, CPU)
Measured through production engine with exact serving graphs:
| Metric | Score | Target | Status |
|---|---|---|---|
| JFLEG GLEU (Official) | 62.61 | β₯ 60 | β PASS |
| CoNLL-2014 F0.5 (Official m2scorer) | 49.34 | β₯ 65 | β οΈ Open Target |
| BEA-2019-dev F0.5 (Official ERRANT) | 34.61 | β₯ 70 | β οΈ Open Target |
| Do-No-Harm (500 clean sentences) | 4.20% touched | < 5% | β PASS |
| Over-correction (2000 sentences) | 5.05% touched | < 5% | β οΈ Published as measured (+0.05pp) |
| Latency (Live HTTP, prod) | 95ms / 102ms (median/mean) | < 200ms | β PASS |
| Latency (ORT in-process) | 162ms / 188ms (median/mean) | Reference | β PASS |
Head-to-Head Comparison
All systems evaluated in the same lab using identical official scorers for fair comparison:
| System | JFLEG GLEU β | CoNLL-2014 F0.5 β | BEA-2019-dev F0.5 β | Do-No-Harm β |
|---|---|---|---|---|
| Grammar-V7D (Ours) | 62.73 | 49.04 | 35.41 | 2.80% |
| LanguageTool 6.6 | 47.57 | 25.60 | 20.35 | 98.80% |
| GECToR (bea-dkt+conll, kc=.3) | 53.94 | 56.94 | 49.52 | 10.40% |
We outperform LanguageTool on every metric while being 35x safer. GECToR achieves higher scores on narrow academic benchmarks but over-corrects 10.4% of clean text (failing our safety gate) and scores 8.7 GLEU lower on fluency.
Note: GECToR's published numbers may differ due to different evaluation pipelines/thresholds. We publish all numbers measured on the same yardstick.
Model Details
- Architecture: T5ForConditionalGeneration (T5-base)
- Parameters: ~220M
- Language: English
- Task: Grammatical Error Correction
- Training: Continued from grammar-v7b lineage with ~12% dose of exam-style calibration data
- Precision: FP32 weights included; optimized int8 ONNX graphs available for CPU inference
- Context Length: 512 tokens
- License: Other (research/educational use; check source dataset licenses for commercial use)
Training Data
Trained on research corpora including JFLEG, CoEdit, and WikiText-103 subsets, with carefully calibrated synthetic and exam-style data.
Files
config.json,generation_config.json- Model configurationtokenizer.json,tokenizer_config.json- Tokenizermodel.safetensors- Model weights
Limitations
- Academic benchmarks: CoNLL-2014 (49.34) and BEA-2019 (34.61) remain below some larger models. Focus is on fluency and safety over maximizing exam scores.
- Context: Limited to 512 tokens
- Language: English only
- Conservative by design: May miss some valid corrections to prioritize not breaking correct text
Citation
If you use this model in research, please cite appropriately. For more details or to report issues, visit our live demo.
Links
- Live Demo: tools.mydeskmate.in/grammar.html
- Space: mydeskmate/grammar-checker
- Benchmark Data: mydeskmate/gec-bench
- Downloads last month
- 128