I have a dataset with questions and answers to them. I want to make embeddings of questions and save them in a vector database. Next, I will make a query to the database. With the help of the pinecone service, I will be able to do what I have planned. I'm not vectorizing the answer text itself, just the question.

But I have some questions.

How do I need to provide the text of the questions in the embedding in order to summarize and simplify the search for the right embedding? That is, do I need to provide multiple questions referring to a single answer? I mean, the wording of a sentence can be different, and the answer to it can be the same.


1 Answer 1


Using Text Embeddings for Semantic Search

To create embeddings of questions and save them in a vector database for semantic search, you can utilize the OpenAI Embedding API to generate vector embeddings of your questions and then upload those vector embeddings into Pinecone, which can store and index millions/billions of these vector embeddings and search through them at ultra-low latencies.

Providing Text for Embedding

When providing text for embedding, it's important to consider the variations in the wording of questions that may lead to the same answer. To simplify the search for the right embedding, you can provide multiple questions that refer to a single answer. This approach allows the semantic search pipeline to identify the meaning between each of the queries and enables the system to return the most relevant results. By using these embeddings with Pinecone, you can effectively retrieve the desired information based on the semantic meaning of the queries.

You can refer to the documentation for more info

Hope that helps!

  • $\begingroup$ Thanks for your reply. I also thought about embedding different formulations of questions to get the same answer. To expand the search circle. But if my documentation contains a lot of information, how can I painlessly expand it? And what other ways are there to improve the quality of the search for the desired vector, besides this? $\endgroup$
    – 7wafer7
    Commented Feb 23 at 6:52
  • $\begingroup$ A couple of things come to mind; You could utilize natural language processing (NLP) models to group similar questions leading to the same answer, creating clusters of related questions for semantic search. Data augmentation techniques, such as synonym replacement and paraphrasing, can be employed to generate variations of existing questions, enriching the search space. Incorporating domain-specific knowledge and context into the embedding process, such as relevant keywords and concepts, can enhance the quality of the search for the desired vector. $\endgroup$
    – RegressIt
    Commented Feb 23 at 20:19
  • $\begingroup$ Thanks for your reply. I will try $\endgroup$
    – 7wafer7
    Commented Feb 24 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.