What Are Large Database Models? AI for SQL Data

Martin Keen introduces Large Database Models (LDMs), a new AI paradigm that brings advanced analytical capabilities directly into SQL and relational databases. This allows for semantic queries on the 99% of enterprise data traditionally locked away, enabling faster, more secure insights without costly data movement.

5 min read
What Are Large Database Models? AI for SQL Data
source: https://www.youtube.com/watch?v=uU1EP9_4qBU

The speaker introduces Large Database Models (LDMs), distinguishing them from Large Language Models (LLMs) and Large Reasoning Models (LRMs). While LLMs are trained on public text data, LDMs are trained directly on selected tables or views within a relational database. This addresses a critical challenge: an estimated 99% of enterprise data resides in relational databases, often behind security layers, making it inaccessible to traditional AI models. LDMs aim to bring AI directly to this vast, currently untapped data.

The Problem: Rigid Queries and Data Movement

Traditionally, to find patterns or similar entities (e.g., customers with similar behavior), a data scientist would craft a rigid SQL query based on guessed correlations (e.g., “WHERE age BETWEEN 20 AND 40 AND city = ‘New York’ AND beauty_spend > 1000”). This approach has several drawbacks:

  • Rigidity: The query relies on predefined filters, potentially missing other relevant correlations.
  • Slowness & Cost: It involves extracting data, loading it into analytics platforms, running analysis, and reporting, consuming significant IT budget (32-40% on data movement) and time.
  • Security & Governance: Moving data out of its secure, regulated database environment increases security risks and tracking complexity.

The LDM Solution: Semantic Queries in SQL

LDMs offer a paradigm shift by enabling semantic queries directly within SQL, eliminating the need for data movement. An LDM query for the same customer example would look like: “GIVE ME THE CUSTOMERS WHOSE IDS ARE MOST SIMILAR… TO this customer ID ACCORDING TO THE MODEL TRAINED ON this table”. This allows the database to answer based on learned relationships rather than explicit, hand-picked conditions.

The LDM leverages vector representations (embeddings), learning which values co-occur across selected columns and rows. This means the model intrinsically understands similarity without a human needing to guess relevant fields (e.g., gender, time of day, return history). It can also combine these semantic capabilities with standard SQL WHERE clauses for further filtering.

How Large Database Models Work: A 5-Step Process

LDMs integrate AI functionality directly into the database through a structured process:

  1. Pick a Table and Classify Columns:

    • Select a relational database table (e.g., customer list, transaction log).
    • Identify a key column (e.g., customer ID).
    • Classify other columns as categorical (discrete values like state) or numeric (continuous values like age or price).
  2. Tokenization and Embeddings:

    • Every value is turned into a token, forming the basis for embeddings.
    • Categorical values retain their labels (e.g., “New York”).
    • Numeric values are first binned using a clustering algorithm. For example, ages 37 and 38 might fall into the same bucket, effectively becoming the same token to the model, guiding it on numerical proximity. This overcomes the model’s lack of inherent numerical understanding and handles rare continuous values.
    • Crucially, each value is tagged with its column name (e.g., “City: New York” vs. “Birthplace: New York”) to avoid confusing identical strings with different meanings.
  3. Row as a Sentence (Bag of Words):

    • Each database row is treated as an “unordered sentence” or “bag of words”.
    • Every token in the row has an equal relationship, regardless of its original column position.
    • Tokens combine column names with values (e.g., city New York, age b7 (bucket 7 for age), gender f, spend b12, category beauty).
  4. Training:

    • A self-supervised neural network reads through all these “row sentences”.
    • It learns a unique vector (embedding) for each token in its vocabulary.
    • Values that frequently appear together in similar rows end up with vectors close to each other in the embedding space (e.g., cities where customers exhibit similar purchasing patterns will cluster).
  1. Exposing Vectors via SQL:
    • The trained model is loaded back into the database.
    • This enables new types of queries directly within standard SQL:
      • Similarity: “Which customers are most like this one?”
      • Dissimilarity: “Which transactions deviate most from the normal pattern?”
      • Clustering: “Where does this product belong among a group of reference products?”
      • Analogy: “Does this relationship resemble another relationship?”
      • Commonality: “Which records show unusually common or uncommon patterns?”
    • All these operations run in situ against the database, keeping data in place.

Key Advantages and Use Cases

The core benefits of LDMs are:

  1. Data In-Place Processing: The AI model runs where the data already lives, eliminating costly and risky data movement.
  2. Accessibility for Non-Experts: Anyone proficient in SQL can ask complex semantic questions without requiring a data scientist to build an extensive data pipeline.

Real-world applications span various industries:

  • Insurance: Retrieving similar past contracts to predict successful quotes; flagging fraudulent transactions.
  • Contract Management: Identifying contracts that stand out from a portfolio.
  • Food and Retail: Product similarity search, such as finding nutritionally similar items (e.g., oatmeal to toffee-covered almonds).

Commercial Implementations

IBM launched the first database product built around an LDM, SQL Data Insights, in 2022 as part of DB2 for ZOS. A follow-up, SQL Data Insights Pro, is slated for March 2026. This professional version extends the approach to unstructured text alongside structured columns and introduces incremental model refresh, allowing the model to update with new data without retraining from scratch.

Share post

Stay In The Loop! Subscribe to Our Newsletter.

Get updates straight to your inbox. No spam, just useful content.

Recommended for You

6 Things to Know about AIE World's Fair 2026

6 Things to Know about AIE World's Fair 2026

Discover the AI Engineering World's Fair 2026, the largest iteration yet, offering an unparalleled deep dive into AI engineering with expanded tracks on auto research, GPU specialization, and new verticals like finance and healthcare. Highlights include an innovative expo experience, exclusive leadership initiatives like the "Token Billionaires Program," and unique side events fostering community, including "Posters on AI" where attendees can defend their tweets. This event is designed to be a curated hub for practical, cutting-edge insights and networking in the AI/ML professional landscape.

This AI Company Catches Fraud Across the Internet

This AI Company Catches Fraud Across the Internet

Variance, emerging from three years in stealth with a $21 million Series A, is transforming enterprise risk and compliance through purpose-built AI agents. Founded by ex-Apple engineers, the company automates complex tasks like fraud detection, content review, and identity verification for Fortune 500s and platforms such as GoFundMe. They discuss the strategic reasons for stealth, technical challenges of integrating disparate data sources (including UI scraping), the shift from legacy systems to self-healing AI agent architectures, and how their lean, AI-maximalist team detects sophisticated threats like state-sponsored fraud rings.