---
title: mia-punctuation-en-140m
canonical_url: "https://www.modelscope.cn/models/leafiy2/mia-punctuation-en-140m"
md_url: "https://www.modelscope.cn/models/leafiy2/mia-punctuation-en-140m.md"
repository: leafiy2/mia-punctuation-en-140m
chinese_name: "Mia 英文标点纠错"
last_updated: 2026-11-27
license: apache-2.0
pipeline_tag: token-classification
tasks:
  - token-classification
base_model:
  - Horizon-Labs/punctuation-restoration-small
base_model_relation: finetune
parameters: 140.6M
tensor_type:
  - F32
library_name:
  - safetensors
  - pytorch
frameworks:
  - pytorch
language:
  - en
domain:
  - nlp
downloads: 10
stars: 0
tags:
  - punctuation
  - punctuation-correction
  - punctuation-restoration
  - grammar-correction
  - proofreading
  - capitalization
  - truecasing
  - comma-splice
  - english
  - modernbert
  - mmbert
  - token-classification
  - mia
  - "英文标点纠错"
  - "标点纠错"
---

# mia-punctuation-en-140m

> mia-punctuation-en-140m - leafiy2 在 ModelScope 开源的模型。Mia English Punctuation Corrector · mia-punctuation-en-140m

leafiy2/mia-punctuation-en-140m 是 ModelScope 魔搭社区上的 140.6M 参数token-classification模型，采用 apache-2.0 许可，基于 Horizon-Labs/punctuation-restoration-small 构建。

- **Repository**: leafiy2/mia-punctuation-en-140m
- **License**: apache-2.0
- **Tasks**: token-classification
- **Parameters**: 140.6M
- **Base model**: Horizon-Labs/punctuation-restoration-small
- **Tags**: punctuation, punctuation-correction, punctuation-restoration, grammar-correction, proofreading, capitalization, truecasing, comma-splice, english, modernbert, mmbert, token-classification, mia, 英文标点纠错, 标点纠错
- **Downloads**: 10
- **Stars**: 0
- **Last updated**: 2026-11-27

Source: https://www.modelscope.cn/models/leafiy2/mia-punctuation-en-140m

---

# Mia English Punctuation Corrector · mia-punctuation-en-140m

**Fixes the commas, sentence breaks, capital letters, apostrophes and hyphens of English text that already has punctuation. On native-speaker essays it is more precise than a 27B LLM prompted for the same job and makes a fifth of its false edits on clean text. It runs about 15 times as fast as the LLM, on a CPU, and it never changes a word.**

