Integrating Foundation Models into the Modern Data Stack: Challenges and Solutions

numbers_station · Tech · 2023 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Foundation-model automation for data engineering workflows

Numbers Station wanted to bring foundation models into the modern data stack to reduce manual data engineering work across SQL generation, data cleaning, and record linkage. The hard production issues were scale, prompt brittleness, deterministic-output expectations, and enterprise domain knowledge that generic pretrained models do not know.

Constraints:

Architecture

Numbers Station frames data tasks as generation problems handled by foundation models with prompts and in-context examples. SQL generation translates natural-language business questions into queries; data cleaning applies example-driven transformations; and data linkage compares records across systems in natural language. For scale, the talk recommends composing rules with foundation models, using the model only for last-mile complex cases, and distilling prototypes into smaller task models. For brittleness, it proposes multiple prompts with aggregated predictions, prompt decomposition, and careful demonstration sampling. For missing domain knowledge, it proposes continual pretraining on organizational artifacts and inference-time retrieval through knowledge graphs, semantic layers, or internal-document search.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  Modern_data_stack_sources["Modern data stack sources"] --> Data_warehouse["Data warehouse"]
  Data_warehouse --> dbt_transformation_layer["dbt transformation layer"]
  dbt_transformation_layer --> Business_intelligence_layer["Business intelligence layer"]
  Business_user["Business user"] --> SQL_generation_prompts["SQL generation prompts"]
  SQL_generation_prompts --> Foundation_model["Foundation model"]
  Data_warehouse --> Data_cleaning_prompts["Data cleaning prompts"]
  Data_cleaning_prompts --> Foundation_model
  Modern_data_stack_sources --> Data_linkage_prompts["Data linkage prompts"]
  Data_linkage_prompts --> Foundation_model
  Foundation_model --> Rule_composition_layer["Rule composition layer"]
  Foundation_model --> Model_distillation_pipeline["Model distillation pipeline"]
  Foundation_model --> Multi_prompt_aggregation["Multi-prompt aggregation"]
  Domain_knowledge_layer["Domain knowledge layer"] --> SQL_generation_prompts
  Domain_knowledge_layer --> Continual_pretraining_corpus["Continual pretraining corpus"]
  Continual_pretraining_corpus --> Foundation_model
  Domain_knowledge_layer --> External_memory["External memory"]
  External_memory --> Foundation_model
  Business_intelligence_layer --> Business_user
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Modern data stack sources Operational systems such as Salesforce and HubSpot where enterprise data originates. Data warehouse, Data linkage prompts
Data warehouse Storage layer such as Snowflake where extracted data is available for transformation and analysis. Modern data stack sources, dbt transformation layer, SQL generation prompts, Data cleaning prompts
dbt transformation layer Transformation and modeling layer in the modern data stack. Data warehouse, Business intelligence layer
Business intelligence layer Visualization layer such as Tableau or Power BI for consuming prepared data. dbt transformation layer, Business user
Business user Asks natural-language business questions and consumes answers rather than manually iterating with data engineers. SQL generation prompts, Business intelligence layer
Foundation model Large pretrained model reused across SQL generation, cleaning, linkage, and domain-knowledge augmented tasks. SQL generation prompts, Data cleaning prompts, Data linkage prompts, Rule composition layer, Model distillation pipeline, Multi-prompt aggregation, External memory
SQL generation prompts Cast natural-language data questions as generation tasks that produce SQL. Business user, Foundation model, Domain knowledge layer
Data cleaning prompts Use a few examples of correct transformations to clean typos, missing values, or formats. Data warehouse, Foundation model, Rule composition layer
Data linkage prompts Compare record pairs across sources without shared IDs using natural language. Modern data stack sources, Foundation model, Rule composition layer
Rule composition layer Uses simple rules for easy cases and calls the foundation model for complex last-mile examples. Foundation model, Data cleaning prompts, Data linkage prompts
Model distillation pipeline Uses a large model prototype to train a smaller task model for scalable prediction. Foundation model, Rule composition layer
Multi-prompt aggregation Applies multiple prompts and aggregates predictions to reduce prompt brittleness. Foundation model
Domain knowledge layer Represents organizational definitions and context needed for enterprise data tasks. SQL generation prompts, Continual pretraining corpus, External memory
Continual pretraining corpus Organizational documents, logs, and metadata used to adapt open-source models at training time. Domain knowledge layer, Foundation model
External memory Inference-time retrieval through knowledge graphs, semantic layers, or internal-document search indexes. Domain knowledge layer, Foundation model

