Advanced Techniques

Master the cognitive patterns that turn chatbots into reliable reasoning systems.

Zero-Shot Priming

The baseline behavior of large language models where they rely solely on their pre-training distribution to answer a query without any specific examples.

The Theory

"LLMs are probabilistic engines that predict the next token based on statistical likelihood. In a zero-shot setting, the model infers the task intent purely from the instruction semantics. While efficient, it is prone to hallucination if the task deviates from the training distribution."

Zero-Shot Example
Input Prompt
Classify the sentiment: 'The food was okay, but the service was slow.'
Model Output
Neutral / Negative

Few-Shot Prompting (In-Context Learning)

Providing a set of high-quality demonstrations (input-output pairs) to guide the model's behavior.

The Theory

"This technique exploits 'In-Context Learning'. By seeing examples, the model adjusts its internal activation states to mimic the pattern, formatting, and reasoning style of the examples. It drastically reduces formatting errors and improves adherence to complex rules."

Few-Shot Example
Input Prompt
Great product! -> Positive Terrible delay. -> Negative The food was okay, but the service was slow. ->
Model Output
Mixed

Chain-of-Thought (CoT)

Instructing the model to decompose a problem into intermediate reasoning steps before providing the final answer.

The Theory

"Standard LLMs try to jump to the answer in a single forward pass. CoT forces the model to 'compute' via generated tokens, effectively giving it more 'thinking time'. This is crucial for arithmetic, logic puzzles, and complex reasoning tasks."

Standard vs. CoT
Input Prompt
Q: Roger has 5 balls. He buys 2 cans of tennis balls. Each can has 3 balls. How many balls does he have now?
Model Output
Standard: 11 balls. CoT: Roger started with 5 balls. 2 cans of 3 balls each is 2 * 3 = 6 balls. 5 + 6 = 11. The answer is 11.

Tree-of-Thoughts (ToT)

Explore multiple reasoning branches, evaluate them, and pick the strongest path—useful for planning and ambiguous problems.

The Theory

"Unlike linear CoT, ToT maintains a search tree of partial solutions. The model proposes alternatives, scores them, and expands promising branches. This trades tokens for better exploration on hard tasks."

ToT Sketch
Input Prompt
Plan a weekend launch for a small SaaS. Explore 3 strategy branches, score each, then choose one.
Model Output
Branch A: Soft launch to waitlist (score 8) Branch B: Public Product Hunt day (score 6) Branch C: Partner webinar (score 7) Selected: Branch A — lower risk, faster feedback.

Self-Consistency

Sample several reasoning paths and take the majority or best-supported answer to reduce one-shot errors.

The Theory

"CoT can still be brittle. Self-consistency runs multiple independent CoT samples (often with higher temperature), then aggregates answers. Agreement is a cheap reliability signal without fine-tuning."

Self-Consistency
Input Prompt
Solve: A bat and ball cost $1.10. The bat costs $1 more than the ball. How much is the ball? Sample 5 CoT answers.
Model Output
4 of 5 samples conclude $0.05. Majority answer: $0.05.

Prompt Chaining

Split a complex job into sequenced prompts where each step’s output feeds the next—cleaner than one giant prompt.

The Theory

"Long monolithic prompts mix goals and invite drift. Chaining isolates extraction, analysis, drafting, and critique. You can insert human review between steps and swap models per stage."

Chain
Input Prompt
Step 1: Extract claims from the article. Step 2: Fact-check each claim. Step 3: Rewrite as a cautious brief.
Model Output
Each step returns a smaller artifact. Final brief only includes verified claims.

ReAct (Reason + Act)

A paradigm where the model acts as an agent, iterating between reasoning and acting upon the external world.

The Theory

"In ReAct, the model generates a 'Thought' (reasoning about what to do), an 'Action' (using a tool like Search or Calculator), and then observes the 'Observation' (result from the tool). This loop continues until the task is solved, grounding the model in reality."

ReAct Trace
Input Prompt
Q: Who is the wife of the actor who played 'Neo'?
Model Output
Thought: Neo is played by Keanu Reeves. I need to find his wife. Action: Search[Keanu Reeves wife] Observation: Keanu Reeves has never been married. Answer: Keanu Reeves does not have a wife.