Semantic Search API

What is Semantic Search?

Semantic search is about searching content using natural language, exactly the way Google does. When using semantic search, you don't need to search for exact keywords (also known as keyword search) as the AI is able to understand your request and interpret it.

Let's say that you are an HP printers reseller and that you have have thousands of documents like technical descriptions about printers, prices, terms of service... Maybe you want to make it easy to search these documents on your e-shopping website? See these 3 short documents for example:

HP® LaserJets have unmatched printing speed, performance and reliability that you can trust. Enjoy Low Prices and Free Shipping when you buy now online.
Every HP LaserJet comes with a one-year HP commercial warranty (or HP Limited Warranty).
HP LaserJet ; Lowest cost per page on mono laser printing. · $319.99 ; Wireless options available. · $109.00 ; Essential management features. · $209.00.

Now, imagine that one of your customers asks the following question on your e-shopping website:

How long is the warranty on the HP Color LaserJet Pro?

The semantic search AI model will return the following in the blink of an eye:

Every HP LaserJet comes with a one-year HP commercial warranty (or HP Limited Warranty).

Maybe your customer did not ask a properly formed question? No problem, a query like this would work too:

period warranty HP Color LaserJet Pro

So as you can see, semantic search is much more advanced than the traditional keyword search, as you can ask questions in natural language like you would do with a human. Additionally, semantic search AI is very good at performing disambiguation (understanding the meaning of a word thanks to its context).

Semantic search is a very good solution when it comes to searching and performing question answering on your own data, because it is both blazing fast and accurate.

Why Use Semantic Search?

Semantic search has made dramatic progress these last few years, both in terms of speed and accuracy. Here are some use case examples:

Website Search

It is now very common to see search bars on online websites, like e-shopping websites, technical documentation, etc. Thanks to semantic search, you can greatly improve this search feature in order to make it more relevant and accurate.

Customer Support

Support chatbots are more and more advanced. You can now ask a support AI advanced questions about your contract, product features, refund policies, etc.

Internal Knowledge Base

Employees sometimes have a hard time retrieving the right information, which makes their day-to-day job harder and slows down their productivity. A good solution is to propose an internal knowledge base that is accessible with semantic search.

Search Legal And Financial Documents

Parsing complex legal and financial documents can be a challenge. A solution here is to add these documents to the AI engine, and easily apply semantic search in order to retrieve results.

Semantic Search with Sentence Transformers.

Sentence Transformers is an amazing library that has been recently released in order to dramatically improve embeddings calculation between many pieces of text. This is useful for semantic similarity, semantic search, or paraphrase mining. It is much faster than standard Transformer-based models like Bert, Distilbert or Roberta because it uses the so called cosine-similarity technique.

Several good Sentence Transformers pre-trained models perform very well, including sometimes in many languages, like MPNet, MiniLM, DistilRoberta, MS Marco... See more details here.

Semantic Search Inference API

Building an inference API for semantic search is interesting as soon a you want to use semantic search in production. But keep in mind that building such an API is not necessarily easy. First because you need to code the API (easy part) but also because you need to build a highly available, fast, and scalable infrastructure to serve your models behind the hood (hardest part). Machine learning models consume a lot of resources (memory, disk space, CPU, GPU...) which makes it hard to achieve high-availability and low latency at the same time.

Leveraging such an API is very interesting because it is completely decoupled from the rest of your stack (microservice architecture), so you can easily scale it independently and ensure high-availability of your models through redundancy. But an API is also the way to go in terms of language interoperability. Most machine learning frameworks are developed in Python, but it's likely that you want to access them from other languages like Javascript, Go, Ruby... In such situation, an API is a great solution.

NLP Cloud's Semantic Search API

NLP Cloud proposes a semantic search API that gives you the opportunity to create your own semantic search engine with your own business data, and then perform semantic search out of the box, based on the best Sentence Transformers models.
The response time (latency) is very good for these models!

For more details, see our documentation about semantic search here.

Testing semantic search locally is one thing, but using it reliably in production is another thing. With NLP Cloud you can just do both!