What Is A Large Language Model? A Complete Guide

Learn everything you need to know about large language models like GPT-4 in one place. Explained by our AI experts.
Technical
May 23, 2023
What Is A Large Language Model? A Complete Guide

Large language model (LLM) is a relatively new term, at least to the wider public. Now, it seems like everyone is talking about LLMs, especially in the context of OpenAI’s ChatGPT and GPT-4.

But what is a large language model, exactly? And what can it do? 

With years of experience in machine learning and AI under our belt, we have a pretty good idea. Here's everything you need to know, explained with zero tech jargon. 

What Is A Large Language Model?

A large language model (LLM) is a deep learning algorithm that can recognize, extract, summarize, predict, and generate text written in a human language, such as English or Spanish.   

We could also say that a large language model is a model that can perform natural language processing (NLP). NLP can be further split into two components: 

  • natural language understanding (NLU) and 
  • natural language generation (NLG).

However, it’s important to note that a large language model may also be trained to understand and generate other types of languages – like programming languages such as Python or JavaScript.

ChatGPT producing a Python code based on a natural-language prompt. 

LLMs are large because of two reasons: 

  • they are trained on massive amounts of data, such as books, websites, and articles, and
  • they comprise a huge number of learnable parameters – i.e., representations of the underlying structure of training data that help them interpret and act on new or never-before-seen data. 

Some LLMs have as many as billions of parameters. But more on that later.

For now, let’s see which NLP tasks LLMs may be able to perform.

What Natural Language Processing (NLP) Tasks Can LLMs Perform?

A typical large language model can perform many traditional natural language processing tasks, as well as their more contemporary counterparts. 

Here are just some:

Machine translation involves translating texts from one language to another.

  • Contemporary applications: code translation, multilingual customer support

Text Summarization involves generating text summaries.

  • Contemporary applications: Abstractive summarization of legal documents, summarizing and extracting key info from customer reviews

Sentiment analysis involves determining the sentiment of a given text (e.g., positive, negative, and neutral). 

  • Contemporary applications: social media monitoring and analysis, real-time customer feedback analysis

Text classification involves assigning predefined categories or labels to a given text.

  • Contemporary applications: content moderation, filtering spam vs non-spam emails

Text generation (also known as language modeling and completion prediction) involves generating text like blog posts or chat messages.

  • Contemporary applications: virtual assistants, creative text generation, code generation

The list does not end here. There are many more NLP tasks that LLMs can perform, and we’ll introduce some more below when discussing two contemporary LLMs. 

Also, one large language model may be capable of performing only one, some, or a multitude of NLP tasks. This will depend on its training.

Two Types Of Large Language Models

As mentioned, different LLMs can perform different (sets of) tasks – and with varying performance. With that in mind, we can distinguish between two types of large language models:

  • Foundation or base LLMs. These LLMs are trained on vast amounts of data from various sources and can perform a wide range of NLP tasks. However, they may not excel at performing any one specific task, which is why they often serve as the starting point for further customization or fine-tuning. You can think of them as generalists.
  • Fine-tuned or customized LLMs. These LLMs are fine-tuned versions of foundation large language models. They’re the result of training base LLMs on more specific datasets. They may not be able to perform as many different tasks as base LLMs, but they typically excel at performing specific tasks or performing them for specific domains. You can think of them as specialists.

For example: 

🔥 ChatGPT is not a base language model. It’s fine-tuned from OpenAI’s gpt-3.5-turbo-0301, which is further based on text-davinci-002.

Text-davinci-002 itself is also fine-tuned from other base models which we won’t go into here. Instead, let’s analyze how gpt-3.5-turbo-0301 and text-davinci-002 impact ChatGPT: 

🔥 gpt-3.5-turbo-0301 enables ChatGPT to engage in dialogues with users – because GPT-3.5 Turbo is optimized for chat.

🔥 text-davinci-002 enables it to perform well on tasks like question answering, text generation, or text summarization because it is itself optimized for these tasks.

However, OpenAI had an additional motive to base ChatGPT on existing, pre-trained models (PrLMs):

By basing ChatGPT on PrLMs, OpenAI was able to leverage the knowledge that the base models have gained during their own training – and avoid training ChatGPT on massive amounts of general data from scratch.

