This is a derivative work. All credit for the original model goes to Prithiviraj Damodaran (@prithivida). This repository only provides a quantized ONNX conversion for easier deployment. We do not claim ownership of the model architecture or weights.
Benchmarked on a 50-sentence English grammar correction test set (2-thread CPU, Google Colab).
Quality
Format
BLEU
chrF++
Exact Match
Δ BLEU
Δ chrF++
PyTorch FP32 (baseline)
76.88
86.40
58%
—
—
ONNX INT8 (this repo)
74.44
84.79
54%
-2.44
-1.61
Speed & Size
Metric
PyTorch FP32
ONNX INT8 (this repo)
P50 Latency
602 ms
222 ms
P95 Latency
801 ms
455 ms
Disk Size
850 MB
426 MB
Throughput
—
16.96 sentences/sec
Quantization Stability
Metric
Value
Sentences with changed output (INT8 vs FP32)
6/50 sentences changed
Deployment Scorecard Verdict
NO-GO
Largest T5-base model. INT8 shows moderate quality drop exceeding the -2.0 BLEU threshold. Original model is part of the Gramformer library.
Cross-Model Comparison (7 Models Benchmarked)
This model was benchmarked alongside 6 other grammar correction models. All models were evaluated on the same 50-sentence test set under identical conditions.
chrF++ 86.74, but 3x larger than coedit-small for no significant quality gain
Usage
python
1from optimum.onnxruntime import ORTModelForSeq2SeqLM
2from transformers import AutoTokenizer
34model_id ="YOUR_USERNAME/prithivida-grammar-correcter-onnx-int8"5tokenizer = AutoTokenizer.from_pretrained(model_id)6model = ORTModelForSeq2SeqLM.from_pretrained(model_id)78text ="gec: She go to school yesterday"9inputs = tokenizer([text], return_tensors="pt", max_length=128, truncation=True)10outputs = model.generate(**inputs, max_new_tokens=128, num_beams=1, repetition_penalty=1.3)11corrected = tokenizer.decode(outputs[0], skip_special_tokens=True)12print(corrected)
Input prefix:gec:
Acknowledgments
All credit for the original model goes to Prithiviraj Damodaran (@prithivida). This repository only provides an ONNX INT8 quantized conversion to make the model easier to deploy in production environments (mobile, edge, browser).
Quantization and benchmarking performed as part of the Smart Desktop Keyboard Grammar Engine project.
Citation
If you use this model, please cite the original authors:
@misc{prithivida_onnx_int8,
title = {prithivida/grammar_error_correcter_v1 — ONNX INT8 Quantized},
note = {Quantized version of prithivida/grammar_error_correcter_v1},
url = {https://huggingface.co/prithivida/grammar_error_correcter_v1},
}