Data flow

Data originates in systems such as Salesforce or HubSpot, is loaded into warehouses such as Snowflake, transformed with tools like dbt, and visualized in Tableau or Power BI. Foundation-model applications sit across this stack: business questions become SQL prompts, cleaning examples become transformation prompts, and record pairs become linkage prompts. Simple cases can be handled by rules, while complex last-mile cases call the foundation model. Training-time domain adaptation uses organizational documents, logs, and metadata for continual pretraining, while inference-time augmentation retrieves domain knowledge from knowledge graphs, semantic layers, or search indexes.

4 supporting quotes
“the data gets extracted and loaded in data warehouses like snowflake it can then be transformed and modeled using tools like DBT”transcript, stated
“with these Foundation models a lot of this back and forth can be avoided by using the model to generate the SQL queries from natural language requests”transcript, stated
“the idea is to feed both records to the model and then ask it are these two things the same in natural language”transcript, stated
“augmenting the foundation model with some external memory that can be either accessed through a knowledge graph a semantic layer or a search index over the the internal documents”transcript, stated

Why this architecture

The architecture composes foundation models with rules, distillation, prompt aggregation, and domain-knowledge retrieval because the data-stack setting is both high-scale and high-precision. Foundation models are flexible enough to prototype SQL, cleaning, and linkage tasks from prompts, but applying them naively to whole databases is too slow and expensive, prompts are brittle, and generic pretraining misses enterprise definitions. The result is a hybrid system: rules handle easy cases, models handle ambiguous last-mile cases, distilled models scale successful prototypes, and domain knowledge is injected at training or inference time.

3 supporting quotes
“if there's some very basic rule that can solve 80 of the problem we should use it but then for these last mile examples that are more complex we can call the foundation model”transcript, stated
“depending on the application and how we use them they can be very expensive and slow”transcript, stated
“Foundation models are trained on public data and they lack some knowledge that is sometimes uh crucial to solving Enterprise data tasks”transcript, stated

Models used: foundation models · autoregressive language models · smaller distilled models · continually pretrained open-source models

Scale

Alternatives considered (roads not taken)

Manual SQL requests through data engineering teams

Rejected because: The traditional workflow requires back-and-forth iterations and can take a long time, while foundation models can generate SQL from natural-language requests for simpler cases.

“anytime a business user needs to answer a business question they have to send a request to their data engineering team”transcript, stated
“a lot of this back and forth can be avoided by using the model to generate the SQL queries from natural language requests”transcript, stated

Handcrafted SQL rules for all cleaning and linkage cases

Rejected because: Rules are slow to develop and brittle on edge cases, so Numbers Station composes rules with foundation models for the last mile.

“it's a very long process uh to derive all the cleaning logic and many times the rules break because of some Edge case”transcript, stated
“the best solution is to compose rules with the foundation model”transcript, stated

Call a large foundation model on every row

Rejected because: For whole-database prediction over millions or billions of rows, this is too expensive and slow compared with rules or distilled models.

“I need to use the model itself to make the predictions on let's say an entire database that has millions or billions of rows”transcript, stated
“this is just impossible and it's going to be extremely expensive extremely slow compared to using a rule-based solution”transcript, stated

Rely on a single prompt format

Rejected because: Formatting and demonstration choice can change predictions, so the talk recommends multi-prompt aggregation, prompt decomposition, and careful demonstration sampling.

“if we format a prompt differently it will predict two different responses in this cleaning task”transcript, stated
“apply multiple prompts to the input and then aggregate the predictions to get the final results”transcript, stated

Use the public pretrained model without enterprise domain context

Rejected because: Enterprise data tasks often require organizational definitions and metadata, so the talk proposes continual pretraining and inference-time external memory.

“Foundation models are trained on public data and they lack some knowledge that is sometimes uh crucial to solving Enterprise data tasks”transcript, stated
“there are two types of solutions inference time and training time”transcript, stated

Patterns

prompt-chaining (prompting)

The talk recommends decomposing prompts with chains to reduce prompt brittleness in deterministic data applications.

“other solutions to address this prompt brittleness issue such as decomposing the prompts with chains”transcript, stated

model-distillation (modeling)

Numbers Station uses the large foundation model for prototyping and then teaches a smaller model to perform scalable data tasks.

“take the big model for prototyping and then use that big model to teach a smaller model to do the task”transcript, stated
“we can easily bridge the gap between these large and smaller distilled models”transcript, stated

cost-aware-routing (operations)

The system routes easy records to rules and reserves foundation-model calls for complex last-mile examples where model reasoning is needed.

“only use the foundation models only when we really need to so if the task is simple enough that it can be solved with a rule we don't need to use the model itself”transcript, stated
“for these last mile examples that are more complex we can call the foundation model”transcript, stated

rag-retrieval (retrieval)

For domain knowledge gaps, the talk proposes adding inference-time external memory from a knowledge graph, semantic layer, or search index.

“bring the knowledge at inference time by augmenting the foundation model with some external memory”transcript, stated
“accessed through a knowledge graph a semantic layer or a search index over the the internal documents”transcript, stated

fine-tuning-adaptation (modeling)

For training-time domain knowledge, Numbers Station proposes continually pretraining open-source models on organizational artifacts.

“continually pre-train open source models on this data to make them aware of this domain knowledge”transcript, stated

human-in-the-loop-gate (workflow)

The talk distinguishes SQL copilot use cases where a human remains in the loop and latency matters more than bulk throughput.

“if I'm using a foundation model with a human in the loop for things like SQL co-pilot then the scale is not so much an issue we care more about latency”transcript, stated

Tradeoffs

Compose rules with the foundation model.

Chose rules for simple cases and foundation models for complex last-mile examples over foundation-model calls for every record.

Rationale: This keeps cost and latency practical while preserving model flexibility for cases where rules are brittle.

“if the task is simple enough that it can be solved with a rule we don't need to use the model itself to solve the task”transcript, stated
“but then for these last mile examples that are more complex we can call the foundation model”transcript, stated

Use model distillation for scalable bulk tasks.

Chose large model for prototyping and smaller distilled model for task execution over running the large foundation model directly across huge databases.

Rationale: The large model is useful for prototyping and teaching, but direct row-level use is too slow and expensive at database scale.

“the idea is to take the big model for prototyping and then use that big model to teach a smaller model to do the task”transcript, stated
“millions or billions of rows this is just impossible and it's going to be extremely expensive extremely slow”transcript, stated

Use external memory at inference time for enterprise knowledge.

Chose knowledge graph, semantic layer, or search index augmentation over expecting the public pretrained model to know organization-specific definitions.

Rationale: Domain knowledge changes by organization and often lives in internal artifacts, so retrieval-time augmentation can provide context without retraining for every query.

“bring the knowledge at inference time by augmenting the foundation model with some external memory”transcript, stated
“there might not be a perfect is active column and then what I need to do is rely on some organizational knowledge”transcript, stated

Continually pretrain open-source models for domain knowledge.

Chose training-time adaptation on documents, logs, and metadata over only adding context at inference time.

Rationale: Some enterprise knowledge can be embedded into model weights by leveraging untapped organizational data, while inference-time retrieval remains another option.

“Leverage The untapped knowledge that is stored uh in organizations documents logs metadata”transcript, stated
“continually pre-train open source models on this data to make them aware of this domain knowledge”transcript, stated

Aggregate multiple prompts for brittle tasks.

Chose apply multiple prompts and aggregate predictions over trusting a single prompt/demonstration set.

Rationale: Multiple prompts reduce sensitivity to prompt formatting and example choice in workflows where users expect deterministic behavior.

