Short Course

Prompt Compression and Query Optimization

In Collaboration With

MongoDB

Intermediate

>

1 Hour

>

Richmond Alake

  • Combine vector search capabilities with traditional database operations to build efficient and cost-effective RAG applications.

  • Learn how to use pre-filtering, post-filtering, and projection techniques for faster query processing and optimized query output.

  • Use prompt compression techniques to reduce the length of prompts that are expensive to process in large-scale applications.

What you’ll learn in this course

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: 

  • 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.
  • Projection: This technique involves selecting a subset of the fields returned from a query to minimize the size of the output.
  • Reranking: This involves reordering the results of a search based on other data fields to move the more desired results higher up the list.
  • 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: 

  • Implement vector search for RAG using MongoDB.
  • Develop a multi-stage MongoDB aggregation pipeline. 
  • Use metadata to refine and limit the search results returned from database operations, enhancing efficiency and relevancy.
  • 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.
  • Rerank documents to improve information retrieval relevance and quality, and use metadata values to determine reordering position.
  • 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.

Who should join?

This course is suitable for those who are familiar with Python and have a basic understanding of databases and vector search.


Instructor

Richmond Alake

Richmond Alake

Instructor

Developer Advocate at MongoDB

Course access is free for a limited time during the DeepLearning.AI learning platform beta!

Want to learn more about Generative AI?

Keep learning with updates on curated AI news, courses, and events, as well as Andrew’s thoughts from DeepLearning.AI!