Foundation Models in the Modern Data Stack

Ines Chami26 Jul 2023

Problem

Data teams hand-write SQL for business users' requests, clean data and link records across systems, for example customers in Salesforce and HubSpot that share no ID. Hand-written cleaning and linkage rules break on edge cases nobody foresaw. Foundation models can do these tasks from a prompt, but three things block production use: cost and latency at table scale, output that shifts with the prompt, and no knowledge of company definitions.

Solution in brief

Put each task into a few-shot prompt. Let a rule handle the easy ~80% of records and send only the rest to the model. Distill into a smaller model for big tables. Combine the answers of several prompts for stability. Add company definitions through continued pre-training or external memory (semantic layer, knowledge graph, document search).

Questions this case answers
  • How to automate rule-heavy data preparation with a general language model when per-record inference cost and non-deterministic output block production use
  • How to supply a general model with organization-specific definitions that are not present in the data itself
  • How to use a foundation model for SQL generation, data cleaning and record linkage without hand-writing brittle rules?
  • How to run an LLM over a table with millions of rows without paying for a call per row?

Tools and methods

  • Few-shot prompting: cleaning and linkage as a prompt with in-context examples, reused over all records
  • Rules plus model: a basic rule handles the easy cases, the model handles the last mile
  • Knowledge distillation: prototype with a large model, then teach a smaller one
  • Ask Me Anything (AMA) prompt aggregation: several prompts per input, predictions combined
  • Semantic layer, knowledge graph, document search: external memory for domain definitions
  • Text-to-SQL: SQL from a natural-language request
Continue reading — it's free

Google or a one-time email code. No password.