Sampling settings decide how a model picks its next word: temperature raises or lowers the randomness, and top-p narrows the choice to the most likely words. llama-cli takes both as flags, so you can compare outputs from the same prompt under different settings.
What you need
- llama.cpp built or installed with llama-cli
- A GGUF model file
- One repeatable test prompt to run twice
Step 1: Run the prompt once with defaults
Run llama-cli -m model.gguf -p ‘Give me three names for a bakery.’ and note the answer: how long it is and how varied the names are.
Step 2: Run the same prompt with new sampling
Run the same command again with a low temperature and a narrow top-p, and then with a high temperature and a wide top-p. The flags set the sampling for that run only.
Step 3: Compare the two answers
Read both answers side by side. The low-temperature run should be shorter and steadier; the high-temperature run should be longer and more varied. If the answers are identical, check the flags were accepted.
Worked example: synthetic sampling comparison
The table below is a synthetic example. It shows the expected result of changing sampling; no run was made.
| Settings | Prompt | Answer shape |
|---|---|---|
| Defaults | Three bakery names | Three plain names |
| Low temp, narrow top-p | Three bakery names | Same three names, short |
| High temp, wide top-p | Three bakery names | Varied names with notes |
Expected result (UNTESTED). the low-temperature answer is short and steady, and the high-temperature answer is longer and more varied, for the same prompt. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- One prompt is not a measurement; repeat the test before concluding a setting did nothing.
- Temperature and top-p interact, so change one at a time when you compare answers.
- Sampling flags apply to that run only; save the working combination in a script or a note.
