You are on page 1of 12

MEOR AMER

JUL 07, 2022

Large Language Models and Where to Use


Them: Part 1
Over the past few years, large language models (LLMs) have evolved from emerging to
mainstream technology. In this blog post, we'll explore some of the most common
natural language processing (NLP) use cases that they can address. This is part one of
a two-part series.

NLP API

SHARE:

TWITTER FACEBOOK
You can find Part 2 here.

A large language model (LLM) is a type of machine learning model that can handle a
wide range of natural language processing (NLP) use cases. But due to their
versatility, LLMs can be a bit overwhelming for newcomers who are trying to
understand when and where to use these models.

In this blog series, we’ll simplify LLMs by mapping out the seven broad categories of
use cases where you can apply them, with examples from Cohere's LLM platform.
Hopefully, this can serve as a starting point as you begin working with the Cohere API,
or even seed some ideas for the next thing you want to build.

The seven use case categories are:

1. Generate

2. Summarize

3. Rewrite
4. Extract

5. Search/Similarity

6. Cluster
7. Classify

Because of the general-purpose nature of LLMs, the range of use cases and relevant
industries within each category is extremely wide. This post will not attempt to delve
too deeply into each, but it will provide you with enough ideas and examples to help
you start experimenting.
1. Generate

Probably the first thing that comes to mind when talking about LLMs is their ability to
generate original and coherent text. And that’s what this use case category is all
about. LLMs are pre-trained using a huge collection of text gathered from a variety of
sources. This means that they are able to capture the patterns of how language is
used and how humans write.

Getting the best out of these generation models is now becoming a whole field of
study in and of itself called prompt engineering. In fact, the first four use case
categories on our list all leverage prompt generation in their own ways.

More on the other three later, but the basic idea in prompt engineering is to provide a
context for a model to work with. Prompt engineering is a vast topic, but at a very high
level, the idea is to provide a model with a small amount of contextual information as
a cue for generating a specific sequence of text.
One way to set up the context is to write a few lines of a passage for the model to
continue. Imagine writing an essay or marketing copy where you would begin with the
first few sentences about a topic, and then have the model complete the paragraph or
even the whole piece.

Another way is by writing a few example patterns that indicate the type of text that we
want the model to generate. This is an interesting one because of the different ways
we can shape the models and the various applications that it entails.

Let’s take one example. The goal here is to have the model generate the first
paragraph of a blog post. First, we prepare a short line of context about what we’d like
the model to write. Then, we prepare two examples — each containing the blog’s title,
its audience, the tone of voice, and the matching paragraph.

Finally, we feed the model with this prompt, together with the information for the new
blog. And the model will duly generate the text that matches the context, as seen
below.

This program will generate an introductory paragraph to a blog post given

a blog title, audience, and tone of voice.

--

Blog Title: Best Activities in Toronto

Audience: Millennials

Tone of Voice: Lighthearted

First Paragraph: Looking for fun things to do in Toronto? When it comes to

exploring Canada's largest city, there's an ever-evolving set of

activities to choose from. Whether you're looking to visit a local museum

or sample the city's varied cuisine, there is plenty to fill any

itinerary. In this blog post, I'll share some of my favorite

recommendations

--
Blog Title: Mastering Dynamic Programming

Audience: Developers

Tone: Informative

First Paragraph: In this piece, we'll help you understand the fundamentals

of dynamic programming, and when to apply this optimization technique.

We'll break down bottom-up and top-down approaches to solve dynamic

programming problems.

--

Blog Title: How to Get Started with Rock Climbing

Audience: Athletes

Tone: Enthusiastic

First Paragraph:

Completion:

Interested in trying rock climbing? Whether you're a beginner or a

seasoned climber, you'll find a wealth of options for the perfect rock

climbing excursion. In this piece, I'll share some of the best rock

climbing spots in the United States to help you plan your next adventure.

You can test it out by accessing the saved preset.

In fact, the excerpt you read at the beginning of this blog was generated using this
preset!

That was just one example, but how we prompt a model is limited only by our
creativity. Here are some other examples:

— Writing product descriptions, given the product name and keywords


— Writing chatbot/conversational AI responses
— Developing a question-answering interface

— Writing emails, given the purpose/command


— Writing headlines and paragraphs

2. Summarize

The second use case category, which also leverages prompt engineering, is text
summarization. Think about the amount of text that we deal with on a typical day, such
as reports, articles, meeting notes, emails, transcripts, and so on. We can have an LLM
summarize a piece of text by prompting it with a few examples of a full document and
its summary.

The following is an example of article summarization, where we prepare the prompt


to contain the full passage of an article and its one-line summary.

Prompt:

Passage: Is Wordle getting tougher to solve? Players seem to be convinced

that the game has gotten harder in recent weeks ever since The New York

Times bought it from developer Josh Wardle in late January. The Times has

come forward and shared that this likely isn't the case. That said, the

NYT did mess with the back end code a bit, removing some offensive and

sexual language, as well as some obscure words There is a viral thread

