We may earn an affiliate commission when you visit our partners.
Course image
Richmond Alake

This course focuses on integrating traditional database features with vector search capabilities to optimize the performance and cost-efficiency of large-scale Retrieval Augmented Generation (RAG) applications.

You’ll learn how to apply these key techniques:

1. Prefiltering and Postfiltering: These are techniques to filter results based on specific conditions. Prefiltering is done at the database index creation stage, while postfiltering is applied after the vector search is performed.

Read more

This course focuses on integrating traditional database features with vector search capabilities to optimize the performance and cost-efficiency of large-scale Retrieval Augmented Generation (RAG) applications.

You’ll learn how to apply these key techniques:

1. Prefiltering and Postfiltering: These are techniques to filter results based on specific conditions. Prefiltering is done at the database index creation stage, while postfiltering is applied after the vector search is performed.

2. Projection: This technique involves selecting a subset of the fields returned from a query to minimize the size of the output.

3. Reranking: This involves reordering the results of a search based on other data fields to move the more desired results higher up the list.

4. Prompt Compression: This technique is used to reduce the length of prompts, which can be expensive to process in large-scale applications.

You’ll also learn with hands-on exercises how to:

1. Implement vector search for RAG using MongoDB.

2. Develop a multi-stage MongoDB aggregation pipeline.

3. Use metadata to refine and limit the search results returned from database operations, enhancing efficiency and relevancy.

4. Streamline the outputs from database operations by incorporating a projection stage into the MongoDB aggregation pipeline, reducing the amount of data returned and optimizing performance, memory usage, and security.

5. Rerank documents to improve information retrieval relevance and quality, and use metadata values to determine reordering position.

6. Implement prompt compression and gain an intuition of how to use it and the operational advantages it brings to LLM applications.

Start optimizing the efficiency, security, query processing speed, and cost of your RAG applications with prompt compression and query optimization techniques.

Enroll now

What's inside

Syllabus

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Provides methods for optimizing the efficiency and cost-effectiveness of large-scale Retrieval Augmented Generation (RAG) applications
Offers hands-on exercises to implement vector search, develop multi-stage aggregation pipelines, and apply prompt compression techniques using MongoDB
Suitable for individuals with a technical background or experience in database management and natural language processing
Instructors have expertise in the field of natural language processing and database optimization
Requires proficiency in MongoDB and basic understanding of vector search concepts
Does not cover advanced topics such as deep learning or reinforcement learning

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Rag optimization with database techniques

This course, offered by DeepLearning.AI, is designed to equip learners with advanced strategies for optimizing large-scale Retrieval Augmented Generation (RAG) applications. It delves into crucial techniques such as prefiltering, postfiltering, projection, reranking, and prompt compression, aiming to enhance performance, cost-efficiency, and query processing speed. Students can expect hands-on exercises, particularly focusing on implementing vector search and developing multi-stage aggregation pipelines using MongoDB, providing practical skills for real-world LLM applications. The curriculum emphasizes streamlining database operations for improved relevancy and reduced data output.
Suited for professionals in LLM/RAG.
"I feel this course is best for those already familiar with LLMs and RAG concepts, looking for advanced optimization."
"As someone working with large-scale AI applications, I found the topics directly relevant to my challenges."
"I recommend this course if you have a foundational understanding of databases and are keen on performance tuning RAG."
Includes practical MongoDB implementation.
"Implementing vector search for RAG using MongoDB in the labs was a fantastic way to solidify my understanding."
"I enjoyed developing multi-stage MongoDB aggregation pipelines; it's a very practical skill."
"The exercises allowed me to apply what I learned immediately, especially with refining search results using metadata."
Teaches essential query optimization methods.
"I appreciated learning practical techniques like prompt compression and effective prefiltering for real-world use."
"The course clearly explains how to apply projection and reranking to enhance search results and minimize output."
"I gained valuable insights into optimizing database operations for RAG, which is directly applicable to my projects."
Optimizes large-scale RAG applications.
"I found this course incredibly relevant for improving the performance and cost-efficiency of my RAG applications."
"The deep dive into optimizing large-scale RAG systems was exactly what I needed for my professional work."
"It's great to see a course dedicated to these specific, high-impact RAG optimization techniques."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Prompt Compression and Query Optimization with these activities:
Review linear algebra concepts
Provides a refresher on linear algebra concepts, which are used in prompt compression techniques.
Browse courses on Linear Algebra
Show steps
  • Review your notes from a previous linear algebra course.
  • Solve practice problems on linear algebra concepts.
  • Take an online course or tutorial on linear algebra.
Read Modern Information Retrieval
Provides a strong foundation in the core concepts of information retrieval, which will help you better understand the techniques covered in this course.
Show steps
  • Read the introduction and the chapters on data structures and retrieval models.
  • Complete the exercises at the end of each chapter.
  • Participate in class discussions about the book.
