Text · Embeddings · Transformers · BERT · GPT · Fine-tuning · RAG · Agents
Neural network learns dense 100-300 dim vectors where semantically similar words cluster together. Trained by predicting neighbors in a large text corpus.
Positional encoding injects sequence order (Transformers have no inherent notion of order unlike RNNs).
Bidirectional attention — sees full sequence. Best for: classification, NER, question answering, semantic search.
Causal (masked) attention — only sees past tokens. Best for: text generation, chat, code generation, reasoning.
Encoder processes input, decoder generates output. Best for: translation, summarization, structured prediction.
Autoregressive: predict next token. Scales amazingly — GPT-4 shows emergent abilities from sheer scale.
Instead of updating the full weight matrix W₀, learn a low-rank decomposition. With r=16, only 0.1-1% of parameters need training.
Quantize base model to 4-bit (NF4), apply LoRA on top. Enables fine-tuning 70B LLMs on a single A100 GPU. Use bitsandbytes library.
Reason → Act → Observe → Repeat
LLM reasons about what to do, calls a tool (search, code exec, API), observes result, reasons again until task is complete.