Skip to main content
All CollectionsContent StorageParameters
Minimum Similarity: Understanding & Setting It Correctly
Minimum Similarity: Understanding & Setting It Correctly

Understand the role of "Minimum Similarity" in OpenAI Embedding, what it does, and how you can fine-tune it to achieve the desired output.

Promptitude Team avatar
Written by Promptitude Team
Updated over a week ago

Hey there! If you're using OpenAI embedding for your projects, you might have come across the term 'minimum similarity' and wondered what it means and how to set it correctly.

No worries, we're here to help you understand this concept in the simplest way possible. Let's dive in!

What is OpenAI Embedding?

OpenAI embedding is a powerful tool that helps you convert words, phrases, or even sentences into numerical representations called embeddings. These embeddings can then be used to perform various tasks like finding similar words, grouping words by topics, and much more.

What is the 'Minimum Similarity' Parameter?

When you're working with OpenAI embedding, you might want to find words or phrases that are similar to a given input. This is where the 'minimum similarity' parameter comes into play.

It's a value between 0 and 1, which determines the threshold for how similar two embeddings must be for them to be considered similar.

For example, if you set the minimum similarity to 0.8, then only the embeddings with a similarity score of 0.8 or higher will be considered similar.

In other words, the higher the minimum similarity value, the more similar the embeddings must be.

How to Set the 'Minimum Similarity' Parameter Correctly?

Setting the 'minimum similarity' parameter correctly is crucial for achieving the desired results with OpenAI embedding. Here are some guidelines to help you set it properly:

1️⃣ Understand your use case

The ideal minimum similarity value depends on your specific use case. If you're looking for very similar words or phrases, you might want to set a higher value. On the other hand, if you're interested in exploring a broader range of related words, a lower value might be more appropriate.

2️⃣ Start with a default value

If you're unsure about the best value to start with, try using a default value of around 0.7. This usually works well for most use cases and can be adjusted later based on your results.

3️⃣ Experiment and iterate

The best way to determine the optimal minimum similarity value is to experiment with different values and observe the results. Try different values and see how they affect your output. If you're getting too many unrelated words, try increasing the value. Conversely, if you're not getting enough results, try lowering it.

4️⃣ Keep the range in mind

Remember that the minimum similarity value should be between 0 and 1. A value of 0 would mean that all embeddings are considered similar, while a value of 1 would mean that only identical embeddings are considered similar. Choose a value within this range that works best for your needs.

Tips 📌

When setting the 'minimum similarity' parameter, it is important to consider the size of the vocabulary you are using.

If you are using a large vocabulary, such as 200,000 words, then it is recommended to set the 'minimum similarity' parameter to a low value. This will ensure that the model includes as many words as possible.

On the other hand, if you are using a small vocabulary, such as 5,000 words, then it is recommended to set the 'minimum similarity' parameter to a high value. This will ensure that the model only includes words that are highly similar.

Conclusion

The 'minimum similarity' parameter in OpenAI embedding plays a critical role in determining the similarity threshold for your project.

By understanding your use case, starting with a default value, experimenting with different values, and keeping the range in mind, you'll be able to set the minimum similarity parameter correctly and make the most of OpenAI embedding.

Happy experimenting!

Did this answer your question?