Skip to content

LLM Basics

Large Language Models (LLMs) are deep learning models trained on massive text datasets.

Model Architecture

ModelProviderOpen SourceKey Feature
GPT-4oOpenAINoMultimodal, fast
Claude 3.5 SonnetAnthropicNoLong context, code
Llama 3MetaYesOpen weights
DeepSeek-V3DeepSeekYesStrong reasoning

Prompt Engineering Tips

  1. Be specific — vague prompts get vague answers
  2. Provide context — give the model relevant background
  3. Use examples — few-shot prompting improves accuracy
  4. Chain of thought — ask the model to think step by step
  5. Set constraints — limit length, format, or tone

Tokenization

python
# Example: counting tokens
import tiktoken

enc = tiktoken.get_encoding("cl100k_base")
tokens = enc.encode("Hello, how are you?")
print(f"Token count: {len(tokens)}")
print(f"Tokens: {tokens}")