This is called transfer learning (TL), and it’s the biggest reason why researchers opt for fine-tuning existing pre-trained models rather than developing them from scratch. It helps them minimize the resources and the time they’ll need for training, and generally achieve better model performance.

Examples Of Large Language Models

Now that we’ve got the theory out of the way, let’s examine two examples of real, contemporary LLMs.

GPT-4

OpenAI’s GPT-4 can perform many “standard” NLP tasks, including question answering, text generation, and many more. But it’s not your average large language model. 

It’s also a multimodal model, which means it can accept different forms of input data – more specifically, images and text. 

For example, it could accept a photo of your kitchen ingredients as input: 

Flour, eggs, milk, and other kitchen ingredients on a table. 
Source: OpenAI

And help you brainstorm meals you could make with them:

GPT-4’s response mentioning meals that could be made with the above ingredients, such as pancakes and waffles‍

At the moment of writing, GPT-4 outperforms all existing LLMs on several traditionally-used benchmarks for machine learning models. It performed especially well on HellaSwag, a benchmark that measures “commonsense reasoning on everyday events.” 

Its advanced reasoning skills enable it to better understand the context of inputs, make informed decisions, and engage in natural and coherent conversations with humans – as seen above.

MT-NLG

NVIDIA’s Megatron-Turing Natural Language Generation model (MT-NLG) was trained on 270 billion tokens from English-language websites and has an astounding count of 530 billion parameters

Parameters influence the model’s ability to capture language patterns and produce accurate responses. So, typically, the more parameters a model has, the better it performs.

NVIDIA claims this is precisely the case with MT-NLG. They state that the LLM shows “unmatched accuracy” in a wide range of NLP tasks, like:

  • Completion prediction 
  • Commonsense reasoning 
  • Reading comprehension – Involves comprehending written text and extracting relevant information to provide accurate answers.
  • Natural language inferences – Involves identifying whether the second sentence contradicts, entails, or is neutral to the meaning of the first sentence. It’s a good indicator of an LLM’s reasoning capabilities.
  • Word sense disambiguation – Involves identifying the most appropriate sense of a word with multiple meanings based on its surrounding words or the overall context.

The Benefits Of A Large Language Model

A large language model can automate any task that involves language. This includes more obvious text tasks, such as writing emails or content, but also tasks like analyzing paystubs to verify a person’s income or fixing code.

Here are just some general benefits this entails:

  • Accelerating or completely eliminating manual processes
  • Reducing the risk of human error
  • Reducing expenses

Depending on the specific use case, LLM can also help companies or individuals:

  • Quickly understand any topic
  • Provide better customer support
  • Free up employees from tedious tasks
  • Offer innovative, conversation-based services or products
  • Quickly generate synthetic data instead of collecting it – For example, healthcare institutions can use LLMs to generate synthetic clinical data for medical research instead of collecting real patient data and conducting time-consuming anonymization processes.
  • And much more!

The benefits largely depend on how you use large language models – for which tasks and in which domain? As we’ve discussed, the possibilities are nearly endless. 

However, to better illustrate this, let’s quickly review some popular apps based on large language models.

Popular Applications Of Large Language Models

Here are some of the most popular LLM-powered apps.

Jasper, Copy.ai & Lex

Jasper, Copy.ai, and Lex all fall into the same bucket: they’re all writing apps based on GPT-3.

Jasper and Copy.ai are mostly marketing-oriented and have specific categories for different types of content that users may want to create: blog posts, ad copy, and so on. 

Lex is more free-form:

Lex generating content based on our prompt.

All three apps can help users research any topic and generate customized content in a fraction of the time.

Be My Eyes Virtual Volunteer™

Be My Eyes Virtual Volunteer™ is the first-ever digital visual assistant for people who are blind or have low vision. 

It’s powered by GPT-4, whose unique image-to-text capabilities help users make better decisions and successfully navigate everyday situations.

Be My Eyes Virtual Volunteer helping a user determine which of the two shirts is the red striped one.
Source: Be My Eyes

GitHub Copilot 

GitHub Copilot is an AI pair programmer powered by OpenAI Codex – a GPT-3’s descendant that specializes in writing code.

