LLM Foundations & Prompting Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation of each tool and framework before being relied on in production.

This section’s bibliography lists the reference material consulted while preparing these pages.

A single-page index of quick back-links to every page in this sub-section, grouped the same way as the sub-section itself — handy for jumping straight to the topic you need instead of paging through the full navigation.

The downloadable PDF is a separate, single A4 page meant for printing. It states the version baseline this sub-section targets (Python 3.12, the current anthropic and openai SDKs against claude-sonnet-5 and the current OpenAI flagship line, Hugging Face transformers 5.17, tiktoken 0.14.0, Ollama 0.34, and Spring Boot 4.1 / Spring AI 2.0.1 — re-verified as current on 2026-09-28) and covers:

  • tokens and costs, and the token-to-cost formula;

  • the self-attention formula;

  • a recommended sampling table per task;

  • context-window rules (KV cache, prompt caching, "lost in the middle");

  • the prompt anatomy template;

  • the prompting-technique catalogue;

  • structured-output snippets for Anthropic, OpenAI, Ollama and Spring AI;

  • the context-engineering checklist;

  • the model-selection flowchart;

  • benchmark notes;

  • the latency and cost formulas; and

  • the end-to-end reference architecture.