Building and deploying LLM applications with Apache Airflow

Kaxil Naik
Kaxil NaikDirector of Airflow Engineering team @ Astronomer en Astronomer
Building and
deploying LLM
applications with
Apache Airflow
Kaxil Naik
Apache Airflow Committer & PMC Member
Director of Eng @ Astronomer
Julian LaNeve
Senior Product Manager @
Astronomer
Why Airflow should be at the centre of LLMOps?
Real Use-case & reference architecture
Next Steps: Community collaboration
Agenda
A powerful new class of large
language models is making it
possible for machines to
write, code, draw, and create
with credible and sometimes
superhuman results.
Generative AI:
A Creative New World
Normally, for ML, you need to…
Ingest Data Train Model Prediction
…but now you can
You hit a pre-trained model
instead of your own model
…but now you can:
Ingest Data Train Model Prediction
Less Data
Building and deploying LLM applications with Apache Airflow
■ Ingestion from several sources
■ Day 2 operations on data pipelines
■ Data preparation
■ Data privacy
■ Data freshness
■ Model deployment & monitoring
■ Scaling Models
■ Experimentation & fine-tuning
■ Feedback Loops
Going from “Idea to Production” with LLM Apps involves
solving a lot of data engineering problems:
Source: https://python.langchain.com/docs/use_cases/question_answering/
Typical Architecture for Q&A use-case using LLM
Legacy Data Store
Retrieval Output
Storage
Splitting
Document Loading
Vectorstore
Database
PDFs
URLs
LLM <Answer>
Prompt
Splits
Relevant
Splits
Query
<Question>
Python Native
The language of data scientists and
ML engineers.
Pluggable Compute
GPUs, Kubernetes, EC2, VMs etc.
Common Interface
Between Data Engineering, Data
Science, ML Engineering and
Operations.
Data Agnostic
But data aware.
Extensible
Standardize custom operators and
templates for common DS tasks
across the organization.
Monitoring & Alerting
Built in features for logging,
monitoring and alerting to external
systems.
Ingestion
Extract and load data into
vectordbs and other destinations
Day 2 Ops
Handle retries, dependencies, and
all other day 2 ops associated with
data pipelines
Airflow is a Natural Fit…
Document Parsing
Decorator and pythonic interfaces
for standard LLM tools
Let’s Talk About a
Real Use Case
Problem Statement:
We have customers, employees, and community members
that ask questions about our product with answers that
exist across several sources of documentation.
How do we provide an easy interface for folks to
get their questions answered without adding
further strain to the team?
Building and deploying LLM applications with Apache Airflow
■ Airflow gives a framework to load data
from APIs & other sources into LangChain
■ LangChain helps pre-process and split
documents into smaller chunks
depending on content type
■ After content is split into chunks, each
chunk is embedded into vectors (semantic
representations)
■ Those vectors are written to Weaviate for
later retrieval
Data Ingestion, Processing, and Embedding
Embed chunks Write to Weaviate
Pre-process and split into
chunks
🦜🔗 LangChain
Docs (.md)
files
Slack
Messages
GitHub
issues
Docs (.md)
files
Users can interact with UI or
Slack Bot; they both use the
same API
■ Original prompt gets reworded 3x using gpt-3.5-turbo
■ Answer is generated by combining docs from each prompt
and making a gpt-4 call
■ State is stored in Firestore and prompt tracing is done through
LangSmith
🦜🔗LangChain
User Asks
a Question
Web App
Slack Bot
Original Prompt Rewording 2
Rewording 1
Rewording 3
Reword to get more
related documents
Vector DB search
with prompts
Combine docs
and make final
LLM call to
answer
🦜
🔗
Prompt Orchestration and Answering
■ Airflow DAGs process feedback async to evaluate answers on helpfulness,, relevance,
and publicness
■ If answer is good, it gets stored in Weaviate and can be used as a source for future
questions
■ UI also shows the most recent good prompts on the homepage
When a user submits feedback, it
gets stored in Firestore and
LangSmith for later use
User Rates
Answer
🦜
🔗
Fetch new runs: input,
output, and user feedback
Classify Q&A according
to helpfulness,
relevance, and public
🦜🔗 LangChain
If good answer, write to
vector DB to use in future
answers
If good answer, mark as
good to show on Ask Astro
homepage
On schedule
LLM & Product Feedback Loops
Running this in production meant:
■ Experimenting with different sources of data to ingest
■ Running the pipelines on a schedule and ad-hoc
■ Running the same workloads with variable chunking
strategies
■ Needing to retry tasks due to finicky python libraries and
unreliable external services
■ Giving different parts of the workload variable compute
■ Creating standard interfaces to interact with external
systems
■ Experimenting with different sources of data to ingest
■ Running the pipelines on a schedule and ad-hoc
■ Running the same workloads with variable chunking
strategies
■ Needing to retry tasks due to finicky python libraries and
unreliable external services
■ Giving different parts of the workload variable compute
■ Creating standard interfaces to interact with external
systems
Running this in production meant:
Which is
what
Airflow’s
great at!
ask.astronomer.io
github.com/astronomer/ask-astro
a16z’s Emerging LLM App Stack
Orchestration
(Python/DIY,
LangChain,
LlamaIndex,
ChatGPT)
APIs/Plugins
(Serp, Wolfram,
Zapier, etc.)
App Hosting
(Vercel, Steamship,
Streamlit, Modal)
Query
Output
Prompt
Few-shot
examples
Contextual
data
Playground
(OpenAI, nat.dev,
Humanloop)
Data Pipelines
(Databricks, Airflow,
Unstructured, etc.)
Embedding Model
(OpenAI, Cohere,
Hugging Face)
Vector Database
(Pinecone, Weaviate,
Chroma, pgvector)
LLM Cache
(Redis, SQLite,
GPTCache)
Logging/LLMops
(Weights & Biases, MLflow,
PromptLayer, Helicone)
Validation
(Guardrails, Rebuff,
Guidance, LMQL)
Proprietary API
(OpenAI, Anthropic)
Open API
(Hugging Face, Replicate)
Opinionated Cloud
(Databricks, Anyscale,
Mosaic, Modal, Runpod)
Cloud Provider
(AWS, GCP, Azure,
Coreweave)
LLM APIs and Hosting
Gray boxes show key components of the stack, with leading tools /
systems listed. Arrows show the flow of data through the stack.
Contextual data provided by app developers to condition
LLM outputs
Prompts and few-shot examples that are sent to the LLM
Queries submitted by users
Output returned to users
Legend
AskAstro has a few parts of this…
Orchestration
(Python/DIY,
LangChain,
LlamaIndex,
ChatGPT)
APIs/Plugins
(Serp, Wolfram,
Zapier, etc.)
App Hosting
(Vercel, Steamship,
Streamlit, Modal)
Query
Output
Prompt
Few-shot
examples
Contextual
data
Playground
(OpenAI, nat.dev,
Humanloop)
Data Pipelines
(Databricks, Airflow,
Unstructured, etc.)
Embedding Model
(OpenAI, Cohere,
Hugging Face)
Vector Database
(Pinecone, Weaviate,
Chroma, pgvector)
LLM Cache
(Redis, SQLite,
GPTCache)
Logging/LLMops
(Weights & Biases, MLflow,
PromptLayer, Helicone)
Validation
(Guardrails, Rebuff,
Guidance, LMQL)
Proprietary API
(OpenAI, Anthropic)
Open API
(Hugging Face, Replicate)
Opinionated Cloud
(Databricks, Anyscale,
Mosaic, Modal, Runpod)
Cloud Provider
(AWS, GCP, Azure,
Coreweave)
LLM APIs and Hosting
Gray boxes show key components of the stack, with leading tools /
systems listed. Arrows show the flow of data through the stack.
Contextual data provided by app developers to condition
LLM outputs
Prompts and few-shot examples that are sent to the LLM
Queries submitted by users
Output returned to users
Legend
Airflow is
foundational
to best
practices for
all of this.
Data Governance
■ How do you account for private data?
■ How do you provide transparency into data lineage?
Fine Tuning
■ Does it improve results?
■ How much does it cost?
Feedback Loops
■ Semantic cache for correct responses
■ Ranking sources based on accuracy and ranking accordingly
■ Prompt clustering – what are people asking?
…but there’s even more to consider.
Michael Gregory
Philippe Gagnon
Thanks to the AskAstro Team:
Community Collaboration
Providers Interfaces
Patterns and
Use Cases
What are all the providers the ecosystem needs?
pgvector
What’s the
interface that
feels right for
LLMOps?
What’s the
interface that
feels right for
LLMOps?
Patterns
What are the
best practices
for building
pipelines for
LLM Apps?
■ Do you use one task to ingest and write?
■ Can you use dynamic task mapping to break it out?
■ Do you write to disk?
■ Can you store embedding values in XCOMs?
■ How do you reconcile Airflow orchestration with
prompt orchestration?
Let’s do this all in the open source!
1 de 29

