Building and deploying LLM applications with Apache Airflow

Kaxil Naik
Kaxil NaikDirector of Airflow Engineering team @ Astronomer em 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

And then there were ... Large Language Models por
And then there were ... Large Language ModelsAnd then there were ... Large Language Models
And then there were ... Large Language ModelsLeon Dohmen
2.4K visualizações40 slides
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in... por
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 Talby
665 visualizações36 slides
Large Language Models - Chat AI.pdf por
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdfDavid Rostcheck
711 visualizações19 slides
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
232 visualizações16 slides
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.pdfAnastasiaSteele10
148 visualizações22 slides
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT! por
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!taozen
1K visualizações13 slides

Mais conteúdo relacionado

Mais procurados

Landscape of AI/ML in 2023 por
Landscape of AI/ML in 2023Landscape of AI/ML in 2023
Landscape of AI/ML in 2023HyunJoon Jung
2.4K visualizações67 slides
A Comprehensive Review of Large Language Models for.pptx por
A Comprehensive Review of Large Language Models for.pptxA Comprehensive Review of Large Language Models for.pptx
A Comprehensive Review of Large Language Models for.pptxSaiPragnaKancheti
2.3K visualizações24 slides
Reinventing Deep Learning
 with Hugging Face Transformers por
Reinventing Deep Learning
 with Hugging Face TransformersReinventing Deep Learning
 with Hugging Face Transformers
Reinventing Deep Learning
 with Hugging Face TransformersJulien SIMON
596 visualizações14 slides
A brief primer on OpenAI's GPT-3 por
A brief primer on OpenAI's GPT-3A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3Ishan Jain
2K visualizações28 slides
OpenAI’s GPT 3 Language Model - guest Steve Omohundro por
OpenAI’s GPT 3 Language Model - guest Steve OmohundroOpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve OmohundroNumenta
3.6K visualizações34 slides
LanGCHAIN Framework por
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN FrameworkKeymate.AI
1.5K visualizações19 slides

Mais procurados(20)

Landscape of AI/ML in 2023 por HyunJoon Jung
Landscape of AI/ML in 2023Landscape of AI/ML in 2023
Landscape of AI/ML in 2023
HyunJoon Jung2.4K visualizações
A Comprehensive Review of Large Language Models for.pptx por SaiPragnaKancheti
A Comprehensive Review of Large Language Models for.pptxA Comprehensive Review of Large Language Models for.pptx
A Comprehensive Review of Large Language Models for.pptx
SaiPragnaKancheti2.3K visualizações
Reinventing Deep Learning
 with Hugging Face Transformers por Julien SIMON
Reinventing Deep Learning
 with Hugging Face TransformersReinventing Deep Learning
 with Hugging Face Transformers
Reinventing Deep Learning
 with Hugging Face Transformers
