How Ghostrow understands databases.
Ghostrow reads schemas and application code with its rule-based engine, gr-schema-1, and turns what it understands into rules. Since 1.0.2, a small model trained for this step, gr-col-1, runs on your machine and proposes what each column holds; the engine checks every proposal before it is used. A deterministic generator then follows the rules, so the same seed always gives the same rows.
- Local
- schema, code and data
- 2 values
- sent for license checks
- Off
- bring-your-own-key, by default
- Repeatable
- same seed, same rows
What Ghostrow works out for you
Hand-written fixtures encode this knowledge by hand. Ghostrow reads it from the places it already lives: column names, types, constraints, triggers and your validation code.
| Type | Example | Read from | Plans |
|---|---|---|---|
| Column meaning | customers.nic is a Sri Lankan NIC | name, type, CHECK constraint | All plans |
| Cross-column rules | orders.total = sum(order_lines.amount) | triggers, views, foreign keys | All plans |
| Code rules | plans.ends_at is later than starts_at | Zod, Pydantic, Django, Laravel validators | Pro, Max |
| Data shape | order sizes follow production’s distribution | statistics measured locally by Twin | Max |
Understanding first. Plain code for generating.
The understanding step never writes rows directly, whether it is the engine, the model or an AI provider you bring. It produces a rule plan, and a seeded generator produces the data. That keeps output repeatable for CI and makes every decision visible.
- Reviewable
- The rule plan is saved as
ghostrow.rules.yaml. Read it, edit it and commit it with your code. - Checked proposals
- The model’s meaning is used only when it is at least 50% sure and the meaning fits the column’s declared type. Foreign keys and meanings pinned in the rules file never change.
--no-modelturns it off for a run. - Repeatable
- The same schema, rules, model and seed produce the same rows on every machine and every CI run.
- Valid by construction
- Foreign keys and constraints are enforced by the generator, then checked again by an independent validator.
- Private by default
- No telemetry on your schema or data. License checks send two values, nothing else.
Model card: gr-col-1
What the schema model is for, what it isn’t for, what it was trained on and where it falls short.
| Status | Available In Ghostrow 1.0.2 and later, on every plan. Install it once with ghostrow model pull; without it, Ghostrow uses the rule-based engine gr-schema-1 as before |
|---|---|
| Task | Column meaning: which of 56 meanings a column holds, such as email, currency code, token, status or date of birth |
| Model type | A 32-million-parameter text encoder (Ettin-encoder-32m, ModernBERT architecture, MIT licence), fine-tuned by Ghostrow. Ships as a 32.5 MB int8 ONNX file |
| Input | Schema text only: table and column names, declared type, key and null flags, and the names of nearby columns. Never values from your database |
| Runs on | The CPU of the machine running Ghostrow, offline after the download. Windows (x64, arm64), Linux (x64, arm64) and macOS on Apple silicon. On Intel Macs Ghostrow uses the rule-based engine. No GPU required |
| Intended use | Inferring column meaning so Ghostrow can plan synthetic test data |
| Out of scope | Writing content about real people, making decisions about people, or producing anything other than a rule plan |
| Training data | 81,863 columns from 6,000 synthetic tables made by our own generator, each with a known meaning, and columns from 16 open-source schemas under MIT, BSD and Apache-2.0 licences, labelled by the rule engine. Every public file is pinned to a commit and listed with its licence. No customer data, and nothing users run through Ghostrow |
| Training | 3 epochs over 90,840 examples in bf16 on one NVIDIA RTX 4070, in 298 seconds |
| Known limits | Less accurate than the rule engine on free text and plain numbers in our evaluation, and less accurate on column names unlike anything in its training data. It doesn’t read code or find cross-column rules; the engine still does. Every inference is shown for review |
| Integrity | The download is described by a signed manifest (Ed25519), and every file is checked against its SHA-256 before it is installed |
How well it reads columns
505 columns from five public schemas the model never saw in training (Chinook, Sakila, Umami, Healthchecks and Koel): every column that isn’t a declared foreign key, which the constraint decides. Each column was labelled against a written guide, and the labels are public. They were written in two passes by one labeller, an AI assistant working from the guide, and have not yet been reviewed independently. We ran the same columns through Ghostrow with and without the model.
| Measure | Rule engine gr-schema-1 | With gr-col-1 |
|---|---|---|
| All 505 columns, as Ghostrow runs | 83.4% (421) | 89.9% (454) |
| 151 columns with names not seen in training | 76.8% (116) | 79.5% (120), model alone |
With the model, Ghostrow changed 65 of the rule engine’s meanings: 43 changes fixed a wrong meaning, 10 replaced a correct one with a wrong one, and 12 swapped one wrong meaning for another. The second labelling pass changed 6 labels after the first results were seen; with the first-pass labels the scores were 84.6% and 91.1%. The set is small, and the rule engine’s answer was visible while labelling, which favours the rule engine.
| Metric | What it measures | Result |
|---|---|---|
| Column meaning | Share of held-out columns labelled correctly | 89.9%, against 83.4% for the rule engine |
| Run time | Time for the model step on a desktop CPU (Intel Core i7-13700K), including loading the model | 0.37 s for 53 columns; 20.2 s for 12,878 columns (1.57 ms per column) |
| Rule recall | Share of known cross-column rules found | Being measured |
| Constraint validity | Generated rows that pass every constraint | Being measured |
The method, results by source and by meaning, every disagreement and both models we trained are published with the code.
Try it on your own schema. Nothing leaves your machine.
npm i -g ghostrow && ghostrow model pull && ghostrow seed --schema schema.sql