What is Generative AI, Large Language Model and How to use it

Lal Zada
4 min readJun 25, 2024

--

Source: canva.com

Generative AI

Generative AI is a type of Artificial Intelligence under Deep Learning which generates new content based on input data after it is trained. It can generate Text, Image, Audio & Video as new data.

Text Generation

  • ChatGPT (Generative Pre-trained Transformer), Gemini
  • E.g Gmail Autocomplete

Text to Image

Text to Video

  • OpenAI Sora
  • Synthesia

Text to Audio

  • Beatbot
  • Beathove

Non Generative AI

Non-Generative AI is used for making Decisions and Doesn’t generate any new content.

Perform computations based on input data

Spam Filters: Analyze email to determine whether an incoming message is spam or not

Recommendation systems: Suggest personalized content or products based on a user’s preferences and past behavior

LLM — Large Language Model

LLM is a type of Generative AI that can recognize and generate new content that mirrors human language.

Learn patterns and predict next words.

LLMs are trained on huge sets of data — hence the name “Large.”

LLMs are trained on by feeding books, articles, wikipedia, research papers etc.

LLMs are trained on billions of parameters:

  • ChatGPT — 1.7 trillion parameters (from OpenAI)
  • LLAMA 3 — 400 billion parameters (from Meta)

After an LLM is trained on huge amount of data from all over the internet, books, wikipedia and research papers, you can use it to predict and generate data. ChatGPT is an example of LLM which is trained on trillion of parameters

How to use LLMs

To use these LLMs either for your personal use or for commercial use within your application, there are different options.

Use provided solutions from OpenAI, Meta and Google

All of the above LLMs are free to use on these provided platforms as they are built and managed by their parent companies i.e OpenAI, Meta and Google.

But to use these LLMs in your application using their APIs, not all of them are free and open source.

ChatGPT is available through OpenAI API where you need to pay per token.

1 token is roughly equal to 1 word. Cost can be calculated here for OpenAI GPT Models https://platform.openai.com/tokenizer

Google Gemini is available through Google AI API where you need to pay per token.

1 token is roughly equal to 1 word. Cost can be calculated here for Google AI LLM Models https://cloud.google.com/vertex-ai/generative-ai/pricing#:~:text=Price-,Gemini%20Pro,-Multimodal

Meta LLAMA has a different story than 2 others, its free and open source but to use it on your own machine, it requires a machines with a desired set of CPU/GPU and RAM. More details on LLAMA requirements can be found here https://llamaimodel.com/requirements/

Image Source: https://llamaimodel.com/requirements/

LLAMA is also deployable on all cloud service providers like

AWS: SageMaker, Jumpstart and Bedrock

Google Cloud Platform: Model Garden on Vertex AI

Azure:

  • Models as a Service (MaaS) provides access to Meta Llama hosted APIs through Azure AI Studio
  • Model as a Platform (MaaP) provides access to Meta Llama family of models with out of the box

More details are available here https://llama.meta.com/docs/llama-everywhere/running-meta-llama-in-the-cloud/

How can i integrate it in my application?

GPT at https://platform.openai.com/docs/introduction (Paid — per tokens/words)

LLAMA at https://llama.meta.com/docs/get-started (Free & open source)

Gemini at https://ai.google.dev/gemini-api/docs (Paid — per tokens/words)

use LLM — GPT

In the next post, we’ll go kick off the OpenAI series using Python by starting with OpenAI Basics in Python

Watch it on YouTube

--

--

Lal Zada

New Tech Article Twice a Week - A software engineer over a decade experience in building apps, infrastructure and CI/CDs