Tutorials
Learn it by running it
461 free tutorials on Python, SQL, machine learning, generative AI and statistics. The examples run right in the page, so you can change the code and see what happens.
/
Try:
Latest tutorials
Newest first · 1 to 30 of 461
- Generative AI and NLPLLM Temperature, Top-P, and Top-K Explained, With Python SimulationsBuild temperature, top-p, top-k, and min-p sampling from scratch in Python. Interactive code, probability visuals, and a per-task cheat sheet.
- Generative AI and NLPOpenAI API Python Tutorial, Chat Completions, Streaming & Error HandlingLearn to use the OpenAI API in Python. Master chat completions, streaming responses, error handling, retries, and async calls with runnable examples.
- Generative AI and NLPBuild a Python AI Chatbot with Memory Using LangChainLearn to build a Python AI chatbot with conversation memory using LangChain and LangGraph. Master 5 memory strategies, add a Streamlit UI, and persist chats to SQLite.
- Generative AI and NLPBuild a BPE Tokenizer from Scratch in Python, Step-by-Step GuideBuild a working BPE tokenizer in Python step by step. Learn how LLMs split text into tokens, implement byte pair encoding, and count tokens with tiktoken.
- Practice exercises101 Polars Exercises for Data Analysis (with Solutions)Master Polars with 101 hands-on exercises and solutions, covering DataFrames, groupby, joins, window functions, lazy eval, and more.
- Generative AI and NLPZero-Shot vs Few-Shot Prompting: Complete GuideBuild a text classifier that hits 90%+ accuracy using only prompt engineering. Learn zero-shot, one-shot, and few-shot prompting with hands-on Python examples.
- Generative AI and NLPTransformer Attention from Scratch in NumPy (Python)Build transformer attention from scratch in NumPy with runnable code. Scaled dot-product, multi-head attention, causal masking, and heatmaps step by step.
- Generative AI and NLPTrain a Custom Tokenizer with HuggingFace (Python)Learn to train custom BPE and WordPiece tokenizers with HuggingFace for medical, legal, and domain-specific NLP. Includes evaluation metrics and code.
- Generative AI and NLPtiktoken vs HuggingFace Tokenizers: Benchmark GuideBenchmark tiktoken vs HuggingFace Tokenizers on speed, vocabulary, and encoding. Runnable Python code, migration guide, and decision framework for your LLM apps.
- Generative AI and NLPLLM Structured Output: JSON Mode & Pydantic GuideLearn LLM structured output in Python with 3 methods: OpenAI JSON schema, Claude tool extraction, and Instructor. Build a type-safe invoice parser with Pydantic.
- Generative AI and NLPMamba & State Space Models: Build a Mini SSM LayerBuild a Mamba SSM layer from scratch in NumPy. Learn selective state spaces, implement selective scan, and benchmark SSM vs attention scaling with runnable code.
- Generative AI and NLPSpeculative Decoding: Faster LLM Inference (Python)Build a speculative decoding simulator in Python. Learn the draft-verify algorithm, measure acceptance rates, and understand when it speeds up LLM inference.
- Generative AI and NLPRLHF & DPO Explained: Simulate Alignment in PythonBuild a reward model, PPO loop, and DPO training from scratch in NumPy. Compare RLHF vs DPO side-by-side with runnable code.
- Generative AI and NLPLLM API Retry & Fallback: Build a Resilient ClientBuild a resilient LLM client in Python with retry, fallback chains, circuit breakers, and rate limiting, pure Python, runnable code, no SDKs needed.
- Generative AI and NLPPrompt Engineering Tutorial for Beginners (2026)Master prompt engineering basics with Python. Learn the Role-Task-Format framework, zero-shot prompting, and build a testing harness that measures prompt accuracy.
- Generative AI and NLPPositional Embeddings: RoPE & ALiBi Explained (Python)Build sinusoidal, RoPE, and ALiBi positional embeddings from scratch in NumPy. Runnable code, heatmaps, and a clear comparison of all three schemes.
- Generative AI and NLPOpenAI Function Calling Tutorial in Python (2026)Learn OpenAI function calling in Python with 3 working tools. Build the tool-use loop, handle parallel calls, and design schemas using raw HTTP requests.
- Generative AI and NLPOpenAI Batch API: Process 10K Prompts at 50% CostMaster the OpenAI Batch API in Python: build a reusable pipeline for 10,000+ prompts at 50% cost with JSONL formatting, progress polling, and error handling.
- Generative AI and NLPOpenAI Chat Completions API: Complete Python GuideMaster the OpenAI API in Python with raw HTTP requests. Learn chat completions, streaming, parameters, error handling, retries, and cost tracking with runnable examples.
- Generative AI and NLPOllama Tutorial: Run LLMs Locally (Llama, Mistral)Learn to run LLMs locally with Ollama. Install Llama, Mistral, and DeepSeek, use the OpenAI-compatible Python API, and build a local-to-cloud fallback client.
- Generative AI and NLPMultimodal AI Tutorial: GPT-4o Vision & Audio APILearn multimodal AI in Python with GPT-4o, Claude, and Gemini vision APIs. Build image classification, chart analysis, receipt OCR, and audio transcription with raw HTTP.
- Generative AI and NLPBuild a Multi-Provider LLM Toolkit (Python Project)Build a zero-dep LLM toolkit in Python, unified client for OpenAI, Claude, Gemini, Ollama with cost tracking, retry, streaming, and structured output.
- Generative AI and NLPLLM API Router: Groq, Together AI & OpenRouterBuild a multi-provider LLM router in Python with cost-based routing, latency tracking, and automatic fallbacks across Groq, Together AI, and OpenRouter.
- Generative AI and NLPMixture of Experts (MoE): Build a Router in PythonBuild a Mixture of Experts (MoE) layer in Python with NumPy. Router, top-k gating, load balancing, and expert networks, with runnable code and exercises.
- Generative AI and NLPMHA vs GQA vs MQA: Attention & KV Cache GuideBuild MHA, GQA, and MQA attention from scratch in NumPy. Calculate KV cache VRAM for Llama 3 70B, Mistral 7B, and any model with a reusable calculator.
- Generative AI and NLPLost-in-the-Middle: Fix LLM Position Bias (Python)Measure and fix LLM position bias with Python. Build a needle-in-haystack test, plot the U-shaped curve, and implement position reordering.
- Generative AI and NLPLong-Context LLMs: Sliding Window Summarization GuideBuild a sliding window summarization pipeline in Python that handles documents exceeding LLM context windows. Map-reduce and recursive strategies with raw HTTP API calls.
- Generative AI and NLPLLM Streaming Tutorial: SSE in Python Step-by-StepStream LLM tokens from OpenAI, Claude, and Gemini in Python using SSE and async generators. Includes FastAPI server, backpressure handling, and runnable code.
- Generative AI and NLPLLM Scaling Laws: Model Comparison Dashboard (2026)Learn LLM scaling laws and compare GPT, Claude, Gemini, Llama, Mistral, and DeepSeek on benchmarks, pricing, and context windows with interactive Python charts.
- Generative AI and NLPTemperature, Top-p & Top-k in LLMs Explained (Python)Master LLM temperature, top-k, and top-p with interactive Python simulations. Runnable code, exercises, and a sampling playground to build real intuition.