# Thedal

*Released.* Cross-script Tamil & Tanglish retrieval embeddings, version 1, 4 December 2026.

Thedal (தேடல், search) is a 278M-parameter multilingual embedding model fine-tuned for cross-script Tamil retrieval. A query typed in Tamil script (தமிழ்), romanized Tanglish (`thamizh` or `tamil`), or a mix of Tamil and English finds the same original Tamil passage.

[Download on Hugging Face](https://huggingface.co/zhagaramlabs/thedal-v1) [Dataset on Hugging Face](https://huggingface.co/datasets/zhagaramlabs/thedal-tamil-retrieval) [Code on GitHub](https://github.com/zhagaramlabs/lab/blob/main/scripts/train_thedal_v1.py)

- **59.1%** Recall@10 on romanized Tanglish queries, up from 1.5% zero-shot (+57.6 pp)
- **87.2%** Recall@10 on mixed Tamil and Tanglish queries, up from 19.2% (+68.0 pp)
- **96.4%** Recall@10 on Tamil-script queries, up from 56.6% (+39.8 pp)

## 1. Use it

Thedal loads with `sentence-transformers` and uses standard E5 prefixes: `"query: "` for queries and `"passage: "` for documents.

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("zhagaramlabs/thedal-v1")
q = model.encode(["query: akara mudhala ezhuthellam"], normalize_embeddings=True)
docs = model.encode([
    "passage: அகர முதல எழுத்தெல்லாம் ஆதி பகவன் முதற்றே உலகு.",
    "passage: கற்க கசடறக் கற்பவை கற்றபின் நிற்க அதற்குத் தக.",
], normalize_embeddings=True)
print((q @ docs.T)[0])
```

Embeddings are 768-dimensional, mean-pooled and L2-normalized, so dot product equals cosine similarity.

## 2. Why cross-script Tamil retrieval

Most multilingual embedding models are trained and benchmarked on translated English retrieval datasets. They separate Tamil script from romanized Tamil into different regions of vector space. When a Tamil speaker types a search in Tanglish or mixes Tamil with English words, zero-shot `multilingual-e5-base` retrieves the right Tamil passage in the top 10 only 1.5% of the time.

Thedal fine-tunes `intfloat/multilingual-e5-base` on original, non-translated Tamil passages paired with Tamil-script, Tanglish and mixed-script queries, using lexical and phonetic hard negatives so the encoder aligns meaning across scripts rather than matching surface characters.

## 3. Uraikal Track G1 results

Evaluated on full-corpus retrieval over 12,200 original Tamil passages (Thirukkural, IndicTTS, Project Madurai and Sangraha Web) with 3,651 strictly unseen test queries (1,217 per script slice, 0% passage overlap between train and test):

| Script slice | Metric | Zero-shot `multilingual-e5-base` | **Thedal v1** | Gain |
|---|---|---:|---:|---:|
| `script=ta` (Tamil script, n=1,217) | Recall@10 | 56.6% | **96.4%** | +39.8 pp |
| `script=ta` (Tamil script, n=1,217) | MRR@10 | 45.3% | **91.7%** | +46.4 pp |
| `script=tanglish` (Romanized, n=1,217) | Recall@10 | 1.5% | **59.1%** | +57.6 pp |
| `script=tanglish` (Romanized, n=1,217) | MRR@10 | 0.7% | **44.7%** | +44.0 pp |
| `script=mixed` (Tamil + Tanglish, n=1,217) | Recall@10 | 19.2% | **87.2%** | +68.0 pp |
| `script=mixed` (Tamil + Tanglish, n=1,217) | MRR@10 | 12.0% | **77.1%** | +65.1 pp |

On Recall@1, Tanglish rises from 0.5% to 38.0% (+37.6 pp) and mixed-script queries rise from 9.3% to 72.2% (+62.9 pp).

## 4. How it was built

- **Base model.** `intfloat/multilingual-e5-base` (MIT licence, 278M parameters, 768-dim embeddings).
- **Data.** [thedal-tamil-retrieval](https://huggingface.co/datasets/zhagaramlabs/thedal-tamil-retrieval): 12,200 original Tamil passages split strictly by `doc_id` (and by adhigaram for Thirukkural) into 29,298 train pairs (9,766 passages), 3,651 validation pairs and 3,651 test pairs, with 0% overlap across splits.
- **Objective.** Contrastive InfoNCE (`tau=0.05`) combining in-batch negatives with split-isolated lexical and phonetic hard negatives (including same-adhigaram Thirukkural couplets).
- **Compute.** 3 epochs, batch size 64, learning rate `2e-5`, `bf16` on 1 NVIDIA H100 (~5 minutes).

## 5. Limits

- Tanglish queries in the training and test sets were generated via phonology-aware G2P transduction (`uraikal.g2p`) with simulated typing noise, not collected from live search logs.
- Passage length follows the 512-token context limit of `multilingual-e5-base`.
- Regional dialect vocabulary (Jaffna, Batticaloa, Kongu, Tirunelveli) is only partially represented in public web and literary corpora; broader dialect coverage will come with Ootru.

## 6. Licence and citation

- **Weights and code:** MIT (matching `intfloat/multilingual-e5-base`). Training script in [lab](https://github.com/zhagaramlabs/lab/blob/main/scripts/train_thedal_v1.py).
- **Dataset:** CC BY 4.0, at [zhagaramlabs/thedal-tamil-retrieval](https://huggingface.co/datasets/zhagaramlabs/thedal-tamil-retrieval).

```bibtex
@misc{thedal2026,
  title  = {Thedal v1: Cross-Script Tamil and Tanglish Retrieval Embeddings},
  author = {{Zhagaram Labs}},
  year   = {2026},
  url    = {https://zhagaramlabs.com/models/thedal/}
}
```

## 7. Versions

| Version | Released | What changed |
|---|---|---|
| 1 | 4 December 2026 | First release: 278M cross-script Tamil and Tanglish retrieval embeddings trained on `thedal-tamil-retrieval`. |

## Related

- [Maatru](/models/maatru/), our bidirectional Tanglish ↔ Tamil converter and spoken text normalizer.
- [All our models](/#models), released and in progress.
