Notes
02 elasticsearch
Initializing search
Blog Notes
01 agents system design
02 jax
02 llm modeling
02 llm models popular
02 open source tools
02 python3
02 pytorch
Notes
Blog Notes
01 agents system design
01 agents system design
Agentic System Design: Comprehensive Knowledge Base
01 foundations
01 foundations
Part 1: Foundations - Core Concepts
Agent Anatomy: Components of an Agentic System
Agent Loop: Perception-Reasoning-Action-Reflection
Design Philosophy: Core Principles for Agentic Systems
Evolution: From Classical AI to LLM Agents
02 core design patterns
02 core design patterns
Part 2: Core Design Patterns
Andrew Ng's 4 Core Patterns
Anthropic's 5 Workflow Patterns
12 Foundational Patterns: The Complete Map
Pattern Selection Framework: Choosing the Right Patterns
03 architecture
03 architecture
Part 3: Architecture & Orchestration
Single Agent Architecture: The Foundation
Multi-Agent Systems: Coordinating Multiple Agents
Coordination Strategies: How Agents Communicate
Graph-Based Orchestration: DAGs and Workflows
Hierarchical Agent Systems: Manager-Worker Architecture
04 memory systems
04 memory systems
Part 4: Memory Systems
Memory Fundamentals: Types, Purpose, and Architecture
Short-Term Memory: Context Window Management
Long-Term Memory: Persistent Storage Systems
Vector Stores & Retrieval: Semantic Search
Memory Compression: Making Memories Efficient
Episodic & Procedural Memory: Different Memory Types
05 planning reasoning
05 planning reasoning
Part 5: Planning & Reasoning
Planning Fundamentals: Task Decomposition & Goal Hierarchies
Chain-of-Thought: Step-by-Step Reasoning
Tree-of-Thought: Exploring Multiple Reasoning Paths
Goal-Oriented Reasoning: Working Toward Objectives
Adaptive Planning: Responding to Change
06 tool use
06 tool use
Part 6: Tool Use & Grounding
Function Calling: Structured Tool Invocation
Tool Interfaces: Designing Effective Tool APIs
Tool Composition: Chaining Tools Together
Error Handling: Building Reliable Tool Execution
Tool Discovery: Finding the Right Tools
Grounding in Reality: Ensuring Reasoning Matches Truth
07 safety reliability
07 safety reliability
Part 7: Safety & Reliability
Safety Fundamentals: Building Trustworthy Agents
Input Validation & Injection Prevention
Output Safety & Content Filtering
Bounded Execution: Preventing Runaway Agents
Policy Enforcement: Setting & Enforcing Boundaries
Monitoring & Detection: Catching Issues in Production
Reliability Patterns: Building Dependable Systems
08 evaluation
08 evaluation
Part 8: Evaluation & Benchmarking
Agent Benchmarks: Industry Standards & Evaluation Suites
Multi-Dimensional Assessment: Beyond Accuracy
Lab vs Production: The 37% Gap
Custom Evaluation Frameworks: Domain-Specific Assessment
Behavioral Testing: Finding What Breaks
09 production patterns
09 production patterns
Part 9: Production Patterns
State Management & Recovery: Durability & Consistency
Routing & Escalation: Smart Request Distribution
Human-in-the-Loop: Hybrid Autonomy at Scale
Context Management: Controlling Token Costs
Observability & Monitoring: Seeing What Happens
Error Recovery: Building Resilient Systems
10 advanced topics
10 advanced topics
Part 10: Advanced Topics
Reflection & Self-Critique: Agent Self-Awareness
Self-Evolution & Learning: Agents That Improve Over Time
Emergent Behaviors: When Systems Do the Unexpected
Swarm Agents: Collective Intelligence at Scale
Reasoning Optimization: Variable Depth Thinking
11 frameworks
11 frameworks
Part 11: Implementation Frameworks
LangGraph: State Graph-Based Agent Development
11 frameworks technologies
11 frameworks technologies
Part 11: Frameworks & Technologies
MCP Protocol: The Bridge Between Agents and Tools
MCP 2.0: Enhanced Capabilities & Performance
Skills System: Reusable Agent Capabilities
Claude Agents API: Building & Deploying Agents
Subagents: Agent Orchestration & Scaling
LangGraph: Graph-Based Agent Workflows
CrewAI: Multi-Agent Team Coordination
AutoGen: Multi-Agent Conversation Framework
Additional Frameworks & Quick Reference
Framework Comparison & Decision Guide
Structured Outputs: Reliable Function Calling
Prompt Caching: Cost Optimization Protocol
Batch Processing API: Scaling for High Volume
Vision & Multimodal: Agents with Images & Video
Extended Thinking & Reasoning: o1/o1-mini
Agent Protocol: Agent-to-Agent Communication
Function Calling Protocol Variations: Claude vs OpenAI
Streaming Protocol: Real-Time Agent Responses
SDK Specifics: Anthropic vs OpenAI
Message Protocol: Multi-Agent Communication Standards
12 applications
12 applications
Part 12: Real-World Applications
Enterprise Use Cases: Real Business Value
Code Generation & Software Development
Research & Analysis: Knowledge Work Automation
Creative Applications: Content & Marketing
Integration Patterns: Connecting to Systems
Scaling Strategies: From MVP to Enterprise
02 jax
02 jax
JAX: Composable Transformations for Numerical Computing
01 fundamentals
01 fundamentals
Fundamentals
Chapter 1: JAX Philosophy & Core Concepts
Chapter 2: NumPy-like API & Arrays
Chapter 3: Pure Functions & Immutability
02 core transformations
02 core transformations
Chapter 4: Automatic Differentiation - jax.grad
Chapter 5: Just-In-Time Compilation - jax.jit
Chapter 6: Vectorization - jax.vmap
Chapter 7: Parallelization - jax.pmap
03 advanced patterns
03 advanced patterns
Chapter 8: Composing Transformations
Chapter 9: Control Flow in JAX
Chapter 10: Custom Derivatives
04 machine learning
04 machine learning
Chapter 11: Building Neural Networks with JAX
Chapter 12: Flax Framework
Chapter 13: Training Loops & Advanced Optimization
05 production & performance
05 production & performance
Chapter 14: Performance Optimization
Chapter 15: Device Management (CPU, GPU, TPU)
Chapter 16: Debugging JAX Code
02 llm modeling
02 llm modeling
LLM Optimization & Modeling Knowledge Base
00 fundamentals
00 fundamentals
Fundamentals
00 tokenization
00 tokenization
Index
00 tokenization fundamentals
BPE: Byte Pair Encoding - The Most Common Tokenization Method
SentencePiece: Language-Agnostic Tokenization
Token Efficiency & Compression: Reducing Token Count
Tokenization Best Practices: Tips, Tricks & Common Pitfalls
Multilingual Tokenization: Scripts, Spaces & Costs
WordPiece: BERT's Tokenizer
01 attention
01 attention
Attention Mechanisms
RNN, LSTM & GRU: Attempts to Fix Long Context
Query, Key & Value: The Core Intuition
Scaled Dot-Product Attention
Types of Attention
Multi-Head Attention
Position Information: The Missing Ingredient
Attention Complexity & Cost
PyTorch Implementation of Attention
Interpretability: What Attention Actually Learns
01 architecture
01 architecture
01-Architecture: LLM Design & Optimization
01 core designs
01 core designs
Mixture of Experts (MoE): Scaling to Trillions of Parameters
Multi-Query Attention (MQA) & Grouped Query Attention (GQA)
Rotary Position Embeddings (RoPE)
Sliding Window Attention: Efficient Long-Context Attention
02 attention optimization
02 attention optimization
Flash Attention v2: Improvements and Differences from v1
Flash Attention: Complete Technical Guide
Kernel Fusion: Complete Technical Guide
03 memory management
03 memory management
KV Cache: Comprehensive Technical Guide
PagedAttention: Detailed Technical Guide
04 batching
04 batching
Continuous Batching: Complete Technical Guide
Medusa: Multi-Head Decoding for Faster Inference
Speculative Decoding: Complete Technical Guide
02 training
02 training
01 efficiency
01 efficiency
Distributed Training: Multi-GPU and Multi-Node LLM Training
Gradient Checkpointing: Trading Compute for Memory
Mixed Precision Training (AMP): Speed and Memory with Reduced Precision
02 scaling
02 scaling
Scaling Laws & Optimal Allocation: Computing the Perfect Model Size
03 compression
03 compression
Model Distillation: Compressing Knowledge into Smaller Models
Pruning & Sparsity: Removing Redundant Parameters and Activations
Token Merging: Reducing Attention Compute by Merging Tokens
04 adaptation
04 adaptation
Adapter Methods Beyond LoRA: Efficient Fine-tuning Alternatives
LoRA: Low-Rank Adaptation - Complete Technical Guide
QLoRA: Quantized LoRA - Complete Comparison with LoRA
05 alignment
05 alignment
Rlhf
Finetuning
Finetuning
Domain-Specific Fine-tuning: Adapting to Your Industry
DPO: Direct Preference Optimization - Learning from Preferences Without RL
Fine-tuning Best Practices: Tips, Tricks & Common Pitfalls
Fine-tuning Fundamentals: Adapting Models to Your Task
Instruction Tuning & SFT: Teaching Models to Follow Instructions
03 inference
03 inference
01 optimization
01 optimization
Decoding Strategies: Beam Search vs Greedy vs Sampling
Length Extrapolation & Long Context: Training for Generalization to Longer Sequences
LLM Inference Optimization: Complete Guide to Production Serving
02 quantization
02 quantization
AWQ Quantization: Complete Technical Guide
GPTQ Quantization: Complete Technical Guide
03 knowledge integration
03 knowledge integration
Rag
Rag
Chunking & Document Preparation: Preparing Documents for RAG
RAG Evaluation & Metrics: Measuring Performance
Retrieval-Augmented Generation (RAG): Fundamentals
RAG Integration & Prompt Engineering: Using Retrieved Context Effectively
Reranking & Ranking: Improving Retrieval Quality
Retrieval Strategies: Finding the Right Documents
Vector Databases & Embeddings: The Foundation of RAG
Frameworks
Frameworks
Framework Comparison & Selection Guide
Inference Frameworks Fundamentals: Choosing the Right Tool
vLLM: Fast and Easy LLM Inference
04 production
04 production
01 deployment
01 deployment
Agent Framework Integration: LLM Deployment in Agentic Systems
Cost Optimization Strategies: Reducing Training and Inference Expenses
Load Balancing & Request Routing: Efficient Multi-Model Serving
02 operations
02 operations
Model Merging & Ensemble Methods: Combining Models for Better Performance
Monitoring & Observability: Production LLM Systems
Safety & alignment
Safety & alignment
Prompt Injection & Adversarial Examples: Attack Patterns & Defenses
Safety & Alignment Fundamentals: Keeping LLMs Safe and Aligned
05 benchmarks
05 benchmarks
LLM Benchmarks & Evaluation Framework
Research Benchmarks: Measuring LLM Capabilities
Production Metrics: Measuring Business Value
Capability Classification: Understanding Model Tiers & Specialization
Building Custom Benchmarks & Evaluation Frameworks
02 llm models popular
02 llm models popular
Popular LLM Models: A Comprehensive Overview
GLM: General Language Model Family
Anthropic
Anthropic
Anthropic: Safety-First Frontier
Claude 1: Anthropic's Initial Release
Claude 2 / 2.1: Improved Reasoning
Claude 3 Family: Frontier Models
Deepseek
Deepseek
DeepSeek: Chinese Focus, Global Impact
DeepSeek LLM: General Purpose
DeepSeek Coder: Programming Specialist
DeepSeek MoE: Efficient Scaling
Google
Google
Google: Diverse Model Portfolio
Google BERT: Bidirectional Encoder Representations from Transformers
Google T5: Text-to-Text Transfer Transformer
Google PaLM: Dense Scaling
Google Gemini: Multimodal Frontier
Kimi
Kimi
Kimi: Chinese LLM Leader
Kimi: Long-Context Chinese LLM
Meta
Meta
Meta: Open Weights Leadership
Meta Llama 1: First Open Model
Meta Llama 2: Production Ready
Meta Llama 3: Frontier Open Model
Mistral
Mistral
Mistral AI: Efficiency Innovation
Mistral 7B: Efficient Baseline
Mixtral 8x7B: Sparse MoE Innovation
Mixtral 8x22B: Large-Scale Sparse
Openai
Openai
OpenAI: Leading the Frontier
GPT-3: The Breakthrough Model (175B)
GPT-3.5: The Production Workhorse
GPT-4: OpenAI's Frontier Model
02 open source tools
02 open source tools
Open-Source Tools for LLM Development
01 training
01 training
Part 1: LLM Training Tools
TRL: Transformer Reinforcement Learning
Axolotl: Flexible Multi-Method Training Framework
Unsloth: Ultra-Fast LoRA Training
Ludwig: No-Code ML Framework
02 inference
02 inference
Part 2: LLM Inference & Serving
vLLM: Complete Guide to High-Performance LLM Serving
Ollama: Simple Local Model Running
TensorRT-LLM: NVIDIA GPU Optimization
04 litellm
03 agent building
03 agent building
Part 3: Agent Building Frameworks
LangChain: Comprehensive Guide
02 llamaindex
03 crewai
04 autogen
Haystack: NLP Pipeline Framework
04 knowledge management
04 knowledge management
Part 4: Knowledge Management & RAG
01 chroma
02 elasticsearch
Milvus: Production-Scale Vector Database
LanceDB: AI-Native Vector Database
05 tool integration
05 tool integration
Part 5: Tool Integration & Orchestration
Composio: Universal Tool Integration
06 monitoring
06 monitoring
Part 6: Monitoring & Observability
01 langfuse
Weights & Biases: Experiment Tracking
MLflow: ML Lifecycle Management
07 infrastructure
07 infrastructure
Part 7: Supporting Infrastructure
FastAPI: Modern Python Web Framework
Docker: Containerization for Deployment
Kubernetes: Container Orchestration
04 langgraph
02 python3
02 python3
Python for ML & LLM Inference
How Python Features Enable ML Frameworks
Complete Outline: Python for ML & LLM Inference
Python for ML & LLM Inference - Quick Start
01 fundamentals
01 fundamentals
Type System & Annotations
Data Structures Essentials for ML
Iterator & Generator Protocol
Context Managers & Resource Management
02 object oriented patterns
02 object oriented patterns
Object-Oriented Patterns
Classes & Inheritance
Decorators: Framework Magic
Magic Methods: Special Methods for ML Frameworks
Descriptors & Properties
Metaclasses & Advanced OOP
03 functional programming
03 functional programming
Functional Programming: A Different Paradigm for ML
Functional Programming Fundamentals
Higher-Order Functions & Closures
Function Composition & Piping
Immutability & Persistent Data Structures
JAX & Functional ML
04 c extensions & ffi
04 c extensions & ffi
C Extensions & FFI: Escaping Python for Speed
ctypes & CFFI: Calling C Code from Python
Cython: C Performance with Python Syntax
PyBind11: Modern C++ Integration
05 memory & performance
05 memory & performance
Memory & Performance
Reference Counting & Garbage Collection
Memory Layout & Cache Efficiency
Global Interpreter Lock (GIL): Python's Threading Limitation
Multithreading vs Multiprocessing: Choosing the Right Model
Async/Await: Asynchronous I/O for High Concurrency
Memory Profiling & Optimization
05 memory\ \&\ performance
05 memory\ \&\ performance
Memory & Performance: Optimization for ML Systems
Reference Counting & Garbage Collection
Memory Layout & Cache Efficiency
Global Interpreter Lock (GIL): Python's Threading Limitation
Multithreading vs Multiprocessing: Choosing the Right Model
06 dynamic features
06 dynamic features
Dynamic Features: Runtime Flexibility
getattr/setattr & Proxy Objects
Introspection & Reflection: Runtime Inspection
07 advanced typing
07 advanced typing
Advanced Typing: Static Type Hints
Type Hints & Validation
Generics & Protocols: Advanced Type Systems
08 module system
08 module system
Module System: Organization & Packaging
Packages & Organization: Building Professional Python Projects
Imports & Dependencies: Managing Code Reuse
09 bytecode & execution
09 bytecode & execution
Bytecode & Execution: Python Runtime Fundamentals
Python Bytecode Fundamentals
Execution Model & Compilation
JIT Compilation & Optimization
Profiling & Performance Analysis
Custom Bytecode & Metaprogramming
10 ml specific patterns
10 ml specific patterns
ML-Specific Patterns
Tensor Abstractions: NumPy, PyTorch, JAX
Autograd Implementation: Forward and Backward Passes
Distributed Training: DataParallel to DistributedDataParallel
Model Serialization: Saving and Loading Models
Custom Operators: Extending PyTorch with CUDA Kernels
Inference Optimization Patterns
02 pytorch
02 pytorch
🧠Advanced PyTorch Techniques
01 foundations & tensor mastery
01 foundations & tensor mastery
Foundations & Tensor Mastery
Tensor Internals — Storage, Views & Strides
Autograd — The Gradient Engine
Device & Memory Management
Precision & Numerics — dtypes, fp16, bf16, fp8
02 module & layer engineering
02 module & layer engineering
Module & Layer Engineering
Custom Layers & Advanced Containers
Weight Initialization
Parameter Sharing & Weight Tying
Hooks — Debug, Inject, Extract
03 custom autograd & model transformation
03 custom autograd & model transformation
Custom Autograd & Model Transformation
Custom Autograd.Function
Higher-Order Gradients & Jacobians
fx — Symbolic Model Transformation
04 performance & compilation
04 performance & compilation
Performance & Compilation
torch.compile Deep Dive
CUDA Graphs
Memory Formats & Layouts
Profiling & Benchmarking
Kernel Fusion at the PyTorch Level
05 distributed training
05 distributed training
Distributed Training
DDP in Depth
FSDP Deep Dive
Tensor & Pipeline Parallelism
Checkpointing & Fault Tolerance
06 mixed precision & quantization
06 mixed precision & quantization
Mixed Precision & Quantization
Automatic Mixed Precision
BF16, FP8 & Low-Precision Numerics
Post-Training Quantization
Quantization-Aware Training
07 export, deployment & production
07 export, deployment & production
Export, Deployment & Production
Export — TorchScript, ONNX, torch.export
Inference Optimization & Serving
C++ & libtorch Integration
08 advanced training techniques
08 advanced training techniques
Advanced Training Techniques
Gradient Accumulation & Clipping
Model Averaging — EMA, SWA
Activation Checkpointing & Memory Restructuring
Schedules, Warmup & Optimizer Tricks
09 custom c++ and cuda extensions
09 custom c++ and cuda extensions
Custom C++ / CUDA Extensions
Building C++ Extensions
Writing Custom CUDA Kernels
Extensions in Practice & Pitfalls
02 elasticsearch
Back to top