Skip to content
Proyectos

Acerca de

Trains in 10 minutes. Runs in 100 ms. Open source, multilingual, European. A new class of tiny language models: single-purpose, output-typed micro experts.

IA y aprendizaje automático

Cómo se miden estas cifras

What you can do

  • 🏗️ Domain base, then experts. Pretrain one multilingual base per industry, then add experts in minutes.
  • ⚡ Ten minutes to train an expert on a laptop GPU. One epoch, plain supervised fine-tuning.
  • 🪶 135M parameters. Fifty times smaller than the 7B model it matches or beats in the case study.
  • 🔒 Runs locally, on a CPU. No data leaves the building.

Crecimiento de estrellas medido

in 24h
Recopilando historial
in 7 days
Recopilando historial
in 15 days
Recopilando historial
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

SPOT: single-purpose, output-typed micro experts. Trains in 10 min. Runs in 100 ms. Open source, multilingual, European.

Stars Forks Last commit Apache 2.0

135M parameters About 10 minutes training About 100 ms inference 100% valid output Runs on CPU 21 EU languages PRs welcome

Trains in 10 minutes. Runs in 100 ms. Open source, multilingual, European.
One tiny language model per output type. Free text in, valid typed data out, on any CPU.

Whitepaper · Training guide · Example SPOT · Results · Cite

Terminal: generate data, train a SPOT in 9.8 minutes, run it on German and Polish invoice lines, valid EN 16931 output


[!IMPORTANT] We propose a new class of language models: SPOTs, tiny micro experts that each do exactly one job. Every SPOT sits on a multilingual domain base model: a small model pretrained once for an industry (health, finance, logistics, manufacturing) in many languages. On top of that base, a new expert for one output type trains in minutes. This repository is the first implementation of the SPOT architecture: training, evaluation and runtime, plus a complete example.

Why this is needed

Most data work is turning messy text into clean records: an invoice line, a work order, a delivery address, a medication order. Today that job goes to large general language models with billions of parameters, a GPU or a cloud API, and output that still has to be checked and retried.

That does not work where it matters most. Hospitals, public agencies and most European companies may not send their text to a cloud model. The machines that hold the data have no GPU. And a record that fails the schema breaks the next system in line.

SPOT does this one job locally, with a model small enough to train in ten minutes and run on the computer you already have.

Domain base, then experts

Four multilingual domain base models (health, finance, logistics, industry), each carrying several SPOT experts

SPOTs come in two layers.

  1. The domain base model is pretrained once per industry, and it is multilingual. It knows the language of the field across Europe's languages: drug names and dosing shorthand in health, VAT rules and unit codes in finance, part numbers and fault codes in manufacturing. This is the expensive step, and it happens once.
  2. The experts are fine-tuned on top of that base, one per output type. Because the base already knows the domain, an expert needs only a few thousand examples and about ten minutes of training. Experts from the same base can share it in memory and differ only in a small adapter.

A new team does not start from zero. It picks the base for its industry and trains its own expert the same afternoon.

In this first release, the examples start from the general SmolLM2-135M-Instruct; domain bases for health and finance are next on the roadmap.

How it works

Free text, SPOT model, compact fields, deterministic builder, validator, valid output

A SPOT splits the job in two:

Part What it does
🧠 Model (learned) A 135M expert, fine-tuned on the domain base, reads the text in any language and fills a few compact fields. Nothing else.
⚙️ Builder (code) Turns the fields into the full target format: JSON Schema, XML, EDI, HL7 FHIR, UBL.
✅ Validator (code) Checks the result against the standard.

The builder is total: it accepts anything, even an empty answer, fills safe defaults and flags them for review. So every output is valid by construction. There are no retries, no repair loops and no constrained decoding.

Because a SPOT is so small, it can be loaded for one request and released right after: spawn, answer, vanish. Many SPOTs, one per type, form a swarm that turns a whole document into structured records.

Highlights

  • 🏗️ Domain base, then experts. Pretrain one multilingual base per industry, then add experts in minutes.
  • ⚡ Ten minutes to train an expert on a laptop GPU. One epoch, plain supervised fine-tuning.
  • 🪶 135M parameters. Fifty times smaller than the 7B model it matches or beats in the case study.
  • 🔒 Runs locally, on a CPU. No data leaves the building.
  • ✅ 100% valid output, by construction, whatever the model does.
  • 🌍 Multilingual. The medication case study covers 21 EU languages and 10,000 brand names.
  • 🧩 Any schema. If it has a schema, it can have a SPOT.

SPOT vs. a general LLM

SPOT General LLM
Parameters 135M 7B to 1T+
Hardware any CPU GPU or cloud API
Data leaves the building never usually
Valid output 100%, by construction mostly, with retries
Training a new type ~10 min on a laptop, on top of the domain base prompt engineering, or hours on GPUs
Lifetime spawn, answer, vanish always-on model server
Jobs one, done well everything