Recomendados

Regulating Generative AI - LLMOps pipelines with Transparency por
Regulating Generative AI - LLMOps pipelines with TransparencyRegulating Generative AI - LLMOps pipelines with Transparency
Regulating Generative AI - LLMOps pipelines with TransparencyDebmalya Biswas
230 vistas16 diapositivas
Build an LLM-powered application using LangChain.pdf por
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfStephenAmell4
915 vistas22 diapositivas
LanGCHAIN Framework por
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN FrameworkKeymate.AI
1.4K vistas19 diapositivas
Large Language Models Bootcamp por
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models BootcampData Science Dojo
3.3K vistas15 diapositivas
LLMs_talk_March23.pdf por
LLMs_talk_March23.pdfLLMs_talk_March23.pdf
LLMs_talk_March23.pdfChaoYang81
85 vistas160 diapositivas
Fine tuning large LMs por
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMsSylvainGugger
2.4K vistas25 diapositivas

Más contenido relacionado

La actualidad más candente

Generative Models and ChatGPT por
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPTLoic Merckel
643 vistas19 diapositivas
Fine tune and deploy Hugging Face NLP models por
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsOVHcloud
952 vistas26 diapositivas
MLOps in action por
MLOps in actionMLOps in action
MLOps in actionPieter de Bruin
1.6K vistas23 diapositivas
Best Practice on using Azure OpenAI Service por
Best Practice on using Azure OpenAI ServiceBest Practice on using Azure OpenAI Service
Best Practice on using Azure OpenAI ServiceKumton Suttiraksiri
517 vistas45 diapositivas
LLMs Bootcamp por
LLMs BootcampLLMs Bootcamp
LLMs BootcampFiza987241
128 vistas12 diapositivas
Llama-index por
Llama-indexLlama-index
Llama-indexDenis973830
2.1K vistas14 diapositivas