Julien SIMON596 visualizações
A brief primer on OpenAI's GPT-3 por Ishan Jain
A brief primer on OpenAI's GPT-3A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3
Ishan Jain2K visualizações
OpenAI’s GPT 3 Language Model - guest Steve Omohundro por Numenta
OpenAI’s GPT 3 Language Model - guest Steve OmohundroOpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve Omohundro
Numenta3.6K visualizações
LanGCHAIN Framework por Keymate.AI
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN Framework
Keymate.AI1.5K visualizações
Understanding GenAI/LLM and What is Google Offering - Felix Goh por NUS-ISS
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix Goh
NUS-ISS79 visualizações
How Does Generative AI Actually Work? (a quick semi-technical introduction to... por ssuser4edc93
How Does Generative AI Actually Work? (a quick semi-technical introduction to...How Does Generative AI Actually Work? (a quick semi-technical introduction to...
How Does Generative AI Actually Work? (a quick semi-technical introduction to...
ssuser4edc93971 visualizações
Generative Models and ChatGPT por Loic Merckel
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
Loic Merckel652 visualizações
Google Cloud Machine Learning por India Quotient
 Google Cloud Machine Learning  Google Cloud Machine Learning
Google Cloud Machine Learning
India Quotient7.6K visualizações
Vector databases and neural search por Dmitry Kan
Vector databases and neural searchVector databases and neural search
Vector databases and neural search
Dmitry Kan3.8K visualizações
Large Language Models Bootcamp por Data Science Dojo
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models Bootcamp
Data Science Dojo3.3K visualizações
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 Varga161 visualizações
Introduction to MLflow por Databricks
Introduction to MLflowIntroduction to MLflow
Introduction to MLflow
Databricks9.7K visualizações
An Introduction to Generative AI por Cori Faklaris
An Introduction  to Generative AIAn Introduction  to Generative AI
An Introduction to Generative AI
Cori Faklaris11.6K visualizações
Build an LLM-powered application using LangChain.pdf por StephenAmell4
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdf
StephenAmell4956 visualizações
Leveraging Generative AI & Best practices por DianaGray10
Leveraging Generative AI & Best practicesLeveraging Generative AI & Best practices
Leveraging Generative AI & Best practices
DianaGray101.8K visualizações
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 visualizações

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 visualizações87 slides
Technology Stack Discussion por
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack DiscussionZaiyang Li
586 visualizações25 slides
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 visualizações118 slides
System design for Web Application por
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
2.5K visualizações5 slides
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 visualizações68 slides
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 visualizações41 slides

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 visualizações
Technology Stack Discussion por Zaiyang Li
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack Discussion
Zaiyang Li586 visualizações
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 visualizações
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 visualizações
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 visualizações
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 visualizações
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 visualizações
.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 visualizações
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 visualizações
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 visualizações
Infrastructure as code, using Terraform por Harkamal Singh
Infrastructure as code, using TerraformInfrastructure as code, using Terraform
Infrastructure as code, using Terraform
Harkamal Singh254 visualizações
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 visualizações
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 visualizações
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 visualizações
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 Fox753 visualizações
IBM Strategy for Spark por Mark Kerzner
IBM Strategy for SparkIBM Strategy for Spark
IBM Strategy for Spark
Mark Kerzner752 visualizações
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 visualizações
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 visualizações
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äusler523 visualizações
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 visualizações

Mais 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 visualizações17 slides
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
782 visualizações30 slides
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 visualizações23 slides
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 visualizações49 slides
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 visualizações63 slides
Upcoming features in Airflow 2 por
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2Kaxil Naik
126 visualizações50 slides

Mais 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 visualizações
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 Naik782 visualizações
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 visualizações
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 visualizações
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 visualizações
Upcoming features in Airflow 2 por Kaxil Naik
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2
Kaxil Naik126 visualizações
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 visualizações
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 Naik339 visualizações
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 visualizações

Último

META.pptx por
META.pptxMETA.pptx
META.pptxvasanthan19012003
6 visualizações10 slides
K-Drama Recommendation Using Python por
K-Drama Recommendation Using PythonK-Drama Recommendation Using Python
K-Drama Recommendation Using PythonFridaPutriassa
5 visualizações20 slides
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... por
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...StatsCommunications
7 visualizações26 slides
Dr. Ousmane Badiane-2023 ReSAKSS Conference por
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceAKADEMIYA2063
5 visualizações34 slides
CRM stick or twist.pptx por
CRM stick or twist.pptxCRM stick or twist.pptx
CRM stick or twist.pptxinfo828217
11 visualizações16 slides
Listed Instruments Survey 2022.pptx por
Listed Instruments Survey  2022.pptxListed Instruments Survey  2022.pptx
Listed Instruments Survey 2022.pptxsecretariat4
93 visualizações12 slides

Último(20)

K-Drama Recommendation Using Python por FridaPutriassa
K-Drama Recommendation Using PythonK-Drama Recommendation Using Python
K-Drama Recommendation Using Python
FridaPutriassa5 visualizações
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... por StatsCommunications
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
StatsCommunications7 visualizações
Dr. Ousmane Badiane-2023 ReSAKSS Conference por AKADEMIYA2063
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS Conference
AKADEMIYA20635 visualizações
CRM stick or twist.pptx por info828217
CRM stick or twist.pptxCRM stick or twist.pptx
CRM stick or twist.pptx
info82821711 visualizações
Listed Instruments Survey 2022.pptx por secretariat4
Listed Instruments Survey  2022.pptxListed Instruments Survey  2022.pptx
Listed Instruments Survey 2022.pptx
secretariat493 visualizações
Penetration testing by Burpsuite por AyonDebnathCertified
Penetration testing by  BurpsuitePenetration testing by  Burpsuite
Penetration testing by Burpsuite
AyonDebnathCertified5 visualizações
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... por DataScienceConferenc1
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
DataScienceConferenc15 visualizações
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... por DataScienceConferenc1
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
DataScienceConferenc19 visualizações
apple.pptx por honeybeeqwe
apple.pptxapple.pptx
apple.pptx
honeybeeqwe6 visualizações
Inawisdom Quick Sight por PhilipBasford
Inawisdom Quick SightInawisdom Quick Sight
Inawisdom Quick Sight
PhilipBasford7 visualizações
PRIVACY AWRE PERSONAL DATA STORAGE por antony420421
PRIVACY AWRE PERSONAL DATA STORAGEPRIVACY AWRE PERSONAL DATA STORAGE
PRIVACY AWRE PERSONAL DATA STORAGE
antony4204217 visualizações
LIVE OAK MEMORIAL PARK.pptx por ms2332always
LIVE OAK MEMORIAL PARK.pptxLIVE OAK MEMORIAL PARK.pptx
LIVE OAK MEMORIAL PARK.pptx
ms2332always7 visualizações
Data Journeys Hard Talk workshop final.pptx por info828217
Data Journeys Hard Talk workshop final.pptxData Journeys Hard Talk workshop final.pptx
Data Journeys Hard Talk workshop final.pptx
info82821711 visualizações
Ukraine Infographic_22NOV2023_v2.pdf por AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K visualizações
Games, Queries, and Argumentation Frameworks: Time for a Family Reunion por Bertram Ludäscher
Games, Queries, and Argumentation Frameworks: Time for a Family ReunionGames, Queries, and Argumentation Frameworks: Time for a Family Reunion
Games, Queries, and Argumentation Frameworks: Time for a Family Reunion
Bertram Ludäscher9 visualizações
Custom Tag Manager Templates por Markus Baersch
Custom Tag Manager TemplatesCustom Tag Manager Templates
Custom Tag Manager Templates
Markus Baersch29 visualizações

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!