Topic

LLM Prompt Engineering

All digests tagged LLM Prompt Engineering

Stanford CS229 Machine Learning | Spring 2026 | Lecture 16: Basic Concept in RL, Policy Gradient thumbnail

· 1:13:19

Stanford CS229 Machine Learning | Spring 2026 | Lecture 16: Basic Concept in RL, Policy Gradient

This lecture provides an advanced deep dive into optimizing Transformer architectures for efficiency and adapting Large Language Models (LLMs) for various downstream tasks. Key focus areas include reducing the quadratic complexity of attention through techniques like Grouped Query Attention (GQA) and Sliding Window Attention; scaling models using Mixture of Experts (MoE) to decouple memory from compute; and exploring prompt-based methods such as In-Context Learning, Few-Shot, and Zero-Shot learning for task adaptation without updating model parameters.

Key takeaways

  1. Efficiency in Attention Mechanisms 20:04

    The standard self-attention mechanism has $O(T^2)$ complexity (where T is sequence length). To mitigate this, techniques like Grouped Query Attention (GQA) reduce the number of keys and values used across heads by mapping multiple query groups to a smaller set of shared keys/values. Similarly, Sliding Window Attention limits attention to only recent history, reducing complexity to $O(T imes W)$ where W is the window size.

  2. Scaling with Mixture of Experts (MoE) 42:28

    MoE allows models to have a large total parameter count (e.g., 30B) while keeping the active computation small (e.g., 3B). This is achieved by using a routing module that directs an input vector to only a subset of specialized expert sub-networks, significantly improving compute efficiency.

  3. LLM Adaptation via Prompting 56:48

    For downstream tasks (e.g., sentiment analysis), models can be adapted using In-Context Learning (ICL). This involves concatenating task examples and the test input into the prompt sequence without updating model parameters, which is fundamentally different from traditional fine-tuning.

  4. Supervised Fine-Tuning (SFT) 1:04:00

    SFT involves collecting data in an instruction/answer pair format and training the model by minimizing the negative log likelihood of predicting the answer ($Y$) given the instruction ($X$). This is a supervised process that updates the model's weights.

Watch on YouTube Full article

Persona Engineering: A Field Guide to AI Synthetic Personas — Ishan Anand, InsightSciences.ai thumbnail

· 21:09

Persona Engineering: A Field Guide to AI Synthetic Personas — Ishan Anand, InsightSciences.ai

Synthetic personas, powered by LLMs, offer a powerful method for simulating human behavior in market research. However, they are not ground truth and must be treated like weather forecasts—predictive models operating within defined regimes. The talk emphasizes that accuracy is often misleading; failure modes include the model inventing latent confounders (e.g., using price as a proxy for product quality) and extreme prompt sensitivity to variable ordering. Robust validation requires measuring the full distribution shape, not just average agreement.

Key takeaways

  1. Treat Synthetic Personas as Forecasts, Not Facts

    Synthetic personas are bounded systems; they predict potential outcomes but cannot guarantee absolute truth. Validation must involve comparing distributions against real-world data (the 'noise floor') rather than aiming for a perfect match.

  2. Beware of Latent Confounders 9:52

    LLMs can invent or infer confounders when context is missing. Poorly grounded prompts allow the model to 'play improv,' leading to skewed results (e.g., an inverted U-shaped purchase probability curve where price increases lead to increased purchase likelihood). Rich prompting must specify personality, context, and study construction.

  3. Focus on Distribution Shape, Not Just Average Accuracy 20:49

    When evaluating performance, focus on metrics that capture the entire shape similarity of the distribution (e.g., using correlation and specific shape metrics). LLMs often lose variation details when averaging results, which is a critical failure mode.

  4. Behavior vs. Stated Attitude 15:07

    LLMs are trained on what people *say* (text/surveys) and perform better predicting stated attitudes than actual behaviors or actions, which require more complex transcription into text.

Watch on YouTube Full article

PLANS For Fable 5: Rebuilding My /Plan Skill for Mythos Class Models thumbnail

· 1:02:49

PLANS For Fable 5: Rebuilding My /Plan Skill for Mythos Class Models

This deep-dive devlog details the rebuilding of a comprehensive `/plan` meta skill (`PlanF3`) designed for next-generation Large Language Models (LLMs) like Fable 5 and Mythos class models. The core thesis is that superior engineering results depend on rigorous, upfront planning—a concept termed 'great planning is great engineering.' By investing heavily in structured templates, the speaker creates a meta skill that forces agents to output highly detailed, standardized plans in HTML format, thereby improving performance over speed or cost (the 'trade-off trifecta'). The resulting plan acts as a living artifact for the entire codebase, integrating complex workflows like image generation and agent-to-agent communication.

Key takeaways

  1. The Importance of Planning in Agentic Engineering 2:00

    Planning is identified as the single most critical tool an engineer has. The speaker warns against outsourcing thinking or planning to models, arguing that detailed, structured plans are necessary for end-to-end control and reliable results at scale.

  2. The PlanF3 Meta Skill Architecture 4:00

    The new skill is designed to be a 'meta skill'—a prompt that creates other prompts or skills. It mandates structured output in HTML format, which is preferred for its ability to convey rich information and utilize tokens efficiently across the 'trifecta' of users: human engineers, engineering teams, and AI agents.

  3. Structured Planning as an Artifact 7:30

    The plan is treated as a living artifact containing mandatory sections like Purpose, Problem, Solution (P/S/R), Relevant Files (existing and new), Implementation Phases (with embedded checklists), Testing Strategy, and detailed Metadata Headers (tracking agent name, session ID, back/forward references).

  4. Advanced Workflow Integration 11:20

    The skill is modularized into dedicated workflows: `create plan`, `update plan`, `update references`, `build plan`, and `image generation`. This structure allows for complex, multi-step processes (e.g., running a build cycle that updates status markers in the plan).

Watch on YouTube Full article