FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Providers are locking the temperature dial. Tuning still matters

Max tokens, stop sequences and penalties still decide whether output is usable, and each client task, from extraction to support bots, needs its own settings.

ShareLinkedInFacebookX

In brief

  • Before tuning, check what the model still lets you change: Claude models released after Opus 4.6 reject temperature, and Google advises keeping defaults for Gemini 3.x.
  • Tune only one dial per pair: temperature or top-p, frequency or presence penalty.
  • max_tokens is a ceiling, not a target. Count real tokens, then read stop_reason to learn why output stopped.
Table of four tasks (extraction, support bot, creative, summarisation) and their settings: sampling, penalty, max_tokens, stop. Only the max_tokens column has a value in every row: 600, 400, 800, 500. Extraction uses top_k 1 and stop "###"; the support bot uses presence penalty 0.3; creative uses temperature 0.9.
Each task gets its own set of settings, but every task needs max_tokens. These are starting values to test, not answers. Source: illustrative config file in the article, based on documentation from Anthropic, Google Gemini, DAIR.AI and Vellum.

Anthropic’s Messages API documentation states that models released after Claude Opus 4.6 no longer accept a temperature setting. Google’s prompting guide for Gemini “strongly recommends” leaving sampling parameters at their defaults for the Gemini 3.x family. The most familiar dial on an LLM is gradually being locked.

Parameter tuning has not gone away with it. The work has moved to other dials. Max tokens, stop sequences and penalties still decide whether output is usable inside a client’s system, and each has to be set separately for each kind of task.

Anyone who wants to work as an FDE needs a firm grip on this. Clients do not pay to watch a demo run on default settings. They need a support bot that does not repeat a customer’s name three times in one sentence, and an extraction pipeline that does not cut off halfway through a JSON object.

What you will build

A per-task configuration file covering four kinds of work: structured data extraction, a customer support chatbot, creative writing and summarization.

It comes with a short piece of code that checks why output stopped. To follow along you need API access to at least one provider, basic Python and, most important, 10 to 20 real client inputs to test with.

The code below is trimmed for illustration. Parameter names and value ranges differ between providers, so check them against the documentation for the model you use.

Step 1: what does this model still let you tune?

Before touching any dial, draw up a small table of the parameters your model still accepts. The reason was given above: newer Claude models drop temperature, and Google advises keeping defaults for Gemini 3.x. A configuration carried over from an old project may be rejected by the API, or may quietly make output worse.

Add columns for penalties and top_k, so you record whether your API accepts them instead of guessing.

Check: for every parameter you plan to use, you can answer “does this model accept it, and does the provider recommend leaving it at the default?” The common mistake is copying a configuration from a blog post written for a different model.

Step 2: choose temperature or top-p, not both

DAIR.AI’s Prompt Engineering Guide advises adjusting either temperature or top-p, not both. Turn both at once and, if output gets worse, you cannot tell which dial caused it. Top-p is also easy to misread: according to Vellum, it is a cumulative probability, not a percentage of tokens.

Suppose the next token has three candidates with probabilities of 0.6, 0.3 and 0.1. With top-p at 0.9, the model chooses only among the first two, because 0.6 plus 0.3 already reaches 0.9. Read it as “keep 90% of the tokens” and you would get all three. Vellum also notes that a very low top-p produces constrained, simple output.

Top-k is easier to picture. It is an integer that limits how many of the most probable tokens are considered. A top-k of 1 means greedy selection, so the result is deterministic.

The Gemini documentation likewise describes temperature 0 as deterministic: it always selects the highest-probability response. Extraction tasks need exactly this property. At the other end, DAIR.AI suggests raising temperature for poetry and other creative tasks.

Step 3: set max tokens from measurements, not instinct

Anthropic’s documentation says plainly that max_tokens is only the maximum number of tokens to generate. The model may stop earlier. The number is a ceiling to contain cost and rambling output, not a length you are requesting.

For a quick estimate, the Gemini documentation says a token is roughly four characters. Say the client wants a summary of about 2,000 characters, or around 500 tokens. That is only a starting point: the four-character rule is an approximation, so you still need to count on the client’s real text.

Anthropic offers a free token-counting API, but it is rate-limited by requests per minute according to usage tier, and its results are estimates. The documentation also warns that the newer tokenizer produces roughly 30% more tokens.

