DuckerTime-Normalize-Thai (WangchanBERTa Temporal Entity Slicer)

Fine-tuned wangchanberta-base-att-spm-uncased for token-level temporal boundary extraction (B-TIME, I-TIME, O) across colloquial Thai sentences, conversational chat slang, and compound date-time structures.

Paired Dataset: DuckerMaster/Thai-Natural-DateTime-Dataset

Designed as the neural frontend for the End-to-End Hybrid Architecture:

  1. WangchanBERTa Frontend: Extracts precise character and token spans from raw unstructured text.
  2. Deterministic Rule Engine Backend: Parses the extracted temporal span into valid ISO-8601 points and ranges in sub-millisecond execution.

Model Performance & Empirical Benchmark

Empirical Benchmark Comparison

Evaluated against disjoint stratified benchmarks and tested side-by-side with rule baselines and instruction-tuned LLMs on NVIDIA T4 hardware.

Benchmark Summary (Batch Size = 1, Streaming Latency)

System / Model Architecture Parameter Size Hardware Execution OOD Accuracy / F1 Mean Latency (ms) Production SLA (<50ms)
dateparser (Heuristic Multilingual) 0 CPU 6.0% 12.4 ms Pass
PyThaiNLP (Rule Parser) 0 CPU 18.7% 1.8 ms Pass
Qwen2.5-3B-Instruct (4-bit NF4) 3B GPU (T4) 3.3% 383.3 ms Fail (Over 7x threshold)
Typhoon 30B (Cloud REST API) 30B Cloud Server 47.3% 2,753.9 ms Fail (Over 55x threshold)
Our Hybrid System (WangchanBERTa + Rule) 106M GPU (T4) 96.9% 10.2 ms Pass (Optimal Frontier)

Architectural Insights

  • Why Pure LLMs Fail on Strict Temporal Extraction: Generative LLMs are prone to conversational framing (e.g. outputting conversational preambles or rephrasing targets) rather than returning strict token spans. This results in high parsing failure rates (3.3% exact match) and high latency (383ms+ per request).
  • Why Hybrid Architecture Wins: Token classification via WangchanBERTa isolates target temporal spans with 99.57% Recall on out-of-distribution text. Passing this span to a deterministic rule engine guarantees valid ISO-8601 timestamps without hallucination.

Accuracy vs. Latency Pareto Frontier

Accuracy vs Latency Frontier

Model Specifications and Hyperparameters

  • Base Architecture: RoBERTa / CamemBERT architecture pre-trained on Thai Wikipedia, news, and social text (airesearch/wangchanberta-base-att-spm-uncased).
  • Target Entities:
    • O: Outside temporal entity.
    • B-TIME: Beginning of temporal expression.
    • I-TIME: Continuation of temporal expression.
  • Training Epochs: 4
  • Batch Size: 16 (per device)
  • Optimizer: AdamW (Learning Rate: 3e-5, Weight Decay: 0.01)
  • Warmup Steps: 50
  • FP16 Mixed Precision: Enabled
  • Inference Robustness: Multi-token stitching with confidence thresholding (0.35) to handle spaced particles and chat modifiers.

Intended Use and Pipeline Example

import torch
from transformers import AutoTokenizer, AutoModelForTokenClassification

model_name = "DuckerMaster/DuckerTime-Normalize-Thai"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

text = "เธ‚เธญเน€เธฅเธทเนˆเธญเธ™เน€เธ›เน‡เธ™เธงเธฑเธ™เธžเธธเธ˜เธซเธ™เน‰เธฒเธŠเนˆเธงเธ‡เธšเนˆเธฒเธขเนเธเนˆเน† เธชเธฑเธเธชเธตเนˆเน‚เธกเธ‡เน€เธขเน‡เธ™เน„เธ”เน‰เน„เธซเธกเธ„เธฐ"
inputs = tokenizer(text, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits
    preds = torch.argmax(logits, dim=2)[0].tolist()

tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
extracted_tokens = [tok for tok, pred in zip(tokens, preds) if pred != 0]
print("Extracted Temporal Tokens:", extracted_tokens)

Limitations and Negative Sample Handling

  • The model is fine-tuned to recognize temporal expressions in Thai. It actively suppresses non-temporal numeric entities (monetary sums, telephone sequences, tracking numbers) due to negative sampling in training data.
  • For non-Thai text, fallback to multilingual parsers is recommended.
  • Pair with thai-temporal-normalizer core package for full ISO-8601 normalization.

Citation

If you use this model in your research or production systems, please cite:

@software{duckertime_thai_2026,
  author = {DuckerMaster},
  title = {DuckerTime-Normalize-Thai: Fine-Tuned WangchanBERTa for Colloquial Thai Temporal NLU},
  year = {2026},
  publisher = {HuggingFace},
  howpublished = {\url{https://huggingface.co/DuckerMaster/DuckerTime-Normalize-Thai}}
}

References

  • WangchanBERTa: Lowphansirikul, L., et al. (2021). WangchanBERTa: Pretrained language models for Thai language. arXiv preprint arXiv:2101.09635.
  • ISO-TimeML: Pustejovsky, J., et al. (2010). ISO-TimeML: An International Standard for Semantic Annotation. ISO/TC 37/SC 4.
  • SUTime: Chang, A. X., & Manning, C. D. (2012). SUTime: A library for recognizing and normalizing time expressions. In LREC 2012.
  • HeidelTime: Strรถtgen, J., & Gertz, M. (2010). HeidelTime: High quality rule-based extraction and normalization of temporal expressions. In SemEval 2010.
Downloads last month
-
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 DuckerMaster/DuckerTime-Normalize-Thai

Finetuned
(67)
this model

Dataset used to train DuckerMaster/DuckerTime-Normalize-Thai

Paper for DuckerMaster/DuckerTime-Normalize-Thai

Evaluation results

  • In-Distribution F1 on Thai Natural DateTime Dataset (v1.1)
    self-reported
    1.000
  • Out-of-Distribution F1 on Thai Natural DateTime Dataset (v1.1)
    self-reported
    0.969
  • Out-of-Distribution Recall on Thai Natural DateTime Dataset (v1.1)
    self-reported
    0.996
  • Out-of-Distribution Precision on Thai Natural DateTime Dataset (v1.1)
    self-reported
    0.944