Building and deploying LLM applications with Apache Airflow

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

Recommended

LangChain Intro by KeyMate.AI by
LangChain Intro by KeyMate.AILangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AIOzgurOscarOzkan
388 views19 slides
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in... by
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
659 views36 slides
Large Language Models Bootcamp by
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models BootcampData Science Dojo
3.3K views15 slides
Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74) by
Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74)Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74)
Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74)Naoki (Neo) SATO
1.2K views47 slides
Regulating Generative AI - LLMOps pipelines with Transparency by
Regulating Generative AI - LLMOps pipelines with TransparencyRegulating Generative AI - LLMOps pipelines with Transparency
Regulating Generative AI - LLMOps pipelines with TransparencyDebmalya Biswas
230 views16 slides
Build an LLM-powered application using LangChain.pdf by
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfAnastasiaSteele10
145 views22 slides

More Related Content

What's hot

How Does Generative AI Actually Work? (a quick semi-technical introduction to... by
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...ssuser4edc93
949 views14 slides
Using the power of Generative AI at scale by
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scaleMaxim Salnikov
908 views31 slides
Landscape of AI/ML in 2023 by
Landscape of AI/ML in 2023Landscape of AI/ML in 2023
Landscape of AI/ML in 2023HyunJoon Jung
2.4K views67 slides
Large Language Models - Chat AI.pdf by
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdfDavid Rostcheck
679 views19 slides
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT! by
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 views13 slides
Build an LLM-powered application using LangChain.pdf by
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfStephenAmell4
935 views22 slides

What's hot(20)

How Does Generative AI Actually Work? (a quick semi-technical introduction to... by 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...
ssuser4edc93949 views
Using the power of Generative AI at scale by Maxim Salnikov
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scale
Maxim Salnikov908 views
Landscape of AI/ML in 2023 by HyunJoon Jung
Landscape of AI/ML in 2023Landscape of AI/ML in 2023
Landscape of AI/ML in 2023
HyunJoon Jung2.4K views
Large Language Models - Chat AI.pdf by David Rostcheck
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdf
David Rostcheck679 views
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT! by 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 views
Build an LLM-powered application using LangChain.pdf by StephenAmell4
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdf
StephenAmell4935 views
[Machine Learning 15minutes! #61] Azure OpenAI Service by Naoki (Neo) SATO
[Machine Learning 15minutes! #61] Azure OpenAI Service[Machine Learning 15minutes! #61] Azure OpenAI Service
[Machine Learning 15minutes! #61] Azure OpenAI Service
Naoki (Neo) SATO1.1K views
LLMs Bootcamp by Fiza987241
LLMs BootcampLLMs Bootcamp
LLMs Bootcamp
Fiza987241129 views
Unlocking the Power of Generative AI An Executive's Guide.pdf by 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 views
Leveraging Generative AI & Best practices by DianaGray10
Leveraging Generative AI & Best practicesLeveraging Generative AI & Best practices
Leveraging Generative AI & Best practices
DianaGray101.7K views
Mother of Language`s Langchain by Jun-hang Lee
Mother of Language`s LangchainMother of Language`s Langchain
Mother of Language`s Langchain
Jun-hang Lee1.8K views
𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈: 𝐂𝐡𝐚𝐧𝐠𝐢𝐧𝐠 𝐇𝐨𝐰 𝐁𝐮𝐬𝐢𝐧𝐞𝐬𝐬 𝐈𝐧𝐧𝐨𝐯𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐎𝐩𝐞𝐫𝐚𝐭𝐞𝐬 by VINCI Digital - Industrial IoT (IIoT) Strategic Advisory
𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈: 𝐂𝐡𝐚𝐧𝐠𝐢𝐧𝐠 𝐇𝐨𝐰 𝐁𝐮𝐬𝐢𝐧𝐞𝐬𝐬 𝐈𝐧𝐧𝐨𝐯𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐎𝐩𝐞𝐫𝐚𝐭𝐞𝐬𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈: 𝐂𝐡𝐚𝐧𝐠𝐢𝐧𝐠 𝐇𝐨𝐰 𝐁𝐮𝐬𝐢𝐧𝐞𝐬𝐬 𝐈𝐧𝐧𝐨𝐯𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐎𝐩𝐞𝐫𝐚𝐭𝐞𝐬
𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈: 𝐂𝐡𝐚𝐧𝐠𝐢𝐧𝐠 𝐇𝐨𝐰 𝐁𝐮𝐬𝐢𝐧𝐞𝐬𝐬 𝐈𝐧𝐧𝐨𝐯𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐎𝐩𝐞𝐫𝐚𝐭𝐞𝐬
LLMs_talk_March23.pdf by ChaoYang81
LLMs_talk_March23.pdfLLMs_talk_March23.pdf
LLMs_talk_March23.pdf
ChaoYang8185 views

Similar to Building and deploying LLM applications with Apache Airflow

Boulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading by
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 views87 slides
Technology Stack Discussion by
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack DiscussionZaiyang Li
586 views25 slides
Why apache Flink is the 4G of Big Data Analytics Frameworks by
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 views118 slides
System design for Web Application by
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
2.5K views5 slides
Integrating Splunk into your Spring Applications by
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsDamien Dallimore
11.2K views68 slides
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... by
 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 views41 slides

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

Boulder/Denver BigData: Cluster Computing with Apache Mesos and Cascading by 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 views
Technology Stack Discussion by Zaiyang Li
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack Discussion
Zaiyang Li586 views
Why apache Flink is the 4G of Big Data Analytics Frameworks by 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 views
System design for Web Application by Michael Choi
System design for Web ApplicationSystem design for Web Application
System design for Web Application
Michael Choi2.5K views
Integrating Splunk into your Spring Applications by Damien Dallimore
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring Applications
Damien Dallimore11.2K views
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ... by 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 views
Overview of VS2010 and .NET 4.0 by Bruce Johnson
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
Bruce Johnson879 views
.NET per la Data Science e oltre by 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 views
Machine learning model to production by Georg Heiler
Machine learning model to productionMachine learning model to production
Machine learning model to production
Georg Heiler4.4K views
Splunk Conf 2014 - Getting the message by Damien Dallimore
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
Damien Dallimore2.7K views
Infrastructure as code, using Terraform by Harkamal Singh
Infrastructure as code, using TerraformInfrastructure as code, using Terraform
Infrastructure as code, using Terraform
Harkamal Singh254 views
Web Development Environments: Choose the best or go with the rest by 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 views
Near real-time anomaly detection at Lyft by markgrover
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyft
markgrover1.9K views
Metaflow: The ML Infrastructure at Netflix by Bill Liu
Metaflow: The ML Infrastructure at NetflixMetaflow: The ML Infrastructure at Netflix
Metaflow: The ML Infrastructure at Netflix
Bill Liu523 views
After the LAMP, it's time to get MEAN by 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 views
IBM Strategy for Spark by Mark Kerzner
IBM Strategy for SparkIBM Strategy for Spark
IBM Strategy for Spark
Mark Kerzner752 views
OS for AI: Elastic Microservices & the Next Gen of ML by 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 views
Overview of Apache Flink: Next-Gen Big Data Analytics Framework by 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 views
Integration Patterns for Big Data Applications by Michael Häusler
Integration Patterns for Big Data ApplicationsIntegration Patterns for Big Data Applications
Integration Patterns for Big Data Applications
Michael Häusler522 views
Making Machine Learning Easy with H2O and WebFlux by 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 views

More from Kaxil Naik

Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai... by
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 views17 slides
Airflow: Save Tons of Money by Using Deferrable Operators by
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
779 views30 slides
What's new in Airflow 2.3? by
What's new in Airflow 2.3?What's new in Airflow 2.3?
What's new in Airflow 2.3?Kaxil Naik
80 views23 slides
Upgrading to Apache Airflow 2 | Airflow Summit 2021 by
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 views49 slides
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri... by
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 views63 slides
Upcoming features in Airflow 2 by
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2Kaxil Naik
126 views50 slides

More from Kaxil Naik(9)

Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai... by 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 views
Airflow: Save Tons of Money by Using Deferrable Operators by 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 Naik779 views
What's new in Airflow 2.3? by 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 views
Upgrading to Apache Airflow 2 | Airflow Summit 2021 by 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 views
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri... by 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 views
Upcoming features in Airflow 2 by Kaxil Naik
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2
Kaxil Naik126 views
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup by 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 views
Airflow Best Practises & Roadmap to Airflow 2.0 by 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 views
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py... by 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 views

Recently uploaded

Short Story Assignment by Kelly Nguyen by
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyenkellynguyen01
19 views17 slides
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation by
[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 GenerationDataScienceConferenc1
13 views29 slides
UNEP FI CRS Climate Risk Results.pptx by
UNEP FI CRS Climate Risk Results.pptxUNEP FI CRS Climate Risk Results.pptx
UNEP FI CRS Climate Risk Results.pptxpekka28
11 views51 slides
Cross-network in Google Analytics 4.pdf by
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdfGA4 Tutorials
6 views7 slides
How Leaders See Data? (Level 1) by
How Leaders See Data? (Level 1)How Leaders See Data? (Level 1)
How Leaders See Data? (Level 1)Narendra Narendra
14 views76 slides
CRM stick or twist.pptx by
CRM stick or twist.pptxCRM stick or twist.pptx
CRM stick or twist.pptxinfo828217
10 views16 slides

Recently uploaded(20)

Short Story Assignment by Kelly Nguyen by kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0119 views
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation by 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
UNEP FI CRS Climate Risk Results.pptx by pekka28
UNEP FI CRS Climate Risk Results.pptxUNEP FI CRS Climate Risk Results.pptx
UNEP FI CRS Climate Risk Results.pptx
pekka2811 views
Cross-network in Google Analytics 4.pdf by GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 views
CRM stick or twist.pptx by info828217
CRM stick or twist.pptxCRM stick or twist.pptx
CRM stick or twist.pptx
info82821710 views
CRM stick or twist workshop by info828217
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshop
info8282179 views
Ukraine Infographic_22NOV2023_v2.pdf by AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K views
CRIJ4385_Death Penalty_F23.pptx by yvettemm100
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptx
yvettemm1006 views
Organic Shopping in Google Analytics 4.pdf by GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials14 views
Survey on Factuality in LLM's.pptx by NeethaSherra1
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptx
NeethaSherra16 views
Advanced_Recommendation_Systems_Presentation.pptx by neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
Data Journeys Hard Talk workshop final.pptx by info828217
Data Journeys Hard Talk workshop final.pptxData Journeys Hard Talk workshop final.pptx
Data Journeys Hard Talk workshop final.pptx
info82821710 views
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx by 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

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!