Large Language Models (LLMs) have revolutionized how we interact with AI, offering unprecedented capabilities in natural language understanding and generation. This blog post serves as a practical guide to accessing and using various LLMs available today, demonstrating how to leverage their power through code examples using Python.
LLM Classification Framework
Based on three key factors: architecture, availability, and domain specificity
-
Architecture-Based LLMs
- Autoregressive Models (like GPT): Generate text by predicting next tokens sequentially
- Autoencoding Models (like BERT): Focus on understanding context through masked token prediction
- Seq2Seq Models (like T5): Specialized in transforming text from one form to another
-
Availability-Based LLMs
- Open-Source Models: Free to use/modify (Examples: LLaMA, BLOOM, Falcon)
- Proprietary Models: Commercial/restricted access (Examples: GPT-4, PaLM, Claude)
-
Domain-Specific LLMs
- General-Purpose: Versatile models for multiple tasks
- Specialized Models: Tailored for specific industries (Healthcare, Finance, Legal)
Technical Considerations
Each LLM platform offers unique capabilities and trade-offs. Consider factors like:
- Infrastructure requirements vary by model size
- Hardware needs (GPUs, memory, storage)
- Deployment considerations for optimal performance
- Cost and pricing models
- API availability and reliability
- Model performance and capabilities
- Privacy and data handling requirements
Popular LLMs
The LLM ecosystem is vibrant and diverse, with numerous models and platforms, here are some most popular and widely used LLMs currently:
- GPT Family (OpenAI): Known for powerful text generation
- BERT Family (Google): Excels in contextual understanding
- PaLM Family (Google): Uses Mixture of Experts architecture
- Gemini (Google DeepMind): Advanced model with multimodal capabilities
- LLaMA Family (Meta): Focus on efficiency and accessibility
- Claude Family (Anthropic): Emphasizes safety and ethical AI
- Grok Family (X): Large Language Model developed by Elon Musk's team at X
- DeepSeek-R1: an open-source reasoning model for tasks with complex reasoning, mathematical problem-solving and logical inference.
Getting Started: Essential Setup
Before we dive into specific examples, ensure you have the necessary tools:
- Python: Install a recent version of Python.
- Package Installation: Use pip to install the required libraries. We'll specify these as we go.
- API Keys/Credentials: Most LLM providers require API keys or service account credentials for authentication. You'll need to create accounts on the respective platforms and obtain these credentials. Keep these secure!
Keeping in mind the costs and pricing on various LLMs, we'll be exploring open-source models
Hugging Face Transformers
Hugging Face provides open-source access to a wide range of models, including BERT, Llama-2, Llama-3 and more.
- Llama-3 from Meta
import os
from dotenv import load_dotenv
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
# Load environment variables from .env file
load_dotenv()
# Initializing Hugging Face TOKEN
HF_TOKEN = os.getenv("HF_TOKEN")
# Model
model_id = "meta-llama/Llama-3.2-3B"
# Using pipeline
pipeline = transformers.pipeline("text-generation",
token=HF_TOKEN,
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto")
response = pipeline("Hey how are you doing today")
print()
print(response[0]['generated_text'])
Response:
Let's explore more models on Part 2 of this blog
References
- Types of LLMs: Classification Guide by Label Your Data
- 25 of the best large language models in 2025 by TechTarget
Top comments (0)