AI research · data management × language models

Structure you can check:
keys and ontologies from real databases

Both manuscripts grew out of building an enterprise ontology platform. They ask the same question from two sides: when a database becomes keys, relations and concepts, what can we trust, and how much model inference do we need? Read the methods, explore the results, and follow the equations back to the full papers.

MANUSCRIPTS IN PREPARATION · IEEE TKDE (CCF-A) · PAGE UPDATED 01 NOV 2026

Manuscript 1 · foreign-key discovery

RefSel: Risk-Controlled Foreign-Key Discovery with Bounded Language-Model Evidence

Jiamao Lin, Weisong Sun*
* Corresponding author · Nanyang Technological University

IEEE TKDE · manuscript in preparation for submission

A column can fit perfectly inside several integer keys and still tell us very little about which table it references. RefSel turns raw tables into candidate keys, scores their context, and decodes a consistent schema. Optional language-model evidence has a bounded role; a separate calibration step decides which discovered keys to retain.

The problem: inclusion is not a reference

Across 259 public databases, 80% of declared foreign keys target integer keys; 64% of those have a competing key that also contains every source value. Dense counters create accidental matches, while genuinely indistinguishable targets impose a limit on what values alone can identify.

The contribution: from local scores to a whole schema

A hypergeometric chance model measures inclusion significance. Two-pass relational scoring describes each candidate and its rivals; CP-SAT coordinates key choices across the database. Confidence shares probability among competing targets, and Learn-then-Test controls the expected false-discovery proportion of a retained subset.

METHOD · UPDATED MANUSCRIPT FIGURERefSel: raw relational tables pass through candidate generation, context scoring, joint decoding, confidence and calibrated retention.
Five components, one constrained decision. The optional model prior enters before decoding; the verifier checks the selected edges afterward. Diagram reproduced from the revised manuscript.

01.1The method, in equations

RefSel · Section 3
  1. STAGE 1Generate

    Find minimal unique column combinations; keep high-coverage semi-join candidates.

  2. STAGE 2Score

    Combine chance inclusion, source-group competition and relational context.

  3. STAGE 3Decode

    Select keys and references together under schema constraints.

  4. STAGE 4Share confidence

    Separate “a reference exists” from “this is the right target.”

  5. STAGE 5Calibrate & retain

    Choose a threshold on independent units, or abstain.

01How surprising is the overlap?

PrH0(X=i)=(Ni)(u−Nk−i)(uk)

The source has k distinct values, the target N, and the unrelated domain size is u. The score se = −log PrH₀(X ≥ m) measures the surprise of at least m matches. Conservative domain estimates prevent dense integer counters from looking artificially convincing.

02Bound the language-model contribution

teL=te+Bϖe,|ϖe|≤1

The prior can shift a queried candidate’s logit by at most B = 6. The exact decoder still enforces schema constraints; a second LLM pass can veto decoded edges. The frozen independent rounds query every source group; selective querying is used in the development/external setting.

03Choose a consistent schema jointly

max(x,y)∈C(D)∑T,κaTκxTκ+∑eteye

x selects a key (or none) for each table; y selects foreign keys. Constraints coordinate the target key, permit at most one target per source group, and exclude a mutual reverse pair. General cycles and self-references remain feasible. CP-SAT solves the whole database jointly.

04Share confidence among rivals

ce=π^g·ete∑f∈getf

Being sure a column references something does not identify its target. With a reference probability of 0.99 and two tied candidates, each gets 0.495. This motivates the ambiguity explorer below; calibration of the reference probability alone does not establish calibration of the product.

05Retain only a calibrated subset

Pr(R(τ^)≤α)≥1−δ

FDP = false retained keys / max(1, retained keys). Learn-then-Test chooses a threshold using independent calibration units; R is the expected unit-mean FDP. The predictor and threshold grid must be frozen and calibration/test units must follow the same distribution. This is not a bound for each individual database.

Definitions and assumptions: Section 3, including the identifiability and retention propositions. Stage 1 normally retains coverage ≥ 0.9, with explicitly defined low-cardinality and constant-source exceptions.

Equation explorer · illustrative

One plausible reference. Several indistinguishable targets.

Change the number of tied candidates to see how confidence must be shared.

Probability of some reference: 99%
Each candidate: 0.99 / ν

Target A49.5%confidence
Target B49.5%confidence

Assumption: the full observed data and features are invariant under exchanging these targets. Equal key values alone do not establish indistinguishability. Under this symmetry and an existing reference, target-selection accuracy is bounded by 1/ν.

2 indistinguishable targets: each receives 49.5% confidence. The conditional selection ceiling is 50%.

01.2What the experiments show

Frozen independent evaluation

The strongest transferable result is the value of bounded language-model evidence. On 60 unseen databases, adding the prior and verifier raises RefSel from 0.402 to 0.476 macro F1. The conventional-schema subset improves more; noisy WikiDBs snapshots are limited by candidate coverage and non-unique target labels.

Interactive result comparison

Compare like with like

Macro F1 · a fixed 0–1 axis · every value comes from the manuscript.

RefSel + LLMbounded prior + veto
0.476
RefSeldata only
0.402
LLM-FKsame backbone
0.430
RefSel-base + LLMinternal ablation
0.465
RefSel-baseinternal ablation
0.370

All 60 test databases; macro F1 against every declared foreign key. The two databases that LLM-FK could not process are counted as empty predictions. Use “Shared 58” for the matched comparison. Bounded LLM evidence improves RefSel by +0.074 (95% CI 0.025–0.121).

RefSel-base (labeled GBDT in the original figures) is an internal Stage-2 ablation. It shares RefSel’s candidate generator and CP-SAT decoder. It is not an external baseline.

Source: Table I & Section 5.7; Round-3 detailed table in the online appendix.

The matched LLM-FK comparison

0.467 vs. 0.445

On the shared 58 databases: ΔF1 +0.022, 95% CI [−0.012, +0.063], p = 0.19. The point estimate is higher; the overall difference is not statistically significant. Unique-target-key and anonymous-name comparisons are separate endpoints.

Model-call cost, original names

1,769 vs. 13,332

RefSel’s bounded prior + verifier uses 7.5× fewer calls and less than one-twentieth of the input tokens of the same-model LLM-FK rerun. These are Round-3 totals, not calls per database.

RESULTS · ROUND 3Round-3 macro F1 by database subset and calibrated retention under two calibration pools.
Accuracy and retention answer different questions. Panel (a) compares decoded F1; panel (b) shows a supplementary cross-calibration contrast. The registered P2 retention endpoint was not established by the saved report; changing the calibration pool changes both its size and its source composition.
More manuscript figures · ambiguity, names, cost and risk
MECHANISMInclusion significance by key type and accuracy versus value-equivalent targets.
Dense counters explain why perfect inclusion can carry little evidence. Anonymous target selection approaches the identifiability limit.
ROBUSTNESSMacro F1 under degraded names and synthetic distractor tables.
Name degradation and distractor tables are distinct stress tests; distractors also degrade calibrated risk control.
INFERENCE COSTF1 versus LLM calls on five external benchmarks.
External five-benchmark comparison; these call counts belong to a different collection than Round 3.
RISK & RETENTIONCorrect keys retained and unit-mean false-discovery proportion against target alpha.
Retention depends on both the score and the calibration distribution.
CASE STUDYSakila ambiguous columns under original and anonymized names.
Shared value sets create alternative targets; names and broader relational context can resolve only some ambiguities.

01.3How far the conclusion goes

Internal accuracy is not independent transfer

0.897 is the named BIRD/Spider cross-validation result. The separate 110-database test collection spans three frozen rounds. Stage-2 gains over RefSel-base are not significant on every new collection.

Risk control needs a matching calibration population

At α = 0.20, all reported lines in the three independent rounds stay below target. One Round-2 anonymous line reaches 0.122 at α = 0.10. Sparse ERP samples and synthetic distractors can break control transferred from clean data.

The registered retention endpoint remains unresolved

P2 specified RefSel-base with prior + verifier, but the saved retention report used edges decoded without the prior. The 0.55 → 1.97 retained-key contrast is supplementary and does not establish that registered endpoint.

A missing candidate cannot be recovered downstream

