|
Download README.md from DuckerMaster/DuckerTime-Normalize-Thai: direct link, hf CLI and curl.
- Browser
- Download file 6.42 kB
-
https://huggingface.co/DuckerMaster/DuckerTime-Normalize-Thai/resolve/main/README.md
- Command line
-
hf download hf://DuckerMaster/DuckerTime-Normalize-Thai/README.md
-
curl -L -o README.md https://huggingface.co/DuckerMaster/DuckerTime-Normalize-Thai/resolve/main/README.md
6.42 kB
metadata
language:
- th
license: apache-2.0
tags:
- token-classification
- ner
- temporal-extraction
- wangchanberta
- roberta
- thai-nlp
base_model: airesearch/wangchanberta-base-att-spm-uncased
datasets:
- DuckerMaster/Thai-Natural-DateTime-Dataset
pipeline_tag: token-classification
metrics:
- f1
- precision
- recall
- accuracy
model-index:
- name: DuckerTime-Normalize-Thai
results:
- task:
type: token-classification
name: Named Entity Recognition
dataset:
name: Thai Natural DateTime Dataset (v1.1)
type: DuckerMaster/Thai-Natural-DateTime-Dataset
metrics:
- name: In-Distribution F1
type: f1
value: 1
- name: Out-of-Distribution F1
type: f1
value: 0.9692
- name: Out-of-Distribution Recall
type: recall
value: 0.9957
- name: Out-of-Distribution Precision
type: precision
value: 0.9441
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:
- WangchanBERTa Frontend: Extracts precise character and token spans from raw unstructured text.
- Deterministic Rule Engine Backend: Parses the extracted temporal span into valid ISO-8601 points and ranges in sub-millisecond execution.
Model Performance & Empirical Benchmark
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
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-normalizercore 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.

