LLM Temperature, Top-P, and Top-K Explained, With Python Simulations
Build temperature, top-p, top-k, and min-p sampling from scratch in Python. Interactive code, probability visuals, and a per-task cheat sheet.
Gen AI tutorials from Machine Learning Plus: hands-on guides with worked examples and code you can read, copy and run. Start with the fundamentals and work through to the applied posts in the Generative AI and NLP track.
Build temperature, top-p, top-k, and min-p sampling from scratch in Python. Interactive code, probability visuals, and a per-task cheat sheet.
Learn to use the OpenAI API in Python. Master chat completions, streaming responses, error handling, retries, and async calls with runnable examples.
Learn to build a Python AI chatbot with conversation memory using LangChain and LangGraph. Master 5 memory strategies, add a Streamlit UI, and...
Build a text classifier that hits 90%+ accuracy using only prompt engineering. Learn zero-shot, one-shot, and few-shot prompting with hands-on Python...
Build transformer attention from scratch in NumPy with runnable code. Scaled dot-product, multi-head attention, causal masking, and heatmaps step by...
Learn to train custom BPE and WordPiece tokenizers with HuggingFace for medical, legal, and domain-specific NLP. Includes evaluation metrics and code.
Benchmark tiktoken vs HuggingFace Tokenizers on speed, vocabulary, and encoding. Runnable Python code, migration guide, and decision framework for...
Learn LLM structured output in Python with 3 methods: OpenAI JSON schema, Claude tool extraction, and Instructor. Build a type-safe invoice parser...
Build a Mamba SSM layer from scratch in NumPy. Learn selective state spaces, implement selective scan, and benchmark SSM vs attention scaling with...
Build a speculative decoding simulator in Python. Learn the draft-verify algorithm, measure acceptance rates, and understand when it speeds up LLM...
Build a reward model, PPO loop, and DPO training from scratch in NumPy. Compare RLHF vs DPO side-by-side with runnable code.
Build a resilient LLM client in Python with retry, fallback chains, circuit breakers, and rate limiting, pure Python, runnable code, no SDKs needed.
Master prompt engineering basics with Python. Learn the Role-Task-Format framework, zero-shot prompting, and build a testing harness that measures...
Build sinusoidal, RoPE, and ALiBi positional embeddings from scratch in NumPy. Runnable code, heatmaps, and a clear comparison of all three schemes.
Learn OpenAI function calling in Python with 3 working tools. Build the tool-use loop, handle parallel calls, and design schemas using raw HTTP...
Master the OpenAI Batch API in Python: build a reusable pipeline for 10,000+ prompts at 50% cost with JSONL formatting, progress polling, and error...
Master the OpenAI API in Python with raw HTTP requests. Learn chat completions, streaming, parameters, error handling, retries, and cost tracking...
Learn to run LLMs locally with Ollama. Install Llama, Mistral, and DeepSeek, use the OpenAI-compatible Python API, and build a local-to-cloud...
Learn multimodal AI in Python with GPT-4o, Claude, and Gemini vision APIs. Build image classification, chart analysis, receipt OCR, and audio...
Build a zero-dep LLM toolkit in Python, unified client for OpenAI, Claude, Gemini, Ollama with cost tracking, retry, streaming, and structured output.
Build a multi-provider LLM router in Python with cost-based routing, latency tracking, and automatic fallbacks across Groq, Together AI, and...
Build a Mixture of Experts (MoE) layer in Python with NumPy. Router, top-k gating, load balancing, and expert networks, with runnable code and...
Build 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...
Measure and fix LLM position bias with Python. Build a needle-in-haystack test, plot the U-shaped curve, and implement position reordering.
Build a sliding window summarization pipeline in Python that handles documents exceeding LLM context windows. Map-reduce and recursive strategies...
Stream LLM tokens from OpenAI, Claude, and Gemini in Python using SSE and async generators. Includes FastAPI server, backpressure handling, and...
Learn LLM scaling laws and compare GPT, Claude, Gemini, Llama, Mistral, and DeepSeek on benchmarks, pricing, and context windows with interactive...
Master LLM temperature, top-k, and top-p with interactive Python simulations. Runnable code, exercises, and a sampling playground to build real...
Build a Python benchmarking harness to compare GPT-4o, Claude, Gemini, and Llama on quality, latency, and cost with LLM-as-judge and radar charts.
Build an LLM evaluation pipeline in Python with LLM-as-judge scoring, rubric design, A/B testing, and regression alerts. Runnable code examples...
Build an LLM benchmarking platform in Python from scratch. Define test suites, compare providers with raw HTTP, score with LLM-as-judge, and generate...
Learn to count LLM tokens with tiktoken, compare API pricing across OpenAI, Claude, and Gemini (March 2026), and cut costs by 90% with 10 proven...
Learn to call OpenAI, Claude, and Gemini APIs from Python in 15 minutes. Includes code examples, error handling, streaming, and a unified wrapper.
Learn how KV caching works in LLMs, calculate VRAM usage for real models, and build a PagedAttention-style cache manager with token eviction in pure...
Build a Python benchmark harness comparing Groq, Fireworks, Together AI, and Replicate on latency, throughput, and cost with runnable code.
Master Hugging Face inference in 20 minutes. Run LLMs locally with Pipeline API or serverless via HTTP, with Python examples you can copy and run.
Build a multimodal document analyzer with the Google Gemini API in Python. Analyze images, PDFs, and text with structured JSON output, using raw HTTP...
Learn how LLM context windows work, count tokens with tiktoken, estimate API costs, and build a Python token budget manager that allocates context...
Build a Constitutional AI safety loop in Python. Generate, critique, and revise LLM responses with raw API calls, no fine-tuning needed.
Build a working BPE tokenizer in Python, learn how text becomes tokens, and use tiktoken to count tokens and estimate LLM API costs across providers.
Master the Claude API with raw HTTP, messages, streaming, tool use, extended thinking, and prompt caching with runnable Python code examples.
Discover what is LangGraph, how it compares to LangChain, and when graph-based orchestration is the right choice for building reliable AI agents.
Apply prompt engineering fundamentals, zero-shot, few-shot, chain-of-thought, and structured output, to get consistent, reliable results from any LLM.
Build LangGraph agents that call tools with @tool, bind_tools, and ToolNode. Step-by-step examples for web search, database queries, and API calls in...
Learn how to build modular LangGraph apps with subgraphs you can develop, test, and reuse across projects, with full code examples and patterns.
Build LangGraph agents that return validated, typed data using Pydantic models, with automatic retry loops that self-correct on validation failures.
Add real-time streaming to your LangGraph agents, pick the right stream mode, show tokens as they arrive, and build chat UIs that feel instant.
Master LangGraph state management with TypedDict schemas, reducer functions, and add_messages. Learn how nodes share data, merge updates, and track...
Learn to build a ReAct agent from scratch in LangGraph with this hands-on guide, wire the think-act-observe loop, add tools, and debug agent cycles.
Build a RAG agent in LangGraph that routes questions, grades documents, detects hallucinations, and rewrites queries when results are poor. Full code...
Step-by-step guide to building a LangGraph SQL agent that turns plain English into SQL, runs queries, retries on errors, and explains results clearly.
Build a multi-agent research pipeline in LangGraph with planner, researcher, writer, and reviewer agents that turn any topic into a polished report.
Build a full-stack AI app from scratch with FastAPI and LangGraph, streaming responses, saved chats, API key auth, and a live chat frontend in one...
Build a LangGraph agent that reads PDFs, images, and text, cross-checks facts across sources, and writes a clean JSON report, with full code...
Learn to build a LangGraph customer support agent that classifies queries, searches a knowledge base, escalates to humans, and logs every step.
Learn to build a LangGraph pipeline that scrapes websites on its own, pulls structured data, handles pagination and errors, and writes analytical...
Deploy LangGraph agents as scalable APIs with LangGraph Server, step-by-step guide covering SDK setup, streaming, background runs, and cloud hosting.
Save and resume LangGraph agent state with checkpointers so your conversations survive crashes, restarts, and long breaks between sessions.
Master LangGraph debugging with LangSmith tracing, follow step-by-step examples to inspect agent runs, tag traces, and monitor production performance.
Build multi-agent AI systems in LangGraph using supervisor, swarm, and network patterns, with full code for each and a guide to choosing the right...
Build LangGraph agents with lasting memory using sliding windows, summaries, and cross-session stores to manage tokens and recall user context.
Learn how to run LangGraph branches in parallel using the Send API and map-reduce pattern to process multiple items at once and merge results cleanly.
Complete your LangGraph installation setup in minutes, then build and run your first StateGraph that calls an LLM and returns a response.
Learn to pause LangGraph agents for human review, accept edits, and resume safely with working interrupt and Command patterns.
Understand LangGraph nodes edges state and conditional routing through visual diagrams and runnable Python examples you can copy and extend.
Make your LangGraph agents production-ready with retry logic, fallback paths, and error tracking that keeps pipelines alive when things go wrong.
Master LangGraph cycles and recursion limits, stop runaway agents, handle GraphRecursionError, and build clean exit strategies for your loops.
Build LangGraph workflows that branch at runtime using conditional edges and routing functions. Route by LLM output, user input, or custom logic with...
Step-by-step guide to building a LangGraph agent that writes Python code, runs it safely, checks the output, and self-corrects until it works.
Follow this hands-on LangChain tutorial to master chat models, prompt templates, output parsers, and LCEL chains with runnable Python examples.
Start using the OpenAI API Python SDK today. Build your first LLM-powered app with runnable code for chat completions, streaming, and token...
Fine-tune LLMs with Unsloth, 2x faster training, 70% less GPU memory. Step-by-step guide with LoRA, QLoRA, code examples, and deployment tips.
Learn LLM evaluation from scratch -- benchmarks, metrics (BLEU, ROUGE, perplexity), LLM-as-judge, and custom pipelines with runnable Python code.
Align LLMs with human preferences using one loss function -- no reward model, no RL. Complete guide with derivation, PyTorch code, and DPO variants.
Learn how LLMs work step by step. Build an inference simulator in Python, tokenize, embed, compute attention, sample, and decode with runnable code...
Build a Python AI chatbot with conversation memory that actually remembers. Raw HTTP tutorial with streaming, 3 hands-on exercises, and complete code...
RAPTOR (Recursive Abstractive Processing for Tree-Organized Retrieval) builds a tree of increasingly abstract summaries over your documents, so RAG...
Graph RAG is an advanced RAG technique that connects text chunks using vector similari to build knowledge graphs, enabling more comprehensive and...
Fusion RAG is a technique that combines vector and keyword search scores to find more relevant documents for your system. Instead of relying on just...
Feedback Loop RAG is an advanced RAG technique that learns from user interactions to continuously improve retrieval quality over time. Unlike...
Adaptive RAG chooses the retrieval strategy from the question's complexity: no retrieval for simple queries, single-step retrieval for factual ones...
Self RAG teaches a language model to critique its own generation: decide when retrieval is needed, judge whether retrieved passages are relevant and...
Multi-Modal RAG retrieves from text and visual content together, so an AI system can answer questions from documents, images, charts and diagrams...
Document Augmentation RAG enriches documents with generated summaries, questions and metadata before indexing, so user queries match more entry...
Corrective RAG (CRAG) is an advanced RAG technique that adds a quality check layer to your retrieval system. Instead of blindly trusting retrieved...
Reliable RAG adds validation layers to retrieval-augmented generation: it checks document relevance, detects hallucinations and highlights which...
Hybrid Search RAG combines vector embeddings for semantic matches with keyword search for exact matches, then ranks and merges the results. Learn how...
Explainable Retrieval is a technique that makes RAG (Retrieval-Augmented Generation) systems transparent by showing users which documents were...
Semantic Chunking is a context-aware text splitting technique that groups sentences by meaning rather than splitting by fixed sizes. This preserves...
HyPE (Hypothetical Prompt Embeddings) is an advanced RAG enhancement technique that precomputes hypothetical questions for each document chunk during...
The optimal chunk size for RAG systems is usually 128 to 512 tokens: smaller chunks suit precise fact lookups, larger chunks keep more context for...
Relevant Segment Extraction (RSE) is a query-time post-processing technique that intelligently combines related text chunks into longer, coherent...
Learn how HyDE (Hypothetical Document Embeddings) improves RAG systems by creating richer query embeddings for smarter, more accurate AI-driven...
Learn how to build a Simple RAG system using CSV files by converting structured data into embeddings for more accurate, AI-powered question answering.
Discover how Simple RAG (Retrieval-Augmented Generation) works. This beginner’s guide breaks down how RAG works step by step with Python code...
A complete guide to Ollama, run LLMs like Llama 3, Mistral, and Gemma locally. Covers installation, model management, prompting, API usage, and...