Complete the MongoDB tutorial on database operations
Provides hands-on experience with MongoDB, which will help you apply the techniques covered in this course.
Show steps
  • Follow the steps in the tutorial to create a database and insert documents.
  • Query the database using different filters and aggregation pipelines.
  • Update and delete documents.
Six other activities
Expand to see all activities and additional details
Show all nine activities
Participate in a study group to discuss course concepts
Provides an opportunity to discuss course concepts with other students, which can help you clarify your understanding and identify areas where you need additional support.
Show steps
  • Find a study group or create your own.
  • Meet regularly to discuss course concepts and assignments.
  • Collaborate on projects and share resources.
Mentor a junior student in the course
Provides an opportunity to share your knowledge with others, which can help you reinforce your understanding and identify areas where you need additional support.
Show steps
  • Identify a junior student who is struggling in the course.
  • Offer to help the student with their studies.
  • Meet regularly to discuss course concepts and assignments.
  • Provide feedback and support to the student.
Solve practice problems on prompt compression techniques
Provides practice in applying prompt compression techniques, which will help you optimize the efficiency of your RAG applications.
Show steps
  • Find practice problems on prompt compression techniques online.
  • Solve the problems using the techniques covered in this course.
  • Check your answers against the provided solutions.
Build a simple RAG application using MongoDB and prompt compression
Provides hands-on experience in building a RAG application, which will help you apply the techniques covered in this course to a real-world project.
Show steps
  • Design the architecture of your application.
  • Implement the vector search functionality using MongoDB.
  • Implement the prompt compression techniques covered in this course.
  • Test your application and make sure it meets your requirements.
Write a blog post or article about prompt compression techniques
Provides an opportunity to share your knowledge of prompt compression techniques with others, which can help you reinforce your understanding and identify areas where you need additional support.
Show steps
  • Choose a topic related to prompt compression techniques.
  • Research the topic and gather information.
  • Write a blog post or article that is informative and engaging.
  • Publish your blog post or article online.
Contribute to an open-source project related to prompt compression
Provides an opportunity to gain hands-on experience with prompt compression techniques and contribute to the open-source community.
Show steps
  • Find an open-source project related to prompt compression.
  • Identify an area where you can contribute to the project.
  • Make a pull request to the project.
  • Collaborate with other developers on the project.

Career center

Learners who complete Prompt Compression and Query Optimization will develop knowledge and skills that may be useful to these careers:

Reading list

