Hindsight

hs-date-1

hs-date-1 finds the dates a question talks about: "last week", "上上周", "since March", "the 3rd of last month". It was built for Hindsight's recall, and runs through the text2date Python package.

Highlights

  • 16 languages: English, Chinese (Simplified and Traditional), Spanish, German, Arabic, Japanese, Korean, Italian, Portuguese, French, Vietnamese, Indonesian, Thai, Hindi and Russian.
  • Tiny: 4.8M parameters, a 9.7 MB file.
  • Fast on CPU: about 1 ms per question with numpy alone. No torch, no GPU, no network.
  • Knows when there is no date: "install Office 2019" or "remind me what June said" give no date.

Model overview

Model type Byte-level encoder-decoder transformer (semantic parser)
Parameters 4.8M
Input The question's UTF-8 bytes, up to 256
Output A short meaning code, up to 24 tokens (week -1, last 6 month, 2025-05 ; 2026-06, none)
Architecture 2 convolutions (4x shorter), 6 encoder layers, 1 decoder layer, 256 wide, 4 heads
Vocabulary 1,271 output words (vocab.json)
Format model.safetensors in FP16
Training data hindsight-ai/hs-date-1-data, 940k questions

The model writes a meaning code, not dates. text2date turns the code into dates with plain Python, so leap years, week starts and month lengths are always right, and "last week" depends on the day the question was asked.

Evaluation

Held-out questions, about 3,000 per language, every kind of date. Exact = every date range right. False dates = a date found in a question that has none. dateparser is the library Hindsight used before, with its hand-written rules on top.

Language dateparser exact hs-date-1 exact dateparser false dates hs-date-1 false dates
English 55.9% 98.7% 24.4% 1.1%
Chinese 66.9% 97.7% 3.1% 0.4%
Chinese (traditional) 63.4% 96.9% 1.8% 0.6%
Spanish 50.3% 96.4% 19.6% 0.0%
German 48.1% 97.9% 18.4% 0.8%
Arabic 42.2% 94.6% 4.3% 1.1%
Japanese 47.0% 96.2% 8.9% 1.6%
Korean 46.4% 97.6% 5.4% 1.6%
Italian 49.9% 96.5% 10.4% 1.0%
Portuguese 41.4% 96.7% 18.3% 0.7%
French 54.2% 95.6% 14.2% 0.9%
Vietnamese 40.4% 95.0% 11.3% 1.3%
Indonesian 40.0% 95.5% 21.9% 1.6%
Thai 43.2% 95.6% 10.0% 1.2%
Hindi 46.9% 95.2% 16.9% 1.3%
Russian 53.3% 95.4% 16.9% 1.0%
Hindsight's own tests (834) 91.0% 98.7% 5.2% 1.5%

The last row is Hindsight's query-analyzer tests and golden corpus. They were written for dateparser, so it does well there. Time per question: dateparser 0.1-16 ms (p95 up to 57 ms), hs-date-1 about 1 ms (p95 1.5 ms).

Usage

pip install text2date
from datetime import date
import text2date

text2date.parse("what did I decide last week", anchor=date(2026, 11, 20))
# [DateRange(start=date(2026, 11, 9), end=date(2026, 11, 15))]

text2date.parse("上个月的会议", anchor=date(2026, 11, 20), tz="Asia/Shanghai")
# [DateRange(start=date(2026, 10, 1), end=date(2026, 10, 31))]

text2date.parse("what is my wifi password")
# []

The package ships these weights inside, so nothing is downloaded at run time. To load a file from this repo instead:

from huggingface_hub import hf_hub_download
from text2date import Parser

parser = Parser(hf_hub_download("hindsight-ai/hs-date-1", "model.safetensors"))

Training

LLM-written questions in 16 languages (Gemma 4), each checked by turning its code back into dates, plus template questions and hard examples the model got wrong. 20 passes from scratch, then short fine-tunes, then unused feed-forward units pruned. Fixes come from training data, never from rules in the code. training/checkpoint.safetensors is the full FP32 model before pruning, to fine-tune from. Data, scripts and recipe: text2date/TRAINING.md.

Limits

  • Whole days only: "yesterday at 3pm" gives yesterday.
  • No Diwali, Holi or other Hindu-calendar days; personal events ("my birthday") give no date.
  • Other languages don't crash (it reads raw bytes), but they are not trained or tested.

License

MIT

Citation

@misc{hindsightai2026hsdate1,
  title  = {hs-date-1},
  author = {{Hindsight AI}},
  year   = {2026},
  url    = {https://huggingface.co/hindsight-ai/hs-date-1}
}
Downloads last month
-
Safetensors
Model size
4.83M params
Tensor type
F16
·
I64
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train hindsight-ai/hs-date-1