The app helps developers write and test code, fix bugs, and complete existing code based on prompts written in natural language. 

Source: GitHub Copilot

The Challenges Of A Large Language Model

While large language models certainly have a lot of benefits, we need to mention some potential downfalls, too. 

  • Large language models can be prone to plagiarism. They may repeat word sequences – or even paragraphs – from their training data word for word. It seems like models like ChatGPT can repeat previous inputs entered by other users, too.
  • Large language models can provide generic answers. Besides reproducing the data they’ve seen during training, LLMs may also produce one-size-fits-all responses that aren’t tailored to your specific requests. This can be improved with techniques like Reinforcement Learning from Human Feedback (RLHF), or by fine-tuning a model on your unique datasets. 
  • Large language models may produce harmful outputs. If there are no proper restrictions in place, users can use LLMs to produce harmful content – even malware or phishing emails. However, LLMs may produce toxic content regardless of the user's intention. Some are known for spewing biases or inaccurate information, mostly as a reflection of their training data. This, too, can be improved with RLHF.
ChatGPT rejecting our request to explain a good way to bully someone.‍

Some models, like ChatGPT, are now trained to reject harmful requests that violate established ethical principles.

  • Large language models can be challenging to interpret. It may be difficult to establish how LLMs make decisions. This can be problematic, especially in industries that require a high level of transparency and accountability, like healthcare or finance. For example, it may be risky to rely on LLMs to make decisions about patient care if we don’t know how they arrive at their decisions and can’t double-check their reasoning.

How Do Large Language Models Work?

Large language models are based on deep neural networks called transformers – which is why they’re often called  “neural language models.” 

The transformer architecture typically consists of an encoder and a decoder. The encoder processes inputs; the decoder generates outputs. Each encoder and decoder layer in transformers contains self-attention heads and feed-forward neural networks.

Source: Attention Is All You Need


The transformer model architecture.

  • The self-attention heads help the model understand how words relate to each other and capture the overall meaning and context of inputs.
  • The feed-forward neural networks process the information learned from the self-attention heads. By analyzing and transforming that information, they help the model make sense of the input and generate accurate responses.

But still, how do large language models know which outputs would satisfy our requests in the first place? For example, how do they know the right words to use to complete our sentences? After all, computer systems don’t speak English. 🤷

The answer lies in the pre-training phase. 

As mentioned, large language models are exposed to massive amounts of data during pre-training. 

Sometimes, researchers label the data to help models make sense of it. Other times, the models learn from data on their own. This is called unsupervised learning – and is arguably the most popular machine learning technique today.

A graphic illustrating how unsupervised machine learning works
Source: Nixus

Unsupervised learning entails capturing, analyzing, and learning the statistical patterns and relationships within data. The goal of this process is to enable the model to accurately predict missing or masked words in sentences. 

For example, let's imagine that an LLM is asked to fill in the blank in the following sentence:

"The book is written by a __." 

Let’s also imagine that the model observed statistical patterns and typical associations of the words “book” and “written” during its pre-training phase; and that it learned they’re often connected with words like "author," "poet," or "novelist.” 

In that case, the model may complete the sentence like this: 

“The book is written by a renowned author.”

It’s much less likely to produce this version: 

 "The book is written by a sandwich." 

…not because it understands semantics, but because it bases its decisions on statistical regularities – i.e., the probability distribution of words and their associations within the training data. 

So, we can conclude that training data plays a huge role in how LLMs work:

  • The statistical patterns and associations from the training data will guide the model’s predictions and responses.
  • Models can replicate or amplify biased, limited, or inaccurate information from the training data in their outputs.
  • Domain- or industry-specific data can improve model performance. This is called fine-tuning, and is exactly what we do when customizing LLMs for the needs of a particular organization.

The Future Is Here — Get Ready

Large language models have taken the world by storm, and they aren’t going anywhere. Prepare for the future by exploring our other free resources:

  • Download this free eBook on large language models for enterprises that we co-authored with NVIDIA.
  • Read more posts like this on our blog. 
  • Subscribe to our newsletter to get curated news and information about large language models from our experts.
Want to learn more about Generative AI Agents for your business? Enter your email and we’ll contact you as soon as possible
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.