If 500 tokens was measured on an older model, the same text may come to about 650 tokens after a model switch. Recount every time you change models.

Check: take 10 real outputs, count their tokens and set max tokens a safe margin above the longest. The common mistake is setting max tokens close to the average, so the longest outputs get cut off.

Step 4: add a stop sequence and read why output stopped

A stop sequence is a string that halts generation when the model produces it. DAIR.AI points out that, together with length limits, it helps control cost and format. With Anthropic’s API, when a stop sequence matches, the response returns stop_reason as "stop_sequence", and the stop_sequence field holds the exact string that matched.

A trimmed request for an extraction task, where the prompt asks the model to finish with ###:

{
  "model": "<your-model>",
  "max_tokens": 600,
  "stop_sequences": ["###"],
  "messages": [{"role": "user", "content": "Extract the following invoice as JSON, ending with ###: ..."}]
}

The part that matters is the code that reads the response:

# Trimmed: response is a dict parsed from the API
if response["stop_reason"] == "stop_sequence":
    parse_json(response)          # the model finished in the right place
else:
    log_for_review(response)      # stopped for another reason: may be truncated

Check: run it with a deliberately very long input and confirm it lands in the log_for_review branch. The common mistake is choosing a stop sequence that can appear in the content itself, such as a newline, which cuts the output after the first line.

Step 5: choose frequency or presence penalty

The two penalties are calculated differently. DAIR.AI explains that the frequency penalty grows with the number of times a token has appeared, while the presence penalty is a flat charge: a token that appears twice is penalized the same as one that appears ten times. According to Vellum, the presence penalty hits a word right after its first use. The advice echoes step 2: adjust only one of the two.

Vellum describes a situation familiar from client sites: a support chatbot that keeps repeating certain names or phrases. This is where the presence penalty fits.

Vellum gives the presence penalty a range of -2 to 2, but says it is usually best kept between -1 and 1. To make a bot repeat itself less, a cautious approach is to start with a small positive value, say 0.1 to 0.5, and raise it gradually if the repetition continues.

For the frequency penalty, Vellum considers values from 0.1 to 1 reasonable if you only want to reduce repetition slightly. If the table from step 1 shows your API has no penalty parameters, skip this step.

Step 6: combine everything into a per-task config file

# Illustrative config; parameter names vary by provider
PROFILES = {
  "extraction": {"top_k": 1, "max_tokens": 600, "stop": ["###"]},
  "support_bot": {"presence_penalty": 0.3, "max_tokens": 400},
  "creative": {"temperature": 0.9, "max_tokens": 800},  # keep temperature only if the model allows it
  "summary": {"max_tokens": 500},  # replace with the figure measured from 10 real outputs
}
Task Main dial Why
JSON extraction top-k 1 or temperature 0, stop sequence Needs deterministic output and certainty that it finished
Support bot Small positive presence penalty, e.g. 0.1 to 0.5 (if the API has it) Avoids repeating names and phrases
Creative writing Temperature or top-p, not both Needs variety while keeping errors traceable
Summarization Max tokens from measurements Controls cost and length

The numbers in the file are starting points for testing, not answers. If the provider recommends keeping defaults for your model, remove the sampling dials from the config and keep only max tokens and the stop sequence. Likewise, drop top_k or the penalties if the API does not support them.

Where this skill shows up on client work

When a client complains that the bot “talks like a machine”, that summary reports are unusually long, or that a downstream system is throwing JSON parse errors, a good FDE does not guess. They open the logs, look at stop_reason, count tokens, then change one dial at a time.

When reading FDE job descriptions, look for phrases such as “inference cost optimization” or “output stability”. On a CV, skip “proficient in prompt engineering”. Write specifically that you reduced the rate of truncated output with stop sequences and stop_reason logging, with before-and-after figures from a real project of your own.

Sampling dials may be locked further with each model generation. Max tokens, stop sequences and the habit of measuring before tuning will remain useful on every project.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
8 sources
Read next on the roadmap · Stage 3: Applied AIWhen fraud queries pile JOIN on JOIN, the data is a networkAWS itself says purpose-built graph databases add most value for highly connected data; the clue is in how the client phrases its questions.