Text Generation
Transformers
Safetensors
Spanish
qwen3
address-parsing
structured-output
costa-rica
geocoding
conversational
text-generation-inference
Instructions to use CodeStrux-Tech/tac-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeStrux-Tech/tac-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeStrux-Tech/tac-1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CodeStrux-Tech/tac-1") model = AutoModelForCausalLM.from_pretrained("CodeStrux-Tech/tac-1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CodeStrux-Tech/tac-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeStrux-Tech/tac-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeStrux-Tech/tac-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CodeStrux-Tech/tac-1
- SGLang
How to use CodeStrux-Tech/tac-1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CodeStrux-Tech/tac-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeStrux-Tech/tac-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CodeStrux-Tech/tac-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeStrux-Tech/tac-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CodeStrux-Tech/tac-1 with Docker Model Runner:
docker model run hf.co/CodeStrux-Tech/tac-1
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- es
|
| 5 |
+
base_model: Qwen/Qwen3-4B-Instruct-2507
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
library_name: transformers
|
| 8 |
+
tags:
|
| 9 |
+
- address-parsing
|
| 10 |
+
- structured-output
|
| 11 |
+
- costa-rica
|
| 12 |
+
- geocoding
|
| 13 |
+
- qwen3
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# tac-1 — Costa Rican reference-point address parser
|
| 17 |
+
|
| 18 |
+
## What is tac-1
|
| 19 |
+
|
| 20 |
+
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 the deterministic grounder in the tico-address repo (`https://github.com/CodeStrux/tac-1`).
|
| 21 |
+
|
| 22 |
+
## Architecture
|
| 23 |
+
|
| 24 |
+
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. See `https://github.com/CodeStrux/tac-1` for the full grounder implementation.
|
| 25 |
+
|
| 26 |
+
## Evaluation
|
| 27 |
+
|
| 28 |
+
### gold-47 vs teacher
|
| 29 |
+
|
| 30 |
+
| metric | tac-1 (bf16) | tac-1 (FP8) | teacher gpt-4.1 |
|
| 31 |
+
|---|---|---|---|
|
| 32 |
+
| parse rate | 1.000 | 1.000 | 1.000 |
|
| 33 |
+
| anchor_name F1 | 0.979 | 0.979 | 0.872 |
|
| 34 |
+
| direction F1 | 0.995 | 0.984 | 1.000 |
|
| 35 |
+
| distance F1 | 0.995 | 0.984 | 1.000 |
|
| 36 |
+
| perfect-anchor ≤250 m | 93.6% | 93.6% | 93.6% |
|
| 37 |
+
| perfect-anchor median | 0.0 m | 0.0 m | 0.0 m |
|
| 38 |
+
| gazetteer ≤250 m | 80.9% | 80.9% | 83.0% |
|
| 39 |
+
|
| 40 |
+
**Headline:** anchor_name F1 beats the gpt-4.1 teacher, with zero geographic overfit on never-trained districts.
|
| 41 |
+
|
| 42 |
+
### heldout-805
|
| 43 |
+
|
| 44 |
+
| metric | tac-1 (bf16) |
|
| 45 |
+
|---|---|
|
| 46 |
+
| parse rate | 1.000 |
|
| 47 |
+
| anchor_name F1 | 1.000 |
|
| 48 |
+
| direction F1 | 1.000 |
|
| 49 |
+
| distance F1 | 1.000 |
|
| 50 |
+
| perfect-anchor median | 89.5 m |
|
| 51 |
+
| perfect-anchor ≤250 m | 81.0% |
|
| 52 |
+
| gazetteer median | 148.8 m |
|
| 53 |
+
| gazetteer ≤250 m | 65.0% |
|
| 54 |
+
|
| 55 |
+
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).
|
| 56 |
+
|
| 57 |
+
The three never-trained districts (grecia, curridabat, go-guadalupe) show anchor_name/direction/distance F1 all at 1.000 — zero geographic overfit.
|
| 58 |
+
|
| 59 |
+
## Quickstart
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
vllm serve CodeStrux-Tech/tac-1 --served-model-name tac-1 --max-model-len 4096
|
| 63 |
+
# On hosts without nvcc, disable the FlashInfer sampler JIT:
|
| 64 |
+
# VLLM_USE_FLASHINFER_SAMPLER=0 vllm serve ...
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from tico.extractor.clients.vllm import VLLMExtractor
|
| 69 |
+
|
| 70 |
+
extractor = VLLMExtractor() # VLLM_BASE_URL=http://localhost:8000/v1, TICO_VLLM_MODEL=tac-1
|
| 71 |
+
addr = extractor.extract("del antiguo higuerón de San Pedro, 100 metros sur")
|
| 72 |
+
print(addr.model_dump_json(indent=2))
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Limitations
|
| 76 |
+
|
| 77 |
+
- **confidence is a constant 0.0** — uncalibrated; do not consume this value.
|
| 78 |
+
- **anchor lat/lon/osm_id are always null by design** — coordinates belong to the grounder's `resolve_anchor`, not the model.
|
| 79 |
+
- **Spanish/Costa-Rica-specific** — the model was trained and evaluated exclusively on Costa Rican Spanish reference-point addresses.
|
| 80 |
+
- **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.
|
| 81 |
+
|
| 82 |
+
## Training
|
| 83 |
+
|
| 84 |
+
- **Base model:** Qwen/Qwen3-4B-Instruct-2507
|
| 85 |
+
- **Method:** QLoRA (r=16, α=32)
|
| 86 |
+
- **Learning rate:** 2e-4
|
| 87 |
+
- **Epochs:** 2
|
| 88 |
+
- **Max sequence length:** 4096
|
| 89 |
+
- **Steps:** 692
|
| 90 |
+
- **Final train loss:** 0.043
|
| 91 |
+
- **Hardware:** ~2 h 50 m on an RTX 4080 16 GB
|
| 92 |
+
- **Stack:** unsloth 2025.11.1 / transformers 4.57.2 / trl 0.23.0
|
| 93 |
+
- **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.
|
| 94 |
+
|
| 95 |
+
### Training data attribution
|
| 96 |
+
|
| 97 |
+
Contains information from OpenStreetMap (https://www.openstreetmap.org/copyright), which is made available under the Open Database License (ODbL) 1.0. © OpenStreetMap contributors.
|
| 98 |
+
|
| 99 |
+
**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.
|
| 100 |
+
|
| 101 |
+
## Related
|
| 102 |
+
|
| 103 |
+
- [`CodeStrux-Tech/tac-1-fp8-dynamic`](https://huggingface.co/CodeStrux-Tech/tac-1-fp8-dynamic) — FP8 dynamic quantization
|
| 104 |
+
- [`CodeStrux-Tech/tac-1-gguf`](https://huggingface.co/CodeStrux-Tech/tac-1-gguf) — GGUF (Q5_K_M + f16) for llama.cpp / Ollama
|
| 105 |
+
- [`CodeStrux-Tech/tac-1-lora`](https://huggingface.co/CodeStrux-Tech/tac-1-lora) — QLoRA adapter weights
|
| 106 |
+
- [`CodeStrux-Tech/tac-1-corpus`](https://huggingface.co/CodeStrux-Tech/tac-1-corpus) — training corpus (ODbL)
|
| 107 |
+
- Source code: `https://github.com/CodeStrux/tac-1`
|