HyDE and Step back prompting

Introduction

In this blog, we will discuss what is HyDE and step back prompting is. HyDE ,also called as Hypothetical Document Embeddings, is query transformation technique majorly used for LLM’s. In this technique ,HyDE creates a “Hypothetical” answer with the help of LLM and then searches the embeddings for a match.

Step back prompting is somewhat similar to reverse engineering or make question more abstract and do few shot prompting. In this technique, we find questions similar to user query , or questions which are pre requisite to some user query ,which already have answers present in LLM’s. With the help of answers that we get here, we try to make answer for original question.

HyDE:

HyDE is widely used and efficient method for Large Models. Following are the steps for HyDE:

  1. Pass the user query to LLM and ask LLM to generate a document for the query’s answer. After generation of document, create vector embeddings of the document.

  2. Through this, we can get to go to good vector embeddings which will be stored in Database.

  3. Take those vector embeddings to LLM and generate output corresponding to it.

Pseudo code for the following is given in my github repo.

1
Subscribe to my newsletter

Read articles from Shrey C paunwala directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shrey C paunwala
Shrey C paunwala