La actualidad más candente(20)

Generative Models and ChatGPT por Loic Merckel
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
Loic Merckel643 vistas
Fine tune and deploy Hugging Face NLP models por OVHcloud
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP models
OVHcloud952 vistas
LLMs Bootcamp por Fiza987241
LLMs BootcampLLMs Bootcamp
LLMs Bootcamp
Fiza987241128 vistas
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in... por David Talby
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
David Talby655 vistas
Apply MLOps at Scale by H&M por Databricks
Apply MLOps at Scale by H&MApply MLOps at Scale by H&M
Apply MLOps at Scale by H&M
Databricks1K vistas
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT! por taozen
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
taozen1K vistas
Unlocking the Power of Generative AI An Executive's Guide.pdf por PremNaraindas1
Unlocking the Power of Generative AI An Executive's Guide.pdfUnlocking the Power of Generative AI An Executive's Guide.pdf
Unlocking the Power of Generative AI An Executive's Guide.pdf
PremNaraindas12.2K vistas
Large Language Models - Chat AI.pdf por David Rostcheck
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdf
David Rostcheck677 vistas
10 more lessons learned from building Machine Learning systems por Xavier Amatriain
10 more lessons learned from building Machine Learning systems10 more lessons learned from building Machine Learning systems
10 more lessons learned from building Machine Learning systems
Xavier Amatriain180.1K vistas
Benchmark comparison of Large Language Models por Matej Varga
Benchmark comparison of Large Language ModelsBenchmark comparison of Large Language Models
Benchmark comparison of Large Language Models
Matej Varga144 vistas
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor... por DianaGray10
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
DianaGray10305 vistas
AI and ML Series - Introduction to Generative AI and LLMs - Session 1 por DianaGray10
AI and ML Series - Introduction to Generative AI and LLMs - Session 1AI and ML Series - Introduction to Generative AI and LLMs - Session 1
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
DianaGray101.2K vistas
Neural Language Generation Head to Toe por Hady Elsahar
Neural Language Generation Head to Toe Neural Language Generation Head to Toe
Neural Language Generation Head to Toe
Hady Elsahar101 vistas

