Turns an informal Hindi-English (Hinglish) planner entry into its type and an exact date and time, on a CPU, in milliseconds. "parso shaam saade 5 baje dentist" written on Saturday 31 October 2026 at 14:00 gives reminder, 2026-11-02, 17:30.
The model is a fine-tuned xlm-roberta-base (278M parameters) with three small heads: it marks the time words (parso, shaam, saade 5 baje), the entry type and the tense. A 250-line deterministic grounder (ground.py, included) does the calendar arithmetic. Kal means tomorrow or yesterday depending only on the tense, which is where many general LLMs fail and this model does not.
Recommended for CPU deployment: int8 ONNX, 278 MB, 17 ms per entry on one 2019 desktop core.
Date and time both correct, on the 706 scored held-out human entries of KalParso (human/test), and on the 262-entry calibration split this checkpoint was chosen on:
| File | Size | Held-out test | Calibration | CPU latency, 1 core |
|---|---|---|---|---|
fp32 ONNX (onnx/model.onnx) |
1.1 GB | 86.4% | 92.98% | 35 ms |
int8 ONNX (onnx/model.int8.onnx) |
278 MB | 85.8% | 92.2% | 17 ms |
Across five training seeds the mean is 85.4 ± 0.6% (the paper's number). This checkpoint is seed 1, picked by calibration score, never by test score. Latency is the median on an Intel Core i7-9700 (2019) capped at 35 W, one thread, end to end including tokenization and grounding.
For comparison on the same test entries: untrained gemma4:26b prompted with the same conventions reaches 89.0% at 10.8 s per entry on all 8 cores of the same CPU; gemma3:27b 82.3%, qwen3:32b 69.8%, llama3.1:8b 52.3%; dateparser 20.8%.
pip install onnxruntime tokenizers numpy huggingface_hub
import sys
from datetime import datetime
from huggingface_hub import snapshot_download
d = snapshot_download("imsg8/kalparso-xlmr", allow_patterns=["*.py", "onnx/*.json", "onnx/model.int8.onnx"])
sys.path.insert(0, d)
from kalparso import KalParso
kp = KalParso(f"{d}/onnx", onnx_file="model.int8.onnx")
kp("parso shaam saade 5 baje dentist", datetime(2026, 10, 31, 14, 0))
# {'type': 'reminder', 'date': '2026-11-02', 'time': '17:30', 'direction': 'future', 'spans': [...]}
kp("kal Rahul se mila tha") # anchor defaults to now; 'kal' + past tense -> yesterday
Output: type (reminder, note or goal), date (YYYY-MM-DD or null), time (HH:MM or null), direction (tense) and the spans the model found.
| File | What |
|---|---|
onnx/model.onnx, onnx/model.int8.onnx |
The model for ONNX Runtime; outputs tags, type, dir |
onnx/tokenizer.json, onnx/meta.json |
Tokenizer and label lists |
kalparso.py, ground.py, lexicon.py |
Runtime and grounder |
model.safetensors, config.json |
PyTorch weights (fp16) for fine-tuning: an AutoModel encoder under enc. plus linear heads tag (13 BIO labels), typ (3) and dir (2) on the first token. The module is Tagger in training/train_encoder.py of the code repository |
Fine-tuned on 29,911 synthetic entries (KalParso v3, template-generated, with character-level spans) plus 3,300 PHINC tweets with weak tense labels from their English translations: AdamW, learning rate 3e-5, batch 32, 3 epochs, linear decay with 6% warm-up, max length 64, one NVIDIA T4. No human test entry is in the training data.
spec.md in the dataset before relying on edge cases.Shivang Gulati and Archana Praveen Kumar, Manipal Institute of Technology, MAHE. Paper under review.
onnx/model.onnx 1.1 GBmodel.safetensors 556 MBonnx/model.int8.onnx 278 MBFacebookAI/xlm-roberta-base