Introduction to LLM

Adnan Siddiqi
4 min readSep 16, 2024

--

So, I am starting this GenAI series where I will share insights related to GenAI and large language models (LLMs). This is the first post, where I’ll discuss what LLMs are, how they work, and other related topics.

What are Large Language Models

Large Language Models, or LLMs, are a type of AI that can understand and generate human-like text. They’re the technology behind smart chatbots and writing tools, making our interactions with machines feel more natural.

LLMs are built on foundation models. These foundation models are large AI models pre-trained on vast amounts of unlabeled and self-supervised data to perform a wide range of tasks, serving as the base for specialized applications. This means the model learns from patterns in the data, allowing it to generate generalizable and adaptable outputs. LLMs are a specific type of foundation model, designed for text and text-related tasks. They are trained on massive amounts of text, such as books, articles, and conversations. When I say “large,” I’m referring to models trained on data measured in petabytes, and their size can range in the tens of gigabytes. LLMs are also large in terms of parameter count-parameters being values the model adjusts as it learns. The more parameters, the more complex the model. For instance, GPT-3 has 175 billion parameters, GPT-4 around 1 trillion, LLaMA has 13 billion, and Anthropic’s Claude 1 has 52 billion parameters.

How LLMs work

LLMs are based on three major components: Data, Architecture, and Training. The data part is already covered above. The architecture is based on a neural network, and for GPT, that is a transformer.

Transformers are a type of AI model designed to process and understand data, especially text, in a highly efficient way. They use a mechanism called attention to focus on important parts of the input, allowing them to handle long text sequences and capture complex relationships between words. During training, the model learns to predict the next word in a sentence. For instance, “Dog is a bird,” after multiple iterations and parameter adjustments, it matches the desired output: “Dog is an animal.”

Fine-tuned models

A fine-tuned model is a specific LLM that is trained on a specific kind of data to serve a niche. For instance, a medLLM is an LLM trained on all the data related to the medical field, hence giving more specific information to that field instead of giving wrong information or hallucinating.

What is Hullicinatation

In the context of LLMs, hallucination refers to instances when the model generates information that is incorrect, misleading, or completely made up, even though it sounds plausible. These hallucinations can occur because the model doesn’t actually know facts but instead predicts likely text based on patterns from its training data, sometimes producing false or non-existent information. Besides fine-tuning, you can reduce it by providing better input, aka a prompt.

Large Language Model (LLM) Applications

  1. Customer Support: You can create AI-based smart chat/voice bots that can replace human customer representatives and handle frequent queries. You can train an LLM using your organization’s data, FAQs, and other relevant resources to help respond effectively. For example, in the company I work for, I developed an AI-based chatbot that leverages OpenAI APIs to respond to customers. Ticket-related information is fetched via our internal API in JSON format, which is then provided to an OpenAI Assistant. The assistant responds to customers based on the ticket data in JSON format, PDFs from our knowledge base, and our custom prompt that sets a specific tone and persona.
  2. Content Creation: You can use LLMs to create articles, emails, video scripts, and a lot more.
  3. Translation: You can use LLMs to translate text from one language to another.
  4. Software Development: You can use LLMs to generate code or even fix existing code. LLMs can write tests for you and do a lot more, even converting code snippets from one language to another.
  5. Sentiment Analysis: LLMs are good for sentiment analysis. It doesn’t take much time to come up with something like this.

Conclusion

In this post, we discussed what LLMs are, how they work, and how they can be beneficial in different use cases. In the coming posts, we will discuss further how you, as a programmer, can leverage your existing coding skills to make apps and earn money. Stay tuned!

Originally published at https://blog.adnansiddiqi.me on September 16, 2024.

--

--

Adnan Siddiqi
Adnan Siddiqi

Written by Adnan Siddiqi

Pakistani | Husband | Father | Software Consultant | Developer | blogger. I occasionally try to make stuff with code. https://adnansiddiqi.me