Similar a Building and deploying LLM applications with Apache Airflow

Boulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading por
Boulder/Denver BigData: Cluster Computing with Apache Mesos and CascadingBoulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading
Boulder/Denver BigData: Cluster Computing with Apache Mesos and CascadingPaco Nathan
4.9K vistas87 diapositivas
Technology Stack Discussion por
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack DiscussionZaiyang Li
586 vistas25 diapositivas
Why apache Flink is the 4G of Big Data Analytics Frameworks por
Why apache Flink is the 4G of Big Data Analytics FrameworksWhy apache Flink is the 4G of Big Data Analytics Frameworks
Why apache Flink is the 4G of Big Data Analytics FrameworksSlim Baltagi
30.7K vistas118 diapositivas
System design for Web Application por
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
2.5K vistas5 diapositivas
Integrating Splunk into your Spring Applications por
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsDamien Dallimore
11.2K vistas68 diapositivas
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... por
 MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...Databricks
1.7K vistas41 diapositivas

Similar a Building and deploying LLM applications with Apache Airflow(20)

Boulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading por Paco Nathan
Boulder/Denver BigData: Cluster Computing with Apache Mesos and CascadingBoulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading
Boulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading
Paco Nathan4.9K vistas
Technology Stack Discussion por Zaiyang Li
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack Discussion
Zaiyang Li586 vistas
Why apache Flink is the 4G of Big Data Analytics Frameworks por Slim Baltagi
Why apache Flink is the 4G of Big Data Analytics FrameworksWhy apache Flink is the 4G of Big Data Analytics Frameworks
Why apache Flink is the 4G of Big Data Analytics Frameworks
Slim Baltagi30.7K vistas
System design for Web Application por Michael Choi
System design for Web ApplicationSystem design for Web Application
System design for Web Application
Michael Choi2.5K vistas
Integrating Splunk into your Spring Applications por Damien Dallimore
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring Applications
Damien Dallimore11.2K vistas
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... por Databricks
 MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
Databricks1.7K vistas
Overview of VS2010 and .NET 4.0 por Bruce Johnson
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
Bruce Johnson879 vistas
.NET per la Data Science e oltre por Marco Parenzan
.NET per la Data Science e oltre.NET per la Data Science e oltre
.NET per la Data Science e oltre
Marco Parenzan180 vistas
Machine learning model to production por Georg Heiler
Machine learning model to productionMachine learning model to production
Machine learning model to production
Georg Heiler4.4K vistas
Splunk Conf 2014 - Getting the message por Damien Dallimore
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
Damien Dallimore2.7K vistas
Infrastructure as code, using Terraform por Harkamal Singh
Infrastructure as code, using TerraformInfrastructure as code, using Terraform
Infrastructure as code, using Terraform
Harkamal Singh254 vistas
Web Development Environments: Choose the best or go with the rest por george.james
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
george.james5.6K vistas
Near real-time anomaly detection at Lyft por markgrover
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyft
markgrover1.9K vistas
Metaflow: The ML Infrastructure at Netflix por Bill Liu
Metaflow: The ML Infrastructure at NetflixMetaflow: The ML Infrastructure at Netflix
Metaflow: The ML Infrastructure at Netflix
Bill Liu523 vistas
After the LAMP, it's time to get MEAN por Jeff Fox
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
Jeff Fox751 vistas
IBM Strategy for Spark por Mark Kerzner
IBM Strategy for SparkIBM Strategy for Spark
IBM Strategy for Spark
Mark Kerzner752 vistas
OS for AI: Elastic Microservices & the Next Gen of ML por Nordic APIs
OS for AI: Elastic Microservices & the Next Gen of MLOS for AI: Elastic Microservices & the Next Gen of ML
OS for AI: Elastic Microservices & the Next Gen of ML
Nordic APIs264 vistas
Overview of Apache Flink: Next-Gen Big Data Analytics Framework por Slim Baltagi
Overview of Apache Flink: Next-Gen Big Data Analytics FrameworkOverview of Apache Flink: Next-Gen Big Data Analytics Framework
Overview of Apache Flink: Next-Gen Big Data Analytics Framework
Slim Baltagi32.5K vistas
Integration Patterns for Big Data Applications por Michael Häusler
Integration Patterns for Big Data ApplicationsIntegration Patterns for Big Data Applications
Integration Patterns for Big Data Applications
Michael Häusler522 vistas
Making Machine Learning Easy with H2O and WebFlux por Trayan Iliev
Making Machine Learning Easy with H2O and WebFluxMaking Machine Learning Easy with H2O and WebFlux
Making Machine Learning Easy with H2O and WebFlux
Trayan Iliev119 vistas

