- Architecture
- Transformer (2017)
- Training method
- Self-supervised + RLHF
- Notable models
- GPT-4, Claude, Gemini, Llama 3
- Applications
- Chatbots, code, writing, analysis
- Key metric
- Parameters (billions)
- Architecture
- Transformer (2017)
- Training method
- Self-supervised + RLHF
- Notable models
- GPT-4, Claude, Gemini, Llama 3
- Applications
- Chatbots, code, writing, analysis
- Key metric
- Parameters (billions)
How LLMs Work
The Transformer Architecture
The Transformer replaced earlier recurrent architectures (LSTM, GRU) with a self-attention mechanism that relates every token in a sequence to every other token simultaneously. This allows:- Parallel training — processing all positions in a sequence at once (vs. sequentially)
- Long-range dependencies — capturing context across thousands of tokens
- Scalability — performance reliably improves with more parameters, data, and compute
Pre-training
LLMs are pre-trained on web-scale text corpora (Common Crawl, books, code, Wikipedia, scientific papers — trillions of tokens). The model learns to compress a vast statistical model of language and factual knowledge.Fine-tuning and Alignment
Raw pre-trained models produce outputs that follow the training distribution but aren't necessarily helpful or safe. Instruction tuning trains models to follow user instructions. RLHF further shapes outputs using human preference feedback, making models more helpful, harmless, and honest.Context Window
The context window defines how much text an LLM can "see" at once. Early GPT-3 had 4k tokens; Claude 3 supports up to 200k tokens; some models reach 1M+ tokens. Longer context enables document-level reasoning and multi-document synthesis.Major Models (2024–2026)
| Model | Developer | Parameters | Context | |-------|-----------|------------|---------| | GPT-4o | OpenAI | ~200B (est.) | 128k | | Claude 3.5 Sonnet | Anthropic | Undisclosed | 200k | | Gemini 1.5 Pro | Google DeepMind | Undisclosed | 1M | | Llama 3.1 405B | Meta | 405B | 128k | | Mistral Large | Mistral AI | 123B | 128k |Capabilities and Limitations
Strengths:- Text generation, summarisation, translation
- Question answering and reasoning over documents
- Code generation and debugging
- Few-shot learning from examples in context
- Hallucinations — generating plausible but factually incorrect statements
- Knowledge cutoff — knowledge frozen at pre-training date
- Reasoning limits — struggle with multi-step mathematical reasoning
- Context faithfulness — can ignore or misinterpret provided context
- Sycophancy — tendency to agree with user premises even when wrong
- Maybank — deployed an internal LLM assistant for compliance and advisory work
- Telekom Malaysia — uses LLMs for customer support and technical documentation
- Petronas — exploring LLM-powered knowledge management for HSE and engineering documents
- government agencies — JPA and MAMPU trialling LLM for draft policy documents
Prompt Engineering
Getting consistent, high-quality output from LLMs requires skill in prompt engineering:- Clear instructions — be explicit about task, format, and constraints
- Few-shot examples — provide 2–5 examples of desired input-output pairs
- Chain-of-thought — ask the model to reason step by step before answering
- Role assignment — "Act as an experienced Malaysian lawyer…"
- Output format specification — request JSON, markdown tables, or bullet points
Retrieval-Augmented Generation (RAG)
RAG addresses the knowledge cutoff and hallucination problems by:- Vaswani, A. et al. (2017). "Attention Is All You Need." NeurIPS 2017.
- Ouyang, L. et al. (2022). "Training language models to follow instructions with human feedback." NeurIPS 2022.
- MDEC (2024). Generative AI Adoption Tracker: Malaysia Enterprise Survey Q1 2024.