SuperAPIAI Directory

Large Language Models and Where to Use Them: Part 2

cohere.ai · AI developer platforms

This is the second part of Cohere's official blog series, on common natural language processing (NLP) use cases for large language models (LLMs). Following the four categories of uses already introduced in the first part—generation, summarization, rewriting, and extraction—the article continues by explaining three more categories of scenarios: search/similarity, clustering, and classification, and explains how to combine these capabilities. Using Cohere's Embed and Classify endpoints as examples, it introduces implementation approaches such as text embeddings, semantic search, k-means clustering, and sentiment analysis, and lists examples such as enterprise document retrieval, product recommendations, customer feedback categorization, and content moderation. The article is a conceptual and application-oriented explanation and does not provide specific product pricing or deployment details.

Open website Alternatives
PlatformsWeb

About this tool

This article is the second in Cohere's blog series "Large Language Models and Where to Use Them," aimed at developers and teams who want to understand when and where to use LLMs in NLP. The article groups LLM applications into seven major categories of scenarios; this installment focuses on the latter three: search/similarity, clustering, and classification, and discusses how to combine different types to build more useful applications.

  1. Search/Similarity The article notes that, beyond text generation, LLMs also have text representation capabilities. Text representation is used to understand existing text rather than generate new text. The goal of similarity search is: given a text query, find the documents most similar to the query. Modern search engines rely not only on keyword matching but also on semantic similarity, that is, matching based on meaning, context, topic, and concept. For example, when a user searches for "ground transportation at the airport," the search engine should be able to understand that they may be looking for services such as taxis, car rentals, or trains, even if the user does not explicitly mention those words. In terms of implementation, after text is fed into a representation model, the model generates a set of numbers that represent the meaning or context of the input text, namely "text embeddings." LLM embeddings are usually long sequences of numbers with thousands of dimensions; the longer the dimensions, the more textual information is stored. Cohere provides such models through the Embed endpoint. The article gives a Python notebook example: given a question, the search engine returns the frequently asked questions (FAQs) whose text embeddings are most similar, and visualizes all the questions on a two-dimensional plot, where the closer two points are, the more semantically similar they are. This approach can be extended to retrieving relevant documents within an organization, recommending similar products, e-commerce product search, recommending the next article based on reading history, selecting a chatbot response from a candidate list, and more.

  2. Clustering Clustering also uses text embeddings; its goal is to organize a set of documents and understand how they relate to one another. Similar to similarity search, clustering first visualizes the documents but adds a step: grouping the documents through a clustering algorithm (such as k-means). When using k-means, the number of clusters must be specified, and the algorithm returns the cluster to which each document belongs. The article gives a Python notebook example that likewise uses the Embed endpoint to process three thousand Hacker News "Ask HN" posts: first generate a text embedding for each post, then cluster the posts into smaller groups by topic, summarize each group's topic with keywords, and finally visualize them on a plot, with one color representing one topicclusters. The examples include topics such as life, careers, programming, entrepreneurship, and computer science. This technique can be used to organize customer feedback and requests by topic, classify products based on product descriptions, summarize ESG reports and news into themes, organize large volumes of company documents, discover emerging topics in survey analysis, and more.

III. Classification The article states that text classification may currently be the most widely used NLP application. Classification is similar to clustering but different: clustering is "unsupervised learning," where the clusters are not known in advance and only the number of clusters needs to be specified, with the algorithm grouping by that number; classification is "supervised learning," where the classes are known in advance. For example, suppose there is a batch of e-commerce customer inquiries that need to be categorized by purpose into three classes: Shipping, Returns, and Tracking. For the classifier to work, it must first be trained with enough texts and their true classes, such as "Do you offer same day shipping?" corresponding to Shipping. The article provides a notebook example that uses the Classify endpoint for sentiment analysis, classifying text into three classes: Positive, Neutral, and Negative. Typical applications of text classification include: toxic content on online platforms, chatbot intent classification, e-commerce products, assigning e-commerce support tickets to the correct team, and more.

IV. Combinations and Limitations The article points out that the above are only a few examples, and that any company or team today can solve difficult NLP problems through simple API calls to frontier models, rather than being limited to a few large players. The article is conceptual and application-oriented and does not include specific product pricing, deployment, or performance data; implementation details need to refer to the mentioned Cohere Embed and Classify endpoints and the corresponding notebook.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools