Learn Everything

Paths/AI Engineer/LLM Fundamentals / Sampling & Output Contracts

Guided Taskbeginnerubuntu:24.04Ask AI

Configure the Sampling Knobs

temperature, top_p and max_tokens decide how a model answers. Write the sampling configuration your application will send with every request.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • Directory ~/llm-lab exists○
  • File ~/llm-lab/sampling.json exists○
  • The config sets temperature and top_p○
  • The config caps the output length and pins the seed○

02Walkthrough

4 steps
  1. 01

    Create the llm-lab directory

    Model settings live next to the rest of the experiment configuration.

    mkdir ~/llm-lab
  2. 02

    Write the sampling configuration

    temperature 0.2 keeps answers close to the training distribution - use a higher value for creative work, zero for classification. The seed makes runs comparable.

    echo '{"model": "gpt-4o-mini", "temperature": 0.2, "top_p": 0.9, "max_tokens": 800, "seed": 42}' > ~/llm-lab/sampling.json
  3. 03

    Verify the configuration

    cat prints the settings. Change one value at a time, or your comparisons mean nothing.

    cat ~/llm-lab/sampling.json
  4. 04

    Submit for validation

    The validator checks the four sampling knobs.

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list