Más de Kaxil Naik

Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai... por
Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...
Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...Kaxil Naik
4 vistas17 diapositivas
Airflow: Save Tons of Money by Using Deferrable Operators por
Airflow: Save Tons of Money by Using Deferrable OperatorsAirflow: Save Tons of Money by Using Deferrable Operators
Airflow: Save Tons of Money by Using Deferrable OperatorsKaxil Naik
778 vistas30 diapositivas
What's new in Airflow 2.3? por
What's new in Airflow 2.3?What's new in Airflow 2.3?
What's new in Airflow 2.3?Kaxil Naik
80 vistas23 diapositivas
Upgrading to Apache Airflow 2 | Airflow Summit 2021 por
Upgrading to Apache Airflow 2 | Airflow Summit 2021Upgrading to Apache Airflow 2 | Airflow Summit 2021
Upgrading to Apache Airflow 2 | Airflow Summit 2021Kaxil Naik
85 vistas49 diapositivas
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri... por
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...Kaxil Naik
119 vistas63 diapositivas
Upcoming features in Airflow 2 por
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2Kaxil Naik
126 vistas50 diapositivas

Más de Kaxil Naik(9)

Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai... por Kaxil Naik
Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...
Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai...
Kaxil Naik4 vistas
Airflow: Save Tons of Money by Using Deferrable Operators por Kaxil Naik
Airflow: Save Tons of Money by Using Deferrable OperatorsAirflow: Save Tons of Money by Using Deferrable Operators
Airflow: Save Tons of Money by Using Deferrable Operators
Kaxil Naik778 vistas
What's new in Airflow 2.3? por Kaxil Naik
What's new in Airflow 2.3?What's new in Airflow 2.3?
What's new in Airflow 2.3?
Kaxil Naik80 vistas
Upgrading to Apache Airflow 2 | Airflow Summit 2021 por Kaxil Naik
Upgrading to Apache Airflow 2 | Airflow Summit 2021Upgrading to Apache Airflow 2 | Airflow Summit 2021
Upgrading to Apache Airflow 2 | Airflow Summit 2021
Kaxil Naik85 vistas
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri... por Kaxil Naik
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri...
Kaxil Naik119 vistas
Upcoming features in Airflow 2 por Kaxil Naik
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2
Kaxil Naik126 vistas
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup por Kaxil Naik
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
Kaxil Naik182 vistas
Airflow Best Practises & Roadmap to Airflow 2.0 por Kaxil Naik
Airflow Best Practises & Roadmap to Airflow 2.0Airflow Best Practises & Roadmap to Airflow 2.0
Airflow Best Practises & Roadmap to Airflow 2.0
Kaxil Naik338 vistas
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py... por Kaxil Naik
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...
Kaxil Naik2.9K vistas

Último