[GitHub](https://github.com/leafiy/mia) · [Hugging Face](https://huggingface.co/leafiy/mia-punctuation-en-140m) · [ModelScope](https://modelscope.cn/models/leafiy2/mia-punctuation-en-140m) · [中文说明](#中文说明)

| Before | After |
| --- | --- |
| However the results were clear, the new policy worked | However, the results were clear. The new policy worked. |
| tourism brings money to the region, it also puts pressure on housing and transport | Tourism brings money to the region. It also puts pressure on housing and transport. |
| The well known market closes at six , on sundays it doesnt open at all | The well-known market closes at six. On Sundays it doesn't open at all. |
| In 2019 the city opened a new riverside park which quickly became popular with families | In 2019, the city opened a new riverside park, which quickly became popular with families. |
| If you have any questions about the survey please contact our office | If you have any questions about the survey, please contact our office. |
| When I arrived at the station the train had already left so I took a taxi home | When I arrived at the station the train had already left, so I took a taxi home. |

Every row is the model's actual output.

## Why Mia

- **Beats a 27B LLM on its own job.** On native-speaker essays, 71% of Mia's edits are exactly the annotator's correction. A 27B instruction-tuned LLM given the same task gets 47%. On clean Wikipedia text the LLM makes 4.6 times as many false edits.
- **The most precise system we tested on native-speaker writing**, ahead of Grammarly's GECToR-2024 (RoBERTa-large), LanguageTool, and the most downloaded punctuation models on Hugging Face.
- **It cannot rewrite your text.** The model only labels the gap after each word and the first letter of each word, so every word comes back exactly as written. The 27B LLM changed words in 7% of the paragraphs it was given.
- **Fast on a plain CPU.** About 3,000 words a second on 4 threads and 4,300 on 8, one paragraph per call. A 100,000-word book takes about half a minute. The 27B LLM managed about 200 words a second on a GPU cluster.
- **Small.** 140M parameters, 563 MB, no GPU needed.
- **Clean license.** Apache-2.0. Trained only on openly licensed English text (Wikipedia, FineWeb, FineWeb-Edu), with no learner corpora and no non-commercial data, so it can go into commercial products.

## What it fixes

- **Missing commas**: after an opening phrase or clause (*However,* / *In 2019,* / *If you have questions,*), before a clause joined by *but*, *so*, *which*, and in lists.
- **Comma splices and run-on sentences**, split into sentences with the next word capitalized.
- **Missing end marks**: periods at the end of a paragraph, question marks.
- **Capital letters**: sentence starts, *I*, and names written in lowercase (*july* → *July*, *sundays* → *Sundays*); stray capitals in mid-sentence go back to lowercase.
- **Apostrophes** in contractions that are not words without them (*dont*, *doesnt*, *isnt*, *im*, *youre*, *theres*).
- **Hyphens** in compound modifiers (*well known market* → *well-known market*).
- **Spacing and typing slips**: spaces before marks, missing spaces after them, doubled marks, full-width marks (，。) in English text.

It is built for precision. Where a comma is optional, or a mark sits next to quotation marks or brackets, it leaves the text as the writer had it.

## Benchmarks

| System | Params | Native-speaker essays<br>precision / recall | Learner essays<br>precision / recall | Clean Wikipedia<br>false edits per 1,000 words | Wikipedia with errors<br>precision / recall | Speed<br>words / s |
| --- | ---: | :---: | :---: | ---: | :---: | ---: |
| **mia-punctuation-en-140m** | 140M | **0.71** / 0.28 | 0.75 / 0.41 | **1.2** | **0.89** / **0.79** | **≈3,000** (4 CPU threads) |
| Qwen3.8-27B, prompted | 27B | 0.47 / 0.45 | – | 5.5 | 0.81 / 0.78 | ≈200 (GPU cluster) |
| GECToR-2024, RoBERTa-large, int8 ¹ | 355M | 0.69 / 0.46 | 0.81 / 0.58 | 2.7 | 0.88 / 0.69 | ≈1,600 (4 CPU threads) |
| [oliverguhr/fullstop-punctuation-multilang-large](https://huggingface.co/oliverguhr/fullstop-punctuation-multilang-large) ² | 560M | 0.40 / 0.26 | 0.68 / 0.41 | 8.7 | 0.69 / 0.68 | |
| [Horizon-Labs/punctuation-restoration-small](https://huggingface.co/Horizon-Labs/punctuation-restoration-small) ², our base before training | 140M | 0.43 / 0.05 | 0.77 / 0.22 | 1.0 | 0.92 / 0.56 | |
| LanguageTool 6.6 | rules | 0.47 / 0.11 | 0.58 / 0.27 | 1.7 | 0.78 / 0.20 | ≈2,500 |

- **Native-speaker and learner essays**: the BEA-2019 W&I+LOCNESS development set (LOCNESS: 261 paragraphs written by native speakers, 467 corrections; W&I: 1,132 paragraphs by learners, 1,884 corrections). Every correction that changes a word was applied to the input first, so what is left to fix is punctuation, capitalization, apostrophes and spacing. An edit counts only if it is the annotator's correction at the same place.
- **Clean Wikipedia**: 120 paragraphs (10,687 words) of three Wikipedia articles, untouched, so every change is a false edit. **Wikipedia with errors**: 120 other paragraphs of the same articles with 296 punctuation and capitalization errors put in. These articles were kept out of Mia's training data.
- ¹ Grammarly's GECToR-2024 (BEA 2024, *Pillars of Grammatical Error Correction*) was trained on cLang-8, the W&I training split and other data, and its weights come without a license. Shown for reference; only its punctuation and capitalization edits are counted.
- ² Punctuation-restoration models are trained to punctuate text that has none. Here they correct text by changing a mark only when they disagree with it strongly, with the thresholds tuned on the learner essays. The restoration models and GECToR also go through the same rules Mia uses.
- Mia uses no threshold: it takes the label the model finds most likely.

## Quick start

```bash
pip install torch "transformers>=5" modelscope
modelscope download --model leafiy2/mia-punctuation-en-140m --local_dir mia-punctuation-en-140m
# or: hf download leafiy/mia-punctuation-en-140m --local-dir mia-punctuation-en-140m
(cd mia-punctuation-en-140m && sha256sum -c final.sha256)
```

```python
import sys
sys.path.insert(0, "mia-punctuation-en-140m")
from mia_punctuation import Corrector

correct = Corrector("mia-punctuation-en-140m/final")      # device="cuda" works too
print(correct("However the results were clear, the new policy worked"))
# However, the results were clear. The new policy worked.
```

From the command line, one paragraph per line:

```bash
python mia-punctuation-en-140m/mia_punctuation.py mia-punctuation-en-140m/final < draft.txt > fixed.txt
```

`mia_punctuation.py` holds the whole corrector: the rules, the tagger and how the two are put together. Give it a paragraph at a time; a long paragraph is read in overlapping windows of 400 tokens.

## How it works

1. **Rules** fix what a rule can fix without guessing: spaces around marks, doubled marks, full-width marks, a capital after a sentence end, *I*, and contractions missing their apostrophe.
2. **The tagger** reads the text with its punctuation as it is and predicts, for every word, the mark that should follow it (none, `,` `.` `?` `!` `:` `;`, or a hyphen joining it to the next word) and whether its first letter should be capitalized, lowercased or kept. It changes only gaps that hold nothing but one of those marks and spaces.
3. **The rules again**, for the capitals and spaces the changes call for. When the tagger capitalizes a word that is not after a sentence end, the corrector starts a new sentence there if the tagger also gave a sentence end in that gap at least a 25% chance; otherwise it treats the word as a name.

## Model details

| | |
| --- | --- |
| Base | [Horizon-Labs/punctuation-restoration-small](https://huggingface.co/Horizon-Labs/punctuation-restoration-small) (Apache-2.0), an mmBERT-small encoder (ModernBERT architecture) |
| Head | one linear layer with 11 outputs: 8 for the gap after the word, 3 for the word's first letter |
| Training data | 1.97 million paragraphs from English Wikipedia (20231101.en), FineWeb-Edu and FineWeb (sample-10BT), with punctuation and capitalization errors put in by rule: commas left out (more often after opening phrases, before conjunctions and around linking words), comma splices, run-on sentences, missing end marks, question marks written as periods, semicolons written as commas, hyphens left out of compounds, names in lowercase, stray capitals. 6% of the paragraphs were left clean. |
| Training | two stages of one epoch each on an RTX 4090, about 15 minutes each: first with fewer errors (lr 5e-5), then on a fresh set with more of the errors writers actually make (lr 3e-5); AdamW, bf16, 24,000 tokens per batch |
| Weights | fp32, 563 MB |
| Speed | about 3,000 words / s on 4 CPU threads, 4,300 on 8 |
| Requires | `torch`, `transformers>=5` |
| License | Apache-2.0 (see `NOTICE`) |

## Good to know

- English only.
- It does not decide between words that are both correct, such as *its* and *it's*, and it does not touch punctuation next to quotation marks or brackets.
- It fixes punctuation, not grammar or spelling, and it never adds, drops or replaces a word.

## The Mia family

| Model | What it does | Download |
| --- | --- | --- |
| `mia-punctuation-en-140m` | English punctuation correction | [Hugging Face](https://huggingface.co/leafiy/mia-punctuation-en-140m) · [ModelScope](https://modelscope.cn/models/leafiy2/mia-punctuation-en-140m) |
| `mia-decider-2b` | Chinese sentiment analysis: positive / negative / neutral | [Hugging Face](https://huggingface.co/leafiy/mia-decider-2b) · [ModelScope](https://modelscope.cn/models/leafiy2/mia-decider-2b) |
| `mia-qwen3.5-2b` | Chinese sentiment analysis, loads with transformers alone | [Hugging Face](https://huggingface.co/leafiy/mia-qwen3.5-2b) · [ModelScope](https://modelscope.cn/models/leafiy2/mia-qwen3.5-2b) |
| `mia-laya` | Chinese sentiment analysis, lightweight, almost 2,000 texts / s | [Hugging Face](https://huggingface.co/leafiy/mia-laya) · [ModelScope](https://modelscope.cn/models/leafiy2/mia-laya) |
| `mia-vad-2b` | Chinese multi-dimensional emotion: valence, arousal, dominance, seven emotions, intensity | [ModelScope](https://modelscope.cn/models/leafiy2/mia-vad-2b) |
| `mia-evidence-2b` | Chinese sentiment evidence extraction | [ModelScope](https://modelscope.cn/models/leafiy2/mia-evidence-2b) |
| `mia-keyphrase-2b` | Chinese keyphrase extraction | [ModelScope](https://modelscope.cn/models/leafiy2/mia-keyphrase-2b) |

## 中文说明

**Mia 英文标点纠错**：给已经有标点的英文改标点，包括逗号、断句与句末标点、大小写、缩写里的撇号和复合词的连字符，一个词都不改。

- **比 27B 大模型改得准。** 母语作者写的作文上，Mia 改的地方有 71% 和人工标注的改法一字不差，同样任务的 27B 指令模型是 47%；在没有错的维基百科原文上，大模型乱改的地方是 Mia 的 4.6 倍。
- **在母语作文上是测过的所有系统里最准的**，包括 Grammarly 的 GECToR-2024、LanguageTool 和 Hugging Face 上下载最多的标点模型。
- **只用 CPU，快。** 4 个线程每秒约 3,000 词，8 个线程约 4,300 词，十万词的书半分钟改完，是 27B 大模型在显卡集群上的 15 倍左右。
- **结构上就改不了词。** 模型只给每个词后面的间隙和每个词的首字母打标签，原文每个词原样保留。
- **许可干净。** Apache-2.0，只用维基百科、FineWeb、FineWeb-Edu 这类公开授权的英文语料训练，可以放进商业产品。

用法见上面的 [Quick start](#quick-start)，国内用 ModelScope 下载。

## Citation

```bibtex
@misc{mia2026,
  title  = {Mia: Chinese Sentiment Analysis Models},
  author = {leafiy},
  year   = {2026},
  url    = {https://github.com/leafiy/mia}
}
```

## License

Apache-2.0. mia-punctuation-en-140m is fine-tuned from Horizon-Labs/punctuation-restoration-small (Apache-2.0), itself fine-tuned from jhu-clsp/mmBERT-small (MIT); their notices are in `NOTICE`. Training text: English Wikipedia (CC BY-SA 4.0), FineWeb and FineWeb-Edu (ODC-By 1.0).