Empty tables, non-unique target keys and small seed datasets constrain value-based discovery. Declared-key labels can also miss genuine undeclared references. Report the ground-truth denominator alongside F1.

Source edition: revised manuscript and appendix · 29 Oct 2026Next paper ↓
Manuscript 2 · relational-to-ontology learning

What Matters in Relational-to-Ontology Learning?
Data Evidence, Completeness Guard, and Scoring

Jiamao Lin, Weisong Sun*

IEEE TKDE · manuscript in preparation for submission

Once prompts and outputs are complete, a larger model is not automatically a better ontology modeller. This study combines a zero-call data-profiling route with an LLM route and asks where each helps. The revised manuscript adds selective completeness guarding, tests the boundary created by missing keys, and measures mappings by the instance tuples they actually produce.

Data evidence provides a strong starting point

Det-v2 profiles unique column combinations, inclusion and functional dependencies, table roles, and value partitions. It builds classes, attributes and relations with no model call. With declared keys, its eight-database mean is 0.611, compared with 0.637–0.640 for the strongest whole-schema LLM configurations.

Completeness and scoring change the story

A table omitted from a prompt or truncated out of a response cannot contribute a complete mapping. Yet calling a model once per table repeats context and can change modelling conventions. A selective guard repairs omissions; an extent-based evaluator checks what the resulting ontology denotes.

METHOD · REVISED DUAL-ROUTE FRAMEWORKData profiling and rules form the evidence route; LLM generation and merging form the model route; pooling and risk control organize the results.
Two routes, explicit responsibilities. Deterministic data evidence supports the structural backbone; whole-schema, per-table or guarded generation supplies model proposals. Hybrid pooling and Cert are additional components, evaluated under their own experimental tracks.

02.1Four components you can inspect

Methods & measurement · Sections IV–V

01 · Det-v2: profile the data

Minimal approximate UCCs identify keys, high-coverage INDs suggest joins, and FD/value-partition rules suggest concept structure. Type-like discriminators and lexical cues constrain rule firing. TPC-H sf30 (2.6 × 10⁸ rows) runs end to end in 14 minutes at 26.8 GB peak RAM in the reported setup.

02 · Completeness guard: query only omissions

Start with a single whole-schema call, audit table coverage, and merge missing-table fragments behind the original mapping. Recovering a missing table should not overwrite an already coherent global choice.

03 · Cert: calibrate cross-source agreement

Pool unique elements, count distinct system arms and repeated samples, then calibrate a threshold at the database level. The theoretical risk bound depends on exchangeability; cross-benchmark agreement alone cannot supply it.

04 · Extent metric: execute before comparing

Compare the actual instance tuples produced by each mapping. Ordered relation endpoints make inverse relations distinguishable; one-to-one matching prevents multiple predictions from claiming the same gold element.

01Find omitted tables before making more calls

Tmiss=T(S)∖tbl(MWD)

A single whole-schema call produces MWD. The guard checks which schema tables are mentioned by any mapping element, then requests only the omitted tables. A link table represented as a relation already counts as covered.

02Measure agreement across sources

a(e)=narm(e)+12nsamp(e)SLLM

narm counts proposing system arms; nsamp counts proposing LLM samples. Cert thresholds this score using database-level Learn-then-Test. Agreement is useful for ranking review effort, but shared model errors do not become independent evidence.

03Let the whole-schema model win every conflict

Mguard=MWD∪{m∈MPT(Tmiss)∣κ(m)∉κ(MWD)}

The equivalence key κ identifies mapping elements. Fallback fragments fill omissions while preserving the original global modelling choices. The reported 1.12× guard is the minimal unmentioned-table version; stricter guards are separate variants.

04Score what a mapping actually denotes

J(e,g)=|⟦e⟧I∩⟦g⟧I||⟦e⟧I∪⟦g⟧I|,J(e,g)≥τ

Execute predicted element e and gold element g on data I. Classes yield key tuples, relations ordered subject–object pairs, and attributes subject–literal pairs. Maximum-weight one-to-one matching uses τ = 1 in the reported strict evaluation, making relation direction observable.

Source: Sections IV–V, manuscript Equations (1)–(3). The missing-table definition is shown separately here for readability.