[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... por
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...DataScienceConferenc1
5 vistas11 diapositivas
3196 The Case of The East River por
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East RiverErickANDRADE90
11 vistas4 diapositivas
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx por
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptxDataScienceConferenc1
5 vistas12 diapositivas
Advanced_Recommendation_Systems_Presentation.pptx por
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptxneeharikasingh29
5 vistas9 diapositivas
Binder1.pdf por
Binder1.pdfBinder1.pdf
Binder1.pdfEstherSita2
10 vistas21 diapositivas
Ukraine Infographic_22NOV2023_v2.pdf por
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdfAnastosiyaGurin
1.3K vistas3 diapositivas

Último(20)

[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... por DataScienceConferenc1
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
3196 The Case of The East River por ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9011 vistas
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx por DataScienceConferenc1
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
Advanced_Recommendation_Systems_Presentation.pptx por neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
neeharikasingh295 vistas
Ukraine Infographic_22NOV2023_v2.pdf por AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.3K vistas
Short Story Assignment by Kelly Nguyen por kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0119 vistas
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation por DataScienceConferenc1
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
SUPER STORE SQL PROJECT.pptx por khan888620
SUPER STORE SQL PROJECT.pptxSUPER STORE SQL PROJECT.pptx
SUPER STORE SQL PROJECT.pptx
khan88862012 vistas
CRIJ4385_Death Penalty_F23.pptx por yvettemm100
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptx
yvettemm1006 vistas
Chapter 3b- Process Communication (1) (1)(1) (1).pptx por ayeshabaig2004
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
ayeshabaig20045 vistas
Organic Shopping in Google Analytics 4.pdf por GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials11 vistas
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf por vikas12611618
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfVikas 500 BIG DATA TECHNOLOGIES LAB.pdf
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf
vikas126116188 vistas

Building and deploying LLM applications with Apache Airflow

  • 2. Kaxil Naik Apache Airflow Committer & PMC Member Director of Eng @ Astronomer Julian LaNeve Senior Product Manager @ Astronomer
  • 3. Why Airflow should be at the centre of LLMOps? Real Use-case & reference architecture Next Steps: Community collaboration Agenda
  • 4. A powerful new class of large language models is making it possible for machines to write, code, draw, and create with credible and sometimes superhuman results. Generative AI: A Creative New World
  • 5. Normally, for ML, you need to… Ingest Data Train Model Prediction
  • 6. …but now you can You hit a pre-trained model instead of your own model …but now you can: Ingest Data Train Model Prediction Less Data
  • 8. ■ Ingestion from several sources ■ Day 2 operations on data pipelines ■ Data preparation ■ Data privacy ■ Data freshness ■ Model deployment & monitoring ■ Scaling Models ■ Experimentation & fine-tuning ■ Feedback Loops Going from “Idea to Production” with LLM Apps involves solving a lot of data engineering problems:
  • 9. Source: https://python.langchain.com/docs/use_cases/question_answering/ Typical Architecture for Q&A use-case using LLM Legacy Data Store Retrieval Output Storage Splitting Document Loading Vectorstore Database PDFs URLs LLM <Answer> Prompt Splits Relevant Splits Query <Question>
  • 10. Python Native The language of data scientists and ML engineers. Pluggable Compute GPUs, Kubernetes, EC2, VMs etc. Common Interface Between Data Engineering, Data Science, ML Engineering and Operations. Data Agnostic But data aware. Extensible Standardize custom operators and templates for common DS tasks across the organization. Monitoring & Alerting Built in features for logging, monitoring and alerting to external systems. Ingestion Extract and load data into vectordbs and other destinations Day 2 Ops Handle retries, dependencies, and all other day 2 ops associated with data pipelines Airflow is a Natural Fit… Document Parsing Decorator and pythonic interfaces for standard LLM tools
  • 11. Let’s Talk About a Real Use Case
  • 12. Problem Statement: We have customers, employees, and community members that ask questions about our product with answers that exist across several sources of documentation. How do we provide an easy interface for folks to get their questions answered without adding further strain to the team?
  • 14. ■ Airflow gives a framework to load data from APIs & other sources into LangChain ■ LangChain helps pre-process and split documents into smaller chunks depending on content type ■ After content is split into chunks, each chunk is embedded into vectors (semantic representations) ■ Those vectors are written to Weaviate for later retrieval Data Ingestion, Processing, and Embedding Embed chunks Write to Weaviate Pre-process and split into chunks 🦜🔗 LangChain Docs (.md) files Slack Messages GitHub issues Docs (.md) files
  • 15. Users can interact with UI or Slack Bot; they both use the same API ■ Original prompt gets reworded 3x using gpt-3.5-turbo ■ Answer is generated by combining docs from each prompt and making a gpt-4 call ■ State is stored in Firestore and prompt tracing is done through LangSmith 🦜🔗LangChain User Asks a Question Web App Slack Bot Original Prompt Rewording 2 Rewording 1 Rewording 3 Reword to get more related documents Vector DB search with prompts Combine docs and make final LLM call to answer 🦜 🔗 Prompt Orchestration and Answering
  • 16. ■ Airflow DAGs process feedback async to evaluate answers on helpfulness,, relevance, and publicness ■ If answer is good, it gets stored in Weaviate and can be used as a source for future questions ■ UI also shows the most recent good prompts on the homepage When a user submits feedback, it gets stored in Firestore and LangSmith for later use User Rates Answer 🦜 🔗 Fetch new runs: input, output, and user feedback Classify Q&A according to helpfulness, relevance, and public 🦜🔗 LangChain If good answer, write to vector DB to use in future answers If good answer, mark as good to show on Ask Astro homepage On schedule LLM & Product Feedback Loops
  • 17. Running this in production meant: ■ Experimenting with different sources of data to ingest ■ Running the pipelines on a schedule and ad-hoc ■ Running the same workloads with variable chunking strategies ■ Needing to retry tasks due to finicky python libraries and unreliable external services ■ Giving different parts of the workload variable compute ■ Creating standard interfaces to interact with external systems
  • 18. ■ Experimenting with different sources of data to ingest ■ Running the pipelines on a schedule and ad-hoc ■ Running the same workloads with variable chunking strategies ■ Needing to retry tasks due to finicky python libraries and unreliable external services ■ Giving different parts of the workload variable compute ■ Creating standard interfaces to interact with external systems Running this in production meant: Which is what Airflow’s great at!
  • 20. a16z’s Emerging LLM App Stack Orchestration (Python/DIY, LangChain, LlamaIndex, ChatGPT) APIs/Plugins (Serp, Wolfram, Zapier, etc.) App Hosting (Vercel, Steamship, Streamlit, Modal) Query Output Prompt Few-shot examples Contextual data Playground (OpenAI, nat.dev, Humanloop) Data Pipelines (Databricks, Airflow, Unstructured, etc.) Embedding Model (OpenAI, Cohere, Hugging Face) Vector Database (Pinecone, Weaviate, Chroma, pgvector) LLM Cache (Redis, SQLite, GPTCache) Logging/LLMops (Weights & Biases, MLflow, PromptLayer, Helicone) Validation (Guardrails, Rebuff, Guidance, LMQL) Proprietary API (OpenAI, Anthropic) Open API (Hugging Face, Replicate) Opinionated Cloud (Databricks, Anyscale, Mosaic, Modal, Runpod) Cloud Provider (AWS, GCP, Azure, Coreweave) LLM APIs and Hosting Gray boxes show key components of the stack, with leading tools / systems listed. Arrows show the flow of data through the stack. Contextual data provided by app developers to condition LLM outputs Prompts and few-shot examples that are sent to the LLM Queries submitted by users Output returned to users Legend
  • 21. AskAstro has a few parts of this… Orchestration (Python/DIY, LangChain, LlamaIndex, ChatGPT) APIs/Plugins (Serp, Wolfram, Zapier, etc.) App Hosting (Vercel, Steamship, Streamlit, Modal) Query Output Prompt Few-shot examples Contextual data Playground (OpenAI, nat.dev, Humanloop) Data Pipelines (Databricks, Airflow, Unstructured, etc.) Embedding Model (OpenAI, Cohere, Hugging Face) Vector Database (Pinecone, Weaviate, Chroma, pgvector) LLM Cache (Redis, SQLite, GPTCache) Logging/LLMops (Weights & Biases, MLflow, PromptLayer, Helicone) Validation (Guardrails, Rebuff, Guidance, LMQL) Proprietary API (OpenAI, Anthropic) Open API (Hugging Face, Replicate) Opinionated Cloud (Databricks, Anyscale, Mosaic, Modal, Runpod) Cloud Provider (AWS, GCP, Azure, Coreweave) LLM APIs and Hosting Gray boxes show key components of the stack, with leading tools / systems listed. Arrows show the flow of data through the stack. Contextual data provided by app developers to condition LLM outputs Prompts and few-shot examples that are sent to the LLM Queries submitted by users Output returned to users Legend
  • 22. Airflow is foundational to best practices for all of this. Data Governance ■ How do you account for private data? ■ How do you provide transparency into data lineage? Fine Tuning ■ Does it improve results? ■ How much does it cost? Feedback Loops ■ Semantic cache for correct responses ■ Ranking sources based on accuracy and ranking accordingly ■ Prompt clustering – what are people asking? …but there’s even more to consider.
  • 23. Michael Gregory Philippe Gagnon Thanks to the AskAstro Team:
  • 25. What are all the providers the ecosystem needs? pgvector
  • 28. Patterns What are the best practices for building pipelines for LLM Apps? ■ Do you use one task to ingest and write? ■ Can you use dynamic task mapping to break it out? ■ Do you write to disk? ■ Can you store embedding values in XCOMs? ■ How do you reconcile Airflow orchestration with prompt orchestration?
  • 29. Let’s do this all in the open source!