claiming that a confirmation bias was at play. One Twitter user went so

far as to claim the game has gone to "the dusty section of the dictionary"
to find its latest words.

TLDR: Wordle has not gotten more difficult to solve.

--

Passage: ArtificialIvan, a seven-year-old, London-based payment and

expense management software company, has raised $190 million in Series C

funding led by ARG Global, with participation from D9 Capital Group and

Boulder Capital. Earlier backers also joined the round, including Hilton

Group, Roxanne Capital, Paved Roads Ventures, Brook Partners, and Plato

Capital.

TLDR: ArtificialIvan has raised $190 million in Series C funding.

--

Passage: The National Weather Service announced Tuesday that a freeze

warning is in effect for the Bay Area, with freezing temperatures expected

in these areas overnight. Temperatures could fall into the mid-20s to low

30s in some areas. In anticipation of the hard freeze, the weather service

warns people to take action now.

TLDR:

Completion:

A hard freeze is expected to hit the Bay Area tonight.

You can test it out by accessing the saved preset.

Here are some other example documents where LLM summarization will be useful:
— Customer support chats
— Environmental, Social, and Governance (ESG) reports
— Earnings calls

— Paper abstracts
— Dialogues and transcripts

3. Rewrite

Another flavor of prompt engineering is text rewriting. This is another of those tasks
that we do every day and spend a lot of time on, and if we could automate them, it
would free us up to work on more creative tasks.

Rewriting text can mean different things and take different forms, but one common
example is text correction. The following is the task of correcting the spelling and
grammar in voice-to-text transcriptions. We prepare the prompt with a short bit of
context about the task, followed by examples of incorrect and corrected
transcriptions.

Prompt:

This is voice-to-text transcription corrector. Given a transcribed excerpt

with errors, the model responds with the correct version of the excerpt.

Incorrect transcription: I am balling into hay to read port missing credit

card. I lost by card when I what's at the grocery store and I need to see
sent a new one.

Correct transcription: I am calling in today to report a missing credit

card. I lost my card when I was at the grocery store and I need to be sent

a new one.

--

Incorrect transcription: Can you repeat the dates for the three and five

dear fixed mortgages? I want to compare them a gain the dates I was quoted

by a other broker.

Correct transcription: Can you repeat the rates for the three and five

year fixed mortgages? I want to compare them against the rates I was

quoted by another broker.

--

Incorrect transcription: I got got charged interest on ly credit card but

I paid my pull balance one day due date. I not missed a pavement year yet.

Man you reverse the interest charge?

Correct transcription:

Completion:

I got charged interest on my credit card last month but I paid my balance

in full on the due date. I haven't missed a payment yet. Man, you reverse

the interest charge?

You can test it out by accessing the saved preset.

Here are some other example use cases for using an LLM to rewrite text:
— Paraphrase a piece of text in a different voice
— Build a spell checker that corrects text capitalizations
— Rephrase chatbot responses
— Redact personally identifiable information

— Turn a complex piece of text into a digestible form

4. Extract

Text extraction is another use case category that can leverage a generation LLM. The
idea is to take a long piece of text and extract only the key information or words from
the text.

The following is the task of extracting relevant information from contracts. We


prepare the prompt with a short bit of context about the task, followed by a couple of
example contracts and the extracted text.

Prompt:

This program will extract relevant information from contracts. Here are

some examples:

Contract: This influencer Marketing Agreement ("Agreement") dated on the

23 day of August, 2022 (the "Effective Date") is made between Oren & Co

(the "Influencer") and Brand Capital (the "Company") regarding. The


Company will compensate the Influencer with five thousand dollars

($5000.00) for the overall Services rendered. This Agreement is effective

upon its signing until July 31, 2023, when the final LinkedIn post is

uploaded and all Services and compensation are exchanged.

Extracted Text:

Influencer: Oren & Co

Company: Brand Capital

--

Contract: This Music Recording Agreement ("Agreement") is made effective

as of the 13 day of December, 2021 by and between Good Kid, a Toronto-

based musical group ("Artist") and Universal Music Group, a record label

with license number 545345 ("Recording Label"). Artist and Recording Label

may each be referred to in this Agreement individually as a "Party" and

collectively as the "Parties." Work under this Agreement shall begin on

March 15, 2022.

Extracted Text:

Completion:

Artist: Good Kid

Recording Label: Universal Music Group

You can test it out by accessing the saved preset.

Some other use cases in this category include:

— Extract named entities from a document


— Extract keywords and keyphrases from articles
— Flag for personally identifiable information
— Extract supplier and contract terms
— Create tags for blogs

Conclusion
In part two of this series, we’ll continue our exploration of the remaining three use
case categories (Search/Similarity, Cluster, and Classify). We’ll also explore how LLM
APIs can help address more complex use cases. The world is complex, and a lot of
problems can only be tackled by piecing multiple NLP models together. We’ll look at
some examples of how we can quickly snap together a combination of API endpoints in
order to build more complete solutions.

Get access to the Cohere platform here.

KEEP READING

You might also like