Khaos Foreign-Key Matching
A model that scores whether one column is a foreign key referencing another from sampled cells of both columns and 11 overlap features.
tab_key_matching v1, from Khaos (a local-first library of pre-trained models for domain-specific tasks). This is the first release of the artifact.
Model
- Architecture: ColumnPairMatcher: shared ColumnEncoder (character CNN) for both columns and an MLP over the two embeddings, their difference and product, and the pair features
- Parameters: 138,285
- Format: ONNX (
model.onnx) plus PyTorch weights (model.pt) andmanifest.json - Training data: fletxcher/khaos-tab_key_matching
Results
Measured on the held-out test split of the training dataset.
| Metric | Value |
|---|---|
| test_auroc | 0.8182 |
| test_average_precision | 0.6476 |
| test_f1_at_val_threshold | 0.7114 |
| baseline_overlap_features_gbm_auroc | 0.8851 |
| baseline_overlap_features_gbm_average_precision | 0.8134 |
| threshold | 0.2500 |
| n_test_pairs | 495 |
| positive_rate | 0.3879 |
Test results by database
| Database | Pairs | Khaos AUROC | Overlap-features GBM AUROC |
|---|---|---|---|
| rel-f1 | 269 | 0.877 | 0.944 |
| rel-mimic | 226 | 0.752 | 0.771 |
Training
{
"epochs": 80,
"batch": 64,
"lr": 0.001,
"architecture": "ColumnPairMatcher"
}
Best epoch 5, trained in 0.3 minutes on a single consumer GPU (RTX 3050 8 GB).
Intended use
Ranking candidate join keys between tables. Compute the features with khaos.tabular.text.pair_features on up to 20,000 values per column.
Limitations
- Trained on about eight relational databases, so schema habits can leak into scores.
- Needs overlapping values: it cannot match keys that were renamed or transformed.
- Scores are most useful for ranking within a schema, not as a calibrated probability.
Usage
pip install khaos
khaos serve ./tab_key_matching
License
This model was trained on data with research-only, share-alike or mixed terms (see the training dataset card for each source). Treat it as research use and check the upstream data licenses before any commercial use.