We've selected 32 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Prompt Compression and Query Optimization.
The definitive practitioner blueprint for building semantic search engines, uniting dense vector embeddings, HNSW indexing, hybrid BM25-plus-vector ranking, and retrieval-augmented generation with production relevance tuning.
Foundational Stanford textbook establishing the vector space model, TF-IDF term weighting, cosine similarity, and inverted index architecture that every vector search engineer must grasp before deploying dense neural retrieval.
Analyzing the engineering trade-offs of retrieval-augmented systems at enterprise scale, Chip Huyen covers lexical BM25 versus dense vector retrieval, reciprocal rank fusion, multimodal RAG, context window ordering, and retrieval latency optimization.
Visually rich walkthrough of transformer text embeddings, bi-encoder semantic search, FAISS vector indexing, cross-encoder reranking, and RAG pipelines, helping practitioners build intuition for how modern language models encode similarity.
Enduring relevance engineering standard detailing BM25 scoring, query intent modeling, and signal weighting in Lucene and Elasticsearch, equipping search teams with the evaluation discipline needed for hybrid lexical-vector systems.
Demonstrating how to engineer a production RAG ingestion and inference pipeline alongside fine-tuned LLMs, Paul Iusztin and Maxime Labonne cover streaming feature pipelines, Qdrant vector databases, self-querying metadata filters, and hallucination telemetry.
Stanford CS246 canon on finding similar items at web scale, delivering rigorous derivations of MinHash, shingling, and Locality-Sensitive Hashing (LSH) for sub-linear approximate nearest neighbor search in high dimensions.
Gus Newton connects dense embedding pipelines with vector indexing strategies, guiding practitioners through chunking heuristics, hybrid lexical-semantic retrieval, and latency-aware RAG deployment.
Raj C Vaidyamath unpacks approximate nearest-neighbor algorithms like HNSW and IVF, showing how vector databases store, filter, and retrieve high-dimensional embeddings for production RAG workloads.
Hands-on Elastic Stack playbook demonstrating dense vector storage, HNSW graph tuning, sparse-dense hybrid scoring, and multimodal similarity retrieval across NLP, image search, observability logs, and security workloads.
Applied Hugging Face handbook showing how to fine-tune dense passage retrievers (DPR), build FAISS vector indexes, and pair fast bi-encoder recall with cross-encoder readers for scalable semantic question answering.
Jimmy Lin, Rodrigo Nogueira, and Andrew Yates trace how BERT and T5 cross-encoders and bi-encoders transformed multi-stage document ranking, providing the theoretical and empirical backbone for dense passage retrieval and modern RAG rerankers.
Bridges classical inverted-index search engines and neural retrieval, walking developers through distributed word embeddings, query-document similarity networks, and neural learning-to-rank inside production search stacks.
Craig Knoblock and Pedro Szekely detail entity resolution, ontology alignment, and graph-structured knowledge representation, providing essential foundations for GraphRAG architectures that go beyond flat vector similarity.
Dedicated algorithmic monograph formalizing Maximum Inner Product Search (MIPS), branch-and-bound pruning, Locality-Sensitive Hashing, HNSW graph navigation, inverted file clustering, and vector quantization for high-dimensional retrieval.
Jurafsky and Martin's updated third edition integrates dense passage retrieval, open-domain question answering, and retrieval-augmented language modeling directly into the core computational linguistics curriculum.
Rigorous survey of static, contextualized, and sentence-level vector representations, analyzing geometry, anisotropy, and evaluation benchmarks that explain why modern embedding models succeed or fail in semantic retrieval.
Alberto Paro delivers practical recipes for inverted-index tuning, BM25 scoring, and dense vector kNN queries in Elasticsearch 8, equipping engineers to build hybrid lexical-semantic search backends for RAG.
ChengXiang Zhai formalizes probabilistic query-likelihood models, smoothing techniques, and relevance feedback, grounding modern neural and hybrid retrieval systems in rigorous information retrieval theory.
Interdisciplinary mathematical gem illuminating concentration of measure, the Johnson-Lindenstrauss lemma, and random projections—explaining the counterintuitive geometry of distances in high-dimensional embedding spaces.
Since every RAG system is only as accurate as its underlying retriever, Trey Grainger, Doug Turnbull, and Max Irwin provide the definitive Manning guide to semantic vector search, dense-sparse hybrid ranking, knowledge graphs, and learning-to-rank pipelines.
Modern architectural guide combining vector similarity search with knowledge graph traversal, teaching developers how to pair dense semantic retrieval with structured entity relationships for multi-hop reasoning.
Building document loaders, recursive text splitters, vector-store retrievers, and conversational retrieval chains in Python, Ben Auffarth equips developers with practical patterns for grounding LLM responses in private enterprise documents.
Cross-disciplinary systems classic demystifying B-trees, LSM-trees, sharding, replication, and consensus, giving vector database engineers the storage and distributed-indexing mental models required at billion-vector scale.
Seminal MIT Press collection co-edited by LSH co-creator Piotr Indyk, charting the theoretical and algorithmic origins of high-dimensional approximate nearest-neighbor search across vision and machine learning.
Save
Tracing information architecture from ancient Alexandrian catalogs and Paul Otlet's Mundaneum to Vannevar Bush's Memex and modern search engines, Alex Wright reveals the perennial human quest to connect retrieval taxonomies with associative synthesis.
Foundational metric-space indexing treatise covering pivot-based partitioning, M-trees, distance bounds, and approximate similarity retrieval structures that preceded modern graph-based vector databases.
Classic information-theoretic reference on codebook design, Lloyd-Max optimization, and structured vector quantization, providing the mathematical bedrock behind Product Quantization (PQ) compression in FAISS and Milvus.
Provides a practical guide to metadata implementation. It covers topics such as metadata tools, technologies, and best practices.
Provides a guide to metadata management for managers. It covers topics such as metadata strategy, metadata governance, and metadata ROI.
Provides an overview of metadata for geospatial data. It covers topics such as metadata standards, metadata creation, and metadata management.
Provides an overview of metadata for archives. It covers topics such as metadata standards, metadata creation, and metadata management.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Prompt Compression and Query Optimization.
LangChain Chat with Your Data
Most relevant
Building Applications with Vector Databases
Most relevant
Create Embeddings, Vector Search, and RAG with BigQuery
Most relevant
Semantic Kernel SDK for Intelligent Applications
Most relevant
Getting Started with Mistral
Most relevant
Select a Google Cloud Database for Your Applications
Most relevant
Vector Search and Embeddings
Most relevant
Vector Databases: from Embeddings to Applications
Most relevant
Introduction to Generative AI
Most relevant

Coursera Buyer Protection & Guarantee

Verified partner policies & purchase protections

Accredited University Partner
Free Trial & Audit

7-Day Free Trial & Free Audit

7-day free trial on monthly Coursera Plus subscriptions; free audit option available on most individual courses to explore video lectures and readings at no charge.

Return & Refund Policy

14-Day Refund Guarantee

14-day refund window on annual Coursera Plus subscriptions and single-course purchases prior to certificate issuance. Monthly subscriptions do not offer refunds once billed.

Buyer Protections

Verified Academic & Industry Partner

Accredited university and industry certifications (e.g. Stanford, Google, IBM, Yale), secure SSL payment processing, and verifiable digital certificate links.

Key Purchase Protections
14-day refund window on annual Coursera Plus and single courses
7-day free trial on monthly Coursera Plus subscriptions
Free course audit option for lectures and readings
Verified certificates from top universities & companies
OpenCourser Verified Partner Policy details last reviewed: 2026-10-22
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser