How Does ChatGPT Work?


OpenAI, which developed one of the most advanced language models for regular users, developed ChatGPT with the help of machine learning. ChatGPT can generate responses in natural language in a human-like conversational way. GPT stands for Generative Pre-Trained Transformer and belongs to a transformer-based model, which means the underlying technology for GPT is machine learning, just like other transformer-based models.

Courtesy: CNBC

The transformer model is one of the key mechanisms in the development of ChatGPT, which focuses on human input when generating content. For example, asking it to translate anything will take the sentence’s subject when generating the verb in the target language. It dynamically adjusts according to requirements. The company first announced GPT back in 2017.

How did OpenAI train GPT?

The company has trained this model to achieve high-quality, contextually relevant responses. To do this, they have used a vast amount of data gathered from text data on websites like Wikipedia, Twitter, Reddit, forums, and more. The company has not specifically released what it used to train its AI model. While training their GPT model, there were no specific task-oriented guidance or security measures, so they did not release their GPT model until GPT 3.5.

The company managed to use documents, books, even unpublished books, and other sources of information to predict the next word by analysing patterns in sentences. After doing this, the company started fine-tuning their AI model, which means they started designing their AI model to perform specific tasks better and following the guidelines that OpenAI has implemented on top of their GPT.

At this point, after training and fine-tuning, the GPT model could predict the next word until it generated a full response and followed the prompt along with OpenAI guidelines to generate human-like text.

It is important to know that OpenAI has also implemented several safety and ethical guidelines and fine-tuned them. Apart from this, OpenAI also offers developer environments that allow developers to build and test their apps and services around their AI model. As for general users, they can access the GPT 3.5 model for free via ChatGPT.

Let’s Understand the Key Mechanisms of How ChatGPT works.

ChatGPT processes your input data individually and calculates the next token’s probability distribution. In simple terms, it works like this:

Tokenization > Embedding > Self-Attention > Feed-Forward Neural Network > Decoder > Training > Fine-Tuning

Courtesy: TowardDataScience

  • First, the company takes your input, called Tokenization, in English and then breaks your sentence into individual words.
  • After this, it starts embedding, which GPT has learned during training and helps you learn about your prompt.
  • Now, with the Transformer model, it focuses on the subject, which is called Self-Attention, which creates a context for each input and then embeds it by determining its self-attention mechanism.
  • After embedding and self-attention, it moves to the Feed-Forward Neural Network. This type of neural network performs complex transitions on the data.
  • It starts representing the words in the token in sequence with the transformer into destruction over vocabulary, using the Softmax function with high probability as its next output.
  • It is time for the next token, which it learns during training. It makes up a sentence based on the model’s parameters on how much it can be creative, balanced, or precise.
  • That is it. After processing Fine-Tuning, which narrows down the dataset, it shows the output on your screen on ChatGPT.

Note: It can still be inaccurate and outdated with the latest events after doing such complex stuff because its dataset is limited.

OpenAI GPT Model Release Dates

Courtesy: TWO SIGMA Venture

  • GPT-1: It was first announced in June 2018 and trained over 117 million parameters.
  • GPT-2: It was announced in February 2019 and trained over 1.5 billion parameters, which makes text prediction possible.
  • GPT-3: This was the first major build, released in June 2020, with over 175 billion parameters that bring creative functionality, answer questions and a Codex through which you can write codes.
  • GPT-3.5: This was the first GPT model available for regular users. It was a subset of the GPT-3 model unveiled on March 15, 2022.

Courtesy: OpenAI

  • GPT-4: This is still in beta and will bring better accuracy and be able to solve difficult problems. It was released with a paid subscription on March 13, 2023. We can expect GPT 4.5 for general users by late 2023.


Courtesy: OpenAI

Certainly, it does have some limitations, starting with a need for more understanding. It cannot understand anything; this model follows the dataset and the patterns it learned during training. This means it could lead to some inaccuracies because it is obvious that it will find something wrong with the pattern it follows because of its prompt. It always says, “While writing, be specific and write a good prompt that helps AI understand better.” It is also sensitive to input, so anything you write that may completely change the question’s meaning will generate something completely different. ChatGPT also has no clarification and may sometimes be excessively verbose and overuse certain phrases.

Lastly, some important questions need to be taken into consideration. It may be biased and could reflect and perpetuate the biases present in the data. Since it is free for everyone, there is a risk that someone may use ChatGPT to generate deep-fake text, spam, or disinformation. On top of that, there is a privacy risk, and lastly, over-reliance on ChatGPT could lead to a decrease in critical thinking and writing skills.

Share This Article
Leave a comment