You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

AAI PunctCap MN v1 banner

AAI PunctCap MN v1

Restore punctuation and capitalization in Mongolian text.

AAI PunctCap MN v1 predicts punctuation after each word and restores lowercase, initial-uppercase, or all-uppercase casing. It uses a multilingual DistilBERT encoder with two classification heads and is designed as a formatting stage after speech recognition.

Released by Applied AI Mongolia NGO as part of its Mongolian speech research series, the model supports non-commercial research, teaching, and student projects. Its companion speech model is AAI ASR Nano v1.

Private-test macro-F1: 63.32% punctuation and 87.53% capitalization, excluding the neutral labels. These are clean-text restoration metrics, not end-to-end ASR accuracy.

Research release. Free non-commercial research and student/educational use; commercial use requires a separate written license. See License.

Model at a glance

Property Value
Release identifier aai-punctcap-mn-v1
Publisher Applied AI Mongolia NGO
Language / writing system Mongolian / Cyrillic
Encoder Multilingual cased DistilBERT, six layers, hidden size 768
Parameters 134,741,770, approximately 134.74M
Heads Seven punctuation classes; three casing classes
Training context Up to 48 words and 256 subword tokens per window
Weight format Safetensors with a custom two-head PyTorch loader
Release version 1.0.0

The tokenizer vocabulary is an inference artifact. This is not a native NeMo NLP archive or a standard single-head AutoModelForTokenClassification; use the included aai_punctcap.py loader.

Quick start

For private access, use a Hugging Face account with repository access and set HF_TOKEN in your environment.

Install the Hub client with python -m pip install huggingface_hub, then download the repository:

from huggingface_hub import snapshot_download

folder = snapshot_download(
    repo_id="aaimn/aai-punctcap-mn-v1",
    local_dir="aai-punctcap-mn-v1",
)

From the directory containing the downloaded repository, install its dependencies. The examples were tested with Python 3.12.

python -m pip install -r aai-punctcap-mn-v1/requirements.txt

Load the model and restore formatting:

import sys
sys.path.insert(0, "aai-punctcap-mn-v1")
from aai_punctcap import PunctuationModel, restore

model, tokenizer, metadata = PunctuationModel.load(
    "aai-punctcap-mn-v1", device="cpu",  # or "cuda"
)

# Illustrative text.
text = "улаанбаатар хот бол монгол улсын нийслэл юм"
print(restore(text, model, tokenizer))

Or run the CLI:

python aai-punctcap-mn-v1/infer.py "улаанбаатар хотод өнөөдөр бороо орно"

Inputs should be unpunctuated ASR-style text. The restoration helper lowercases the input for prediction, preserves whitespace-separated lexical tokens, and applies casing/punctuation. It does not generate replacement words, translate, or correct recognition errors. Example outputs are predictions and can vary with context; no particular example string is a guaranteed output.

How it works

Each word is tokenized into subwords. The first subword supplies its representation to two linear classifiers over a shared encoder:

Head Labels Meaning
Punctuation O , . ? ! : ; No punctuation, or one mark appended after the word
Casing O U A Lowercase, initial uppercase, or all uppercase

A supports acronym-style casing and extends the common binary lowercase/uppercase formulation. Mixed internal capitalization of product names is outside this label set.

For long text, the helper uses overlapping 48-word windows with a 24-word stride. It keeps the prediction with the most surrounding word context. Input beyond a window's 256-subword limit retains a lexical fallback rather than dropping words. The model predicts punctuation/case only; quotation marks, brackets, and new dash punctuation are not generated by these heads.

Private-test evaluation

The test contains 5,252 text windows / 221,321 supervised words. Validation contains 5,235 windows. Splits were assigned by normalized full-document hash, with global input-window deduplication. Checkpoint selection used validation macro-F1; the test was scored after selection. Near duplicates across distinct documents can remain, so the split is not an independently curated public benchmark.

Headline metrics

Task Metric Result
Punctuation Macro-F1 over six non-neutral marks 63.32%
Capitalization Macro-F1 over U and A 87.53%
Initial uppercase F1 89.08%
All-uppercase / acronyms F1 85.99%

Macro-F1 gives each included class equal weight and excludes neutral O. It is not raw token accuracy, sentence accuracy, or ASR WER. The capitalization O class is lowercase; punctuation O means no inserted punctuation.

Punctuation breakdown

Class Precision Recall F1 Test support
Comma , 64.58% 77.00% 70.25% 11,553
Period . 87.45% 90.06% 88.74% 13,745
Question mark ? 78.22% 86.88% 82.32% 343
Exclamation mark ! 0.00% 0.00% 0.00% 34
Colon : 62.36% 62.82% 62.59% 1,229
Semicolon ; 77.22% 74.91% 76.05% 267

Exclamation marks are a known weakness: F1 is 0.00% on 34 test examples. That class is retained in the six-class macro average; it is not omitted to improve the headline score. Commas and rare punctuation also need domain-specific evaluation.

