LLM Basics
Large Language Models (LLMs) are deep learning models trained on massive text datasets.
Model Architecture
Popular Models
| Model | Provider | Open Source | Key Feature |
|---|---|---|---|
| GPT-4o | OpenAI | No | Multimodal, fast |
| Claude 3.5 Sonnet | Anthropic | No | Long context, code |
| Llama 3 | Meta | Yes | Open weights |
| DeepSeek-V3 | DeepSeek | Yes | Strong reasoning |
Prompt Engineering Tips
- Be specific — vague prompts get vague answers
- Provide context — give the model relevant background
- Use examples — few-shot prompting improves accuracy
- Chain of thought — ask the model to think step by step
- 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}")