Building and deploying LLM applications with Apache Airflow

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

Recommandé

Regulating Generative AI - LLMOps pipelines with Transparency par
Regulating Generative AI - LLMOps pipelines with TransparencyRegulating Generative AI - LLMOps pipelines with Transparency
Regulating Generative AI - LLMOps pipelines with TransparencyDebmalya Biswas
230 vues16 diapositives
Build an LLM-powered application using LangChain.pdf par
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfStephenAmell4
927 vues22 diapositives
LanGCHAIN Framework par
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN FrameworkKeymate.AI
1.4K vues19 diapositives
Large Language Models Bootcamp par
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models BootcampData Science Dojo
3.3K vues15 diapositives
LLMs_talk_March23.pdf par
LLMs_talk_March23.pdfLLMs_talk_March23.pdf
LLMs_talk_March23.pdfChaoYang81
85 vues160 diapositives
Fine tuning large LMs par
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMsSylvainGugger
2.4K vues25 diapositives

Contenu connexe

Tendances

Generative Models and ChatGPT par
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPTLoic Merckel
644 vues19 diapositives
Fine tune and deploy Hugging Face NLP models par
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsOVHcloud
952 vues26 diapositives
MLOps in action par
MLOps in actionMLOps in action
MLOps in actionPieter de Bruin
1.6K vues23 diapositives
Best Practice on using Azure OpenAI Service par
Best Practice on using Azure OpenAI ServiceBest Practice on using Azure OpenAI Service
Best Practice on using Azure OpenAI ServiceKumton Suttiraksiri
517 vues45 diapositives
LLMs Bootcamp par
LLMs BootcampLLMs Bootcamp
LLMs BootcampFiza987241
128 vues12 diapositives
Llama-index par
Llama-indexLlama-index
Llama-indexDenis973830
2.1K vues14 diapositives

Tendances(20)

Generative Models and ChatGPT par Loic Merckel
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
Loic Merckel644 vues
Fine tune and deploy Hugging Face NLP models par 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 vues
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in... par 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 Talby657 vues
Apply MLOps at Scale by H&M par Databricks
Apply MLOps at Scale by H&MApply MLOps at Scale by H&M
Apply MLOps at Scale by H&M
Databricks1K vues
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT! par 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 vues
Unlocking the Power of Generative AI An Executive's Guide.pdf par 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 vues
10 more lessons learned from building Machine Learning systems par 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 vues
Benchmark comparison of Large Language Models par Matej Varga
Benchmark comparison of Large Language ModelsBenchmark comparison of Large Language Models
Benchmark comparison of Large Language Models
Matej Varga148 vues
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor... par 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...
DianaGray10307 vues
AI and ML Series - Introduction to Generative AI and LLMs - Session 1 par 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 vues
Neural Language Generation Head to Toe par Hady Elsahar
Neural Language Generation Head to Toe Neural Language Generation Head to Toe
Neural Language Generation Head to Toe
Hady Elsahar101 vues

Similaire à Building and deploying LLM applications with Apache Airflow

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

Similaire à Building and deploying LLM applications with Apache Airflow(20)

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

Plus de Kaxil Naik

Introducing airflowctl: A CLI to streamline getting started with Airflow - Ai... par
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 vues17 diapositives
Airflow: Save Tons of Money by Using Deferrable Operators par
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 vues30 diapositives
What's new in Airflow 2.3? par
What's new in Airflow 2.3?What's new in Airflow 2.3?
What's new in Airflow 2.3?Kaxil Naik
80 vues23 diapositives
Upgrading to Apache Airflow 2 | Airflow Summit 2021 par
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 vues49 diapositives
Contributing to Apache Airflow | Journey to becoming Airflow's leading contri... par
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 vues63 diapositives
Upcoming features in Airflow 2 par
Upcoming features in Airflow 2Upcoming features in Airflow 2
Upcoming features in Airflow 2Kaxil Naik
126 vues50 diapositives

Plus de Kaxil Naik(9)

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

Dernier

How Leaders See Data? (Level 1) par
How Leaders See Data? (Level 1)How Leaders See Data? (Level 1)
How Leaders See Data? (Level 1)Narendra Narendra
13 vues76 diapositives
Chapter 3b- Process Communication (1) (1)(1) (1).pptx par
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).pptxayeshabaig2004
5 vues30 diapositives
Cross-network in Google Analytics 4.pdf par
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdfGA4 Tutorials
6 vues7 diapositives
PROGRAMME.pdf par
PROGRAMME.pdfPROGRAMME.pdf
PROGRAMME.pdfHiNedHaJar
19 vues13 diapositives
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docx par
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docxRIO GRANDE SUPPLY COMPANY INC, JAYSON.docx
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docxJaysonGarabilesEspej
6 vues3 diapositives
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation par
[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
11 vues29 diapositives

Dernier(20)

Chapter 3b- Process Communication (1) (1)(1) (1).pptx par 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
Cross-network in Google Analytics 4.pdf par GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 vues
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation par 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
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx par 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
SUPER STORE SQL PROJECT.pptx par khan888620
SUPER STORE SQL PROJECT.pptxSUPER STORE SQL PROJECT.pptx
SUPER STORE SQL PROJECT.pptx
khan88862012 vues
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... par 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...
Short Story Assignment by Kelly Nguyen par kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0119 vues
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf par vikas12611618
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfVikas 500 BIG DATA TECHNOLOGIES LAB.pdf
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf
vikas126116188 vues
Advanced_Recommendation_Systems_Presentation.pptx par neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
CRIJ4385_Death Penalty_F23.pptx par yvettemm100
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptx
yvettemm1006 vues
UNEP FI CRS Climate Risk Results.pptx par pekka28
UNEP FI CRS Climate Risk Results.pptxUNEP FI CRS Climate Risk Results.pptx
UNEP FI CRS Climate Risk Results.pptx
pekka2811 vues
Ukraine Infographic_22NOV2023_v2.pdf par AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K vues

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!