All results describe restoration from reference text with formatting removed. Recognition errors, missing words, endpointing, and spoken disfluencies can change downstream performance. These private results are not a public leaderboard or an independent reproduction. metrics.json contains aggregate per-class precision/recall/F1/support without examples or dataset identities.

Training recipe

The encoder initializes from multilingual cased DistilBERT and is fine-tuned jointly with the two heads. The recipe uses three epochs, batch size 64, a 256-subword limit, BF16 training, AdamW, 500 warmup steps, cosine learning-rate decay, encoder LR 2e-5, head LR 1e-4, and gradient clipping at 1.0. Only the first subword of each word is supervised; special tokens, padding, and continuation subwords are ignored.

Punctuation uses a mild fourth-root inverse-frequency weighting capped at 4. Capitalization uses unweighted cross-entropy. Selection averages non-neutral punctuation macro-F1 and non-neutral capitalization macro-F1. The released weights are the selected validation checkpoint, not necessarily the final optimizer step.

ASR integration

The ASR model card includes a runnable example using all three models.

A typical pipeline is speech → AAI ASR Nano → optional AAI KenLM decoding → AAI PunctCap formatting. Apply formatting after an utterance is finalized; repeatedly formatting every live partial adds compute and can make punctuation/case flicker. Keep the transcript before formatting alongside the formatted display text when measuring ASR WER or inspecting errors.

The helper preserves the number/order of whitespace-separated words. Existing acoustic word timestamps can therefore remain attached to their corresponding formatted tokens; punctuation itself has no separate acoustic timestamp. Speaker labels require a separate diarization stage.

Intended use and limitations

The model is suitable for Mongolian text-restoration experiments, student ASR projects, educational transcription tools, and research into casing/punctuation. It can run on CPU or CUDA; latency and memory depend on context length, batching, and hardware.

  • Rare punctuation, acronyms, uncommon names, heavy code switching, and text unlike the training style may be unreliable.
  • Existing punctuation is not parsed as a separate editing task; supply unpunctuated text for the intended use.
  • Number verbalization, inverse text normalization, spelling correction, and mixed-case brand-name recovery are separate tasks.
  • Long-context fallback preserves words but does not guarantee all words receive a confident formatting decision.
  • End-to-end ASR quality should be measured independently rather than inferred from clean-text F1.

Release files

model.safetensors contains the shared encoder and both heads. joint_config.json supplies architecture and label metadata with private training metadata removed. tokenizer.json, tokenizer_config.json, special_tokens_map.json, and vocab.txt provide the tokenizer. aai_punctcap.py and infer.py provide the loader and CLI. Metrics, notices, and SHA256SUMS document the exact release. No optimizer state, text dataset, or private sample is bundled.

AAI Mongolian speech family

Release Role
AAI ASR Nano v1 Mongolian speech → normalized text
AAI KenLM MN 4-gram v1 Word-level CTC beam rescoring
AAI PunctCap MN v1 Punctuation, capitalization, and acronym casing

License and commercial use

Free for non-commercial research, teaching, academic study, and student projects. Commercial use requires a separate written license from Applied AI Mongolia NGO. Read LICENSE.md for the complete AAI Research and Education License 1.0, including redistribution and attribution requirements. Request commercial licensing through this repository's Discussions tab; no commercial permission is implied by downloading the files.

This is a research release with downloadable weights under the AAI Research and Education License 1.0. Upstream components retain their original licenses and independent permissions; see Third-party notices.

Third-party notices

AAI's custom license covers only rights in AAI's own contributions and adaptations. It does not relicense or restrict independently licensed third-party materials. Dependencies are installed separately and retain their original terms.

The Apache-2.0 text is provided under licenses/APACHE-2.0.txt. The KenLM LGPL-2.1 text is provided under licenses/KENLM-LGPL-2.1.txt. Dependencies not used by a particular repository need not be installed.

Encoder initialization

The encoder adapts distilbert/distilbert-base-multilingual-cased, revision 45c032ab32cc946ad88a166f7cb282f58c753c2e: https://huggingface.co/distilbert/distilbert-base-multilingual-cased . The upstream checkpoint is Apache-2.0. AAI fine-tuned the encoder for Mongolian formatting and added separate punctuation and casing heads, loaders, and release documentation. Preserve the upstream license and attribution when redistributing this adaptation.

Attribution and citation

The encoder adapts distilbert/distilbert-base-multilingual-cased under Apache-2.0. AAI fine-tuned the encoder and added the two task heads and release helpers. Upstream permissions and attribution remain intact; see Third-party notices.

@misc{aai2026punctcap,
  author = {Applied AI Mongolia NGO},
  title = {AAI PunctCap MN v1},
  year = {2026},
  url = {https://huggingface.co/aaimn/aai-punctcap-mn-v1}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for aaimn/aai-punctcap-mn-v1

Finetuned
(460)
this model

Collection including aaimn/aai-punctcap-mn-v1