“apply multiple prompts to the input and then aggregate the predictions to get the final results”transcript, stated
“picking uh manual demonstrations versus random demonstrations had a huge performance Gap”transcript, stated

Gotchas (what bit them)

Foundation models worked well for simple SQL but lacked enterprise domain knowledge for complex queries.

Root cause: Generic pretrained models do not know organization-specific meanings such as which date column or active-customer definition to use.

Resolution: Numbers Station proposes injecting domain knowledge through continual pretraining or inference-time external memory.

“this works amazingly well for simple queries but there are some caveats to use this for more complex queries especially for complex query when there's some domain specific knowledge”transcript, stated
“if there's multiple date columns in my table which one am I supposed to use that's not something that the models know out of the box”transcript, stated

Rule-based data cleaning is slow to build and breaks on unseen cases.

Root cause: Manual SQL rule development has to anticipate edge cases across messy enterprise data.

Resolution: Use in-context examples so a foundation model derives patterns automatically, and compose rules with the model for the hardest cases.

“it's a very long process uh to derive all the cleaning logic and many times the rules break because of some Edge case that was not captured”transcript, stated
“the model can derive the patterns automatically from the in context examples that we provide”transcript, stated

Calling a large model across an entire database is not viable.

Root cause: Foundation models are large, slow, and expensive, especially for millions or billions of row-level predictions.

Resolution: Distill successful prototypes into smaller models and use rules where rules solve simple cases.

“Foundation models are extremely large models and depending on the application and how we use them they can be very expensive and slow”transcript, stated
“entire database that has millions or billions of rows this is just impossible and it's going to be extremely expensive extremely slow”transcript, stated

Prompt brittleness is especially problematic in data workflows.

Root cause: Small changes in prompt formatting or example selection can change predictions, while data-stack users expect deterministic outputs.

Resolution: Apply multiple prompts and aggregate predictions, decompose prompts into chains, and sample demonstrations carefully.

3 supporting quotes
“if we format a prompt differently it will predict two different responses in this cleaning task”transcript, stated
“users are used to deterministic outputs which is the case in the modern data stack they're not comfortable with potential errors in brittleness”transcript, stated
“apply multiple prompts to the input and then aggregate the predictions to get the final results”transcript, stated

Data linkage lacks common join keys.

Root cause: Systems such as Salesforce and HubSpot may represent the same customer without a shared identifier.

Resolution: Feed both records to a foundation model and ask in natural language whether they refer to the same entity, using rules for simple cases.

“there's no ID to create a join on and similar to data cleaning Engineers need to spend long iteration Cycles crafting rules”transcript, stated
“feed both records to the model and then ask it are these two things the same in natural language”transcript, stated

Evaluation

The talk reports qualitative research and experiment findings rather than a production KPI dashboard. Evaluation signals include observed behavior on SQL generation, data cleaning, data linkage, prompt-format perturbations, manual versus random demonstrations, and comparison of large models to distilled smaller models. It mentions performance gaps and improvements from multi-prompt aggregation but does not disclose numeric scores.

Metrics: prompt-format sensitivity · manual versus random demonstration performance gap · prediction aggregation improvement · scale feasibility on millions or billions of rows · latency for human-in-the-loop SQL copilot use · large-versus-distilled model gap

3 supporting quotes
“we run an experiment and we saw that picking uh manual demonstrations versus random demonstrations had a huge performance Gap”transcript, stated
“this worked quite well we noticed some good improvements compared to the traditional prompting method”transcript, stated
“this actually works really well uh with good prototypes and good fine-tuning and we can easily bridge the gap”transcript, stated

Outcomes

The talk is a 10-minute lightning presentation and does not disclose deployment volume, customer count, latency numbers, or production KPI deltas. Its concrete scale claims are qualitative except for rule coverage around 80% of some problems and the infeasibility of direct model calls across millions or billions of rows.

3 supporting quotes
“we're bringing this Foundation model technology into the modern data stack to accelerate time to insights”transcript, stated
“we can create prompts for the specific data linkage task and alleviate some of these issues”transcript, stated
“there's many more just I just had to scope it for this lightning talk”transcript, stated