One SPOT per type

If it has a schema, it can have a SPOT.

Type Standard Status
💊 Medication order HL7 FHIR MedicationRequest ✅ case study
🧾 Invoice line EN 16931 / UBL ✅ example
📦 Delivery address UPU S42 🔜
🛠️ Maintenance work order ISO 14224 🔜
🧪 Lab order HL7 FHIR ServiceRequest 🔜
⚠️ Allergy HL7 FHIR AllergyIntolerance 🔜
🎫 Support ticket your JSON Schema 💡
📄 Contract clause your JSON Schema 💡

Quickstart

git clone https://github.com/arnepeine/spot.git && cd spot
pip install -r requirements.txt

# 1. make example data (7 languages, EN 16931 invoice lines)
python examples/invoice_line/generate.py --n 6000 --out data/invoice_line

# 2. train
python -m spot.train --spot examples/invoice_line --data data/invoice_line/train.jsonl --out models/spot-invoice-line

# 3. check
python -m spot.evaluate --spot examples/invoice_line --model models/spot-invoice-line --data data/invoice_line/test.jsonl

# 4. run
python -m spot.run --spot examples/invoice_line --model models/spot-invoice-line "12 Kartons Kopierpapier A4 je 4,90 € zzgl. 19% MwSt"

What comes out of spot.run for one line:

{
  "text": "Fliesen verlegen 14 qm à 38,50 EUR zzgl. 19 % USt",
  "fields": {"item": "Fliesen verlegen", "qty": 14, "unit": "MTK", "price": 38.5, "cur": "EUR", "vat": 19},
  "output": {
    "ID": "1",
    "Note": "Fliesen verlegen 14 qm à 38,50 EUR zzgl. 19 % USt",
    "InvoicedQuantity": {"value": 14.0, "unitCode": "MTK"},
    "LineExtensionAmount": {"value": 539.0, "currencyID": "EUR"},
    "Item": {"Name": "Fliesen verlegen", "ClassifiedTaxCategory": {"ID": "S", "Percent": 19.0, "TaxScheme": {"ID": "VAT"}}},
    "Price": {"PriceAmount": {"value": 38.5, "currencyID": "EUR"}}
  },
  "valid": true,
  "errors": []
}

Results

Case study: SPOT-Medication

Free-text ICU medication orders to HL7 FHIR R4 MedicationRequest. 400 real orders with added noise, same laptop, fair scoring.

Field SPOT 135M Qwen2.5 7B, five-shot
Drug 90.8% 91.0%
Dose 94.2% 83.4%
Route 98.7% 94.1%
Timing 97.3% 93.5%
As needed 95.3% 91.5%
Valid FHIR 100% 100%
Time per order 0.37 s 0.99 s

Against a rule-based parser on all 2,416 noisy test orders, the share of orders with every field right goes from 42.2% to 78.2%. Training took 7 minutes on 15,198 orders.

Example SPOT: invoice lines

The example in this repository, trained from scratch on a laptop while a second training job shared the GPU.

Training 6,000 generated lines, 7 languages, 375 steps, 9.8 min
Generated test set (300 lines) 100% on every field, 100% valid
Hand-written lines, phrasings not in the generator 6 of 6 right, 6 of 6 valid

The generated test set shares its vocabulary with the training data, so it shows that the SPOT learned the job, not how it does on real invoices. Bring real lines before you rely on it.

The medication model was trained on credentialed clinical data (eICU), so its data and weights are not in this repository. The whitepaper has the full method, the related work and the limitations.

Build your own

Every SPOT is one folder:

examples/<your_type>/
├── manifest.json   # name, base model, prompt, fields
├── builder.py      # build(text, fields) and validate(output)
└── generate.py     # optional: synthetic training data

The training guide walks through all of it, from the manifest to an 8-bit MLX model.

Roadmap

  • SPOT-Medication: free text to FHIR MedicationRequest
  • Training, evaluation and runtime for any schema
  • Example SPOT: EN 16931 invoice lines in 7 languages
  • Spotlight: the orchestrator that routes passages to SPOTs
  • Multilingual domain base models: SPOT-Base Health, SPOT-Base Finance
  • SPOT swarms with a shared domain base and one LoRA adapter per expert
  • SPOT Hub: download a SPOT by type
  • SPOTs on European base models
  • More types: delivery address, work order, allergy, lab order

Want a type that is not on the list? Propose a SPOT.

Star history

Citation

@techreport{peine2026spot,
  title  = {Single-purpose, output-typed micro experts: a general architecture
            for turning free text into valid typed data},
  author = {Peine, Arne},
  year   = {2026},
  month  = {12},
  note   = {Whitepaper v0.1},
  url    = {https://github.com/arnepeine/spot}
}


SPOT is a project by Arne Peine.

Explorar proyectos relacionados

Cargando…