Structured Output and JSON Mode: APIs and Local LLMs
When JSON mode helps and hurts, plus how to get valid JSON from local models with llama.cpp, Ollama, and vLLM. Schemas, gotchas, and Pydantic retry code.
All the articles with the tag "llm".
When JSON mode helps and hurts, plus how to get valid JSON from local models with llama.cpp, Ollama, and vLLM. Schemas, gotchas, and Pydantic retry code.
Temperature and top_p control randomness in LLMs. No probability theory needed. Just practical intuition and how to tune them.
Before you download a 70B model, calculate if it fits. The formulas, the gotchas, and a quick calculator you can actually use.
vLLM, llama.cpp, and Ollama all run local LLMs, compare throughput, memory use, GPU support, and which fits your hardware.
RAG breaks documents into chunks. But what chunk size? Too small and context is lost. Too large and semantic search fails. Here's how to pick.
LiteLLM proxies every LLM, local or cloud, behind one OpenAI-compatible endpoint. Pair it with vLLM for GPU-backed serving and ditch the SDK sprawl.
System prompts are your secret weapon. How they work, why they matter more than you think, and 5 patterns that actually change model behavior.
Q4_K_M is the default, but it's not magic. When Q3, Q5, or Q6 makes sense. How to benchmark quantization tradeoffs on your hardware.
Ollama can load one model at a time on limited hardware. How to switch between models, use CPU offloading, and manage VRAM intelligently.
What's the actual difference between context window and token limit? Why one model says 8K and another says 128K. A practical breakdown.
Most people use OpenAI's embeddings because it's easy. But local embeddings exist. How to pick and when it actually matters.
Ollama holds models in VRAM after every request. Set keep_alive, force an unload through the API, and cap how many models stay resident at once.