02.2New results, with the comparison visible

Revised manuscript · 29 Oct 2026

The complete-DDL paired experiment compares whole-schema and per-table generation using three models, three runs each, and eight databases. Its fixed request and analysis plans were set before scoring, but this track was not pre-registered. It is separate from the main sample-row study.

Paired experiment · Table II

Does one call per table help?

Change in three-way mean F1: per-table minus whole-schema. Left is worse; right is better.

Lower F1 per tableHigher F1 per table
Qwen3.8-Max: per-table minus whole-schema F1Eight database means, three runs each. Left is worse with per-table generation; right is better. Exact values appear below the chart.−0.20−0.100.00+0.10+0.20Bgee6 tablesBgee: 0.00 three-way F10.00ODH8 tablesODH: −0.03 three-way F1−0.03ISWC9 tablesISWC: −0.02 three-way F1−0.02BSBM10 tablesBSBM: −0.06 three-way F1−0.06GTFS10 tablesGTFS: +0.01 three-way F1+0.01LUBM14 tablesLUBM: 0.00 three-way F10.00Mondial46 tablesMondial: +0.11 three-way F1+0.11NPD70 tablesNPD: −0.02 three-way F1−0.02
DATABASE
−0.200+0.20
ΔF1
Bgee6 tables
0.00
ODH8 tables
−0.03
ISWC9 tables
−0.02
BSBM10 tables
−0.06
GTFS10 tables
+0.01
LUBM14 tables
0.00
Mondial46 tables
+0.11
NPD70 tables
−0.02

Qwen3.8-Max: eight-database mean ΔF1 0.00; 95% bootstrap CI [−0.03, +0.03]. All three models’ intervals include zero. Non-significance does not establish equivalence.

Show exact class, relation and attribute scores
Qwen3.8-Max · class / relation / attribute F1. Published rounded values from Table II.
Database (tables)Whole-schemaPer-tableMean ΔF1
Bgee (6)0.57 / 0.63 / 0.570.57 / 0.63 / 0.580.00
ODH (8)0.35 / 0.45 / 0.780.35 / 0.39 / 0.75−0.03
ISWC (9)0.73 / 0.62 / 0.520.69 / 0.61 / 0.51−0.02
BSBM (10)1.00 / 0.76 / 0.951.00 / 0.57 / 0.96−0.06
GTFS (10)0.87 / 0.83 / 0.980.87 / 0.86 / 0.97+0.01
LUBM (14)0.07 / 0.26 / 0.110.08 / 0.24 / 0.110.00
Mondial (46)0.56 / 0.26 / 0.520.58 / 0.38 / 0.69+0.11
NPD (70)0.87 / 0.83 / 0.500.87 / 0.77 / 0.49−0.02

ΔF1 uses the paper’s reported rounded means. Recomputing it from separately rounded component scores can differ by 0.01.

Local wins do not imply a general gain. Mondial gains for Qwen and DeepSeek largely reflect key-column attribute conventions. NPD gains can repair truncated whole-schema outputs. The mean changes across models range from −0.03 to 0.00.

Source: Table II & Section VI-B3 · schema only, complete DDL, thinking off, temperature 0.

Selective completeness guard

Preserve the whole-schema answer. Fill the gaps.

Total input tokens relative to whole-schema generation; same paired archive.

Whole-schemaone call
1.00×
Selective guardunmentioned tables only
1.12×
Full per-tablerepeated local context
11.6×

The minimal guard triggers on 4 of 72 whole-schema calls (19 tables in total). Its eight-database mean F1 stays within 0.002 of the corresponding whole-schema result and is 0.003–0.029 higher than full per-table generation.

Measured on the paired archive. The guard audits whether any mapping element mentions a table. A stricter “class or attribute required” guard uses 2.1× tokens and can damage link-table modelling. The small trigger count limits broader reliability claims.

NEW RESULT · COMPLETENESS GUARDThe manuscript compares guard variants, per-database changes and the effect of enabling test-time reasoning.
The minimal guard preserves global choices. The first panel compares quality and input-token multiples. Stricter coverage rules can turn relation-like link tables into classes; enabling reasoning can exhaust output budgets. Asterisks mark post-hoc variants.

When declared keys are removed

0.35 vs. 0.53–0.60

On the pre-registered @stripped eight-database test, Det-v2 relation F1 falls from 0.56 to 0.35. Four LLM configurations retain 0.53–0.60, a +0.18 to +0.25 advantage (Holm p ≤ 0.005). This is relation F1, not the three-way mean above.

When relation direction is actually scored

−0.37 to −0.46

Instance-extent scoring lowers rule-system held-out relation F1 by 0.37–0.46 relative to direction-blind mapping scores; the LLM drop is about 0.12. The metric changes which systems lead on relations.

Model scale is a conditional result. Across seven non-NPD held-out schemas, 13 whole-schema configurations span 0.595–0.627 three-way F1. Including the 70-table NPD schema makes output completion a major source of separation. The 9,673-output census finds incompleteness rising from 0.2% on 1–5 tables to 27% on 51–100 tables.
NEW RESULTS · KEYS, NAMES & TRANSFERKey-removal boundary, synonym renaming test, convention-prompt transfer and realized risk on real databases.
Where data rules stop being sufficient. Removing declared keys exposes a semantic advantage for LLMs. Synonym renaming changes scores little, while convention-tuned prompts and risk thresholds calibrated on micro-scenarios transfer poorly to real schemas.
More revised manuscript figures · models, completeness, paired runs and measurement
MODEL SCALEMain and extension model comparisons with output-completion indicators.
Whole-schema model comparisons. The extension’s non-NPD band is narrow; the all-eight mean also reflects NPD completion.
INPUT & OUTPUT COMPLETENESSNPD results, incomplete-output frequency by schema size, and sub-schema stress tests.
Input filtering and output truncation are different failure mechanisms. The original input bug dropped 66 of 70 CREATE statements; corrected-input experiments isolate what remains.
CONTROLLED COMPARISONThree-model per-table differences by database, precision and recall shifts, and Mondial prompt-rule control.
The full paired comparison behind the interactive chart. Precision and recall reveal convention-dependent gains and losses.
MEASUREMENT & COSTExtent scoring changes, RODI query benchmarking, and token-quality frontier.
Mapping F1, instance-extent F1 and RODI query F1 answer different questions. Target-vocabulary access must be explicit in the RODI comparison.
DATABASE-LEVEL RESULTSSystem performance across the held-out database collection.
Per-database patterns make aggregate means interpretable. These main-study configurations are separate from the complete-DDL schema-only paired track.

02.3Interpretation, protocol and limits

Keep the experimental tracks separate

The main study uses sample rows; the paired experiment uses complete schema-only prompts and three models. Hybrid and Cert sources were not rerun under that paired protocol. The paper’s title now reflects this broader set of experiments.

Small numbers of databases limit general claims

Eight data-bearing held-out databases, including three generated databases, are the effective independent units. The guard fires on four calls. Non-significant differences do not demonstrate equivalence or universal model invariance.

Published baselines are not all rerun comparisons

Burr’s published Gemini 2.5 Pro values precede constraint corrections, while these runs and corrected Ontop/RDB2Onto rows use the corrected release. Baseline gains should retain that version qualification.

Agreement is not a guarantee under distribution shift

Cert controls risk under development calibration, but transferred thresholds exceed the target on real schemas. Shared convention errors break the calibration assumptions. Extent execution also finds 12 empty-extent gold defects; conversion checks establish agreement only on the available snapshots.

Scorer checks: zero disagreement on 640 main-study units and 222 paired mappings. Further protocol, conversion, licensing and reproducibility details: extended results.

Source edition: revised manuscript and extended report · 29 Oct 2026Full reading materials ↓
Read the full work

Papers, equations and evidence

The full text and original figures are available below. The interactive charts reproduce reported manuscript values; the confidence explorer illustrates the equation’s assumptions.

Page updated 01 Nov 2026 using the available 29 Oct manuscript revisions. No experiments were rerun for this page. Both papers remain manuscripts in preparation; the target venue is not a publication or acceptance claim.

From paper to practice

The wider research

These methods grew out of work on databases and ontology construction. Explore the related platform projects or return to my astronomy research.