tac-1 / README.md
Araya2001's picture
Upload README.md with huggingface_hub
5ff25af verified
|
Raw
History Blame Contribute Delete
5.6 kB
---
license: apache-2.0
language:
- es
base_model: Qwen/Qwen3-4B-Instruct-2507
pipeline_tag: text-generation
library_name: transformers
tags:
- address-parsing
- structured-output
- costa-rica
- geocoding
- qwen3
---
# tac-1 — Costa Rican reference-point address parser
## What is tac-1
Costa Rica has no street-address system. Addresses are reference-point narratives — "del antiguo higuerón de San Pedro, 100 metros sur" or "de la esquina noroeste del Mercado Central, 200 metros norte, casa esquinera." tac-1 parses these into a structured, leg-based JSON record. It performs **parsing only**: geometry (resolving the anchor point to coordinates and walking the OSM street graph along each leg) belongs to a separate deterministic grounder (the companion `tico` package, not part of this model release).
## Architecture
tac-1 is a hybrid system. This model extracts the structured address fields (anchor name, anchor type, and a list of legs with direction and distance). The `tico` package then grounds the parse by walking the OSM street graph — it resolves the anchor to a coordinate via `resolve_anchor`, then traces each leg along the graph using the same geometry core that generated the training data.
## Evaluation
### gold-47 vs teacher
| metric | tac-1 (bf16) | tac-1 (FP8) | teacher gpt-4.1 |
|---|---|---|---|
| parse rate | 1.000 | 1.000 | 1.000 |
| anchor_name F1 | 0.979 | 0.979 | 0.872 |
| direction F1 | 0.995 | 0.984 | 1.000 |
| distance F1 | 0.995 | 0.984 | 1.000 |
| perfect-anchor ≤250 m | 93.6% | 93.6% | 93.6% |
| perfect-anchor median | 0.0 m | 0.0 m | 0.0 m |
| gazetteer ≤250 m | 80.9% | 80.9% | 83.0% |
**Headline:** anchor_name F1 beats the gpt-4.1 teacher, with zero geographic overfit on never-trained districts.
### heldout-805
| metric | tac-1 (bf16) |
|---|---|
| parse rate | 1.000 |
| anchor_name F1 | 1.000 |
| direction F1 | 1.000 |
| distance F1 | 1.000 |
| perfect-anchor median | 89.5 m |
| perfect-anchor ≤250 m | 81.0% |
| gazetteer median | 148.8 m |
| gazetteer ≤250 m | 65.0% |
Grounding-baseline medians on heldout-805: hybrid_walk 143.8 m vs calibrated_project 198.7 m vs naive_project 201.9 m (the graph walk beats projection on unseen geography).
The three never-trained districts (grecia, curridabat, go-guadalupe) show anchor_name/direction/distance F1 all at 1.000 — zero geographic overfit.
## Quickstart
```bash
vllm serve CodeStrux-Tech/tac-1 --served-model-name tac-1 --max-model-len 4096
# On hosts without nvcc, disable the FlashInfer sampler JIT:
# VLLM_USE_FLASHINFER_SAMPLER=0 vllm serve ...
```
```python
from tico.extractor.clients.vllm import VLLMExtractor
extractor = VLLMExtractor() # VLLM_BASE_URL=http://localhost:8000/v1, TICO_VLLM_MODEL=tac-1
addr = extractor.extract("del antiguo higuerón de San Pedro, 100 metros sur")
print(addr.model_dump_json(indent=2))
```
## Limitations
- **confidence is a constant 0.0** — uncalibrated; do not consume this value.
- **anchor lat/lon/osm_id are always null by design** — coordinates belong to the grounder's `resolve_anchor`, not the model.
- **Spanish/Costa-Rica-specific** — the model was trained and evaluated exclusively on Costa Rican Spanish reference-point addresses.
- **Remaining system headroom is gazetteer/calibration coverage, not the model** — the extractor is at or near ceiling on the evaluation sets; further accuracy gains require broader OSM ingestion and calibration.
## Training
- **Base model:** Qwen/Qwen3-4B-Instruct-2507
- **Method:** QLoRA (r=16, α=32)
- **Learning rate:** 2e-4
- **Epochs:** 2
- **Max sequence length:** 4096
- **Steps:** 692
- **Final train loss:** 0.043
- **Hardware:** ~2 h 50 m on an RTX 4080 16 GB
- **Stack:** unsloth 2025.11.1 / transformers 4.57.2 / trl 0.23.0
- **Corpus:** `CodeStrux-Tech/tac-1-corpus` — 5,532 train examples (seed 0), 805 heldout examples (seed 1); `--max-legs 4`; 22 districts ingested, 19,042 POIs, 11 griddable; holdout districts grecia, curridabat, go-guadalupe excluded from training.
### Training data attribution
Contains information from OpenStreetMap (https://www.openstreetmap.org/copyright), which is made available under the Open Database License (ODbL) 1.0. © OpenStreetMap contributors.
**Licensing.** The tac-1 corpus is a derivative database of OpenStreetMap and is released under the Open Database License (ODbL) 1.0, with attribution: © OpenStreetMap contributors (https://www.openstreetmap.org/copyright). The tac-1 model weights are a produced work trained on that corpus and are released under Apache-2.0; the corpus's ODbL provenance is disclosed in every model card. Code is Apache-2.0 (LICENSE); data is ODbL (DATA_LICENSE); see NOTICE. Sources are OpenStreetMap + INEC/IGN + community DTA tables only — no Google or Waze data anywhere in the pipeline, training data, or release.
## Related
- [`CodeStrux-Tech/tac-1-fp8-dynamic`](https://huggingface.co/CodeStrux-Tech/tac-1-fp8-dynamic) — FP8 dynamic quantization
- [`CodeStrux-Tech/tac-1-gguf`](https://huggingface.co/CodeStrux-Tech/tac-1-gguf) — GGUF (Q5_K_M + f16) for llama.cpp / Ollama
- [`CodeStrux-Tech/tac-1-lora`](https://huggingface.co/CodeStrux-Tech/tac-1-lora) — QLoRA adapter weights
- [`CodeStrux-Tech/tac-1-corpus`](https://huggingface.co/CodeStrux-Tech/tac-1-corpus) — training corpus (ODbL)
tac-1 is a derivative work of [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507), Copyright 2024 Alibaba Cloud, licensed under the Apache License, Version 2.0. The upstream LICENSE is included in this repository.