SearchBook a call

RESEARCH / PAPERS

published

GLM-5.3 prompt tuning and thinking-level evaluations

Measured GLM-5.3 and GLM-5.3-Flash thinking-level evaluations, stock vs. tuned system prompt A/B results, and practical defaults for coding agents.

Our earlier report on GLM-5.3 and open-weight cyber capability examined what Z.ai’s open-weight model can do on security benchmarks and what open weights change for defenders. This report asks a narrower engineering question: when GLM-5.3 runs inside a coding agent every day, how should thinking effort be dialed per task shape, and what does targeted system-prompt tuning actually cost or change?

The numbers below come from Dexter’s behavioral evaluation harness (packages/evals, built on vitest-evals), run against zai/glm-5.3 and glm-5.3-flash on 26 October 2026 as part of roadmap item G3. On the structured host matrix, every thinking level and both prompt variants passed 9 of 9 cells. Accuracy was flat across the matrix; the real lever was output token volume, tool-call re-reading, and per-task dollar cost.

Facts at a glance:

  • Models tested: glm-5.3 and glm-5.3-flash through the Z.ai provider (PI_PROVIDER=zai).
  • Date of runs: 26 October 2026 (packages/evals/evals/glm-tuning.eval.ts).
  • Thinking levels swept: off, low, and high (GLM also exposes max; Dexter’s default medium thinking level maps to high in packages/coding-agent/src/core/default-models.ts).
  • Headline matrix result: 9/9 pass on glm-5.3 (stock prompt), 9/9 pass on glm-5.3 (tuned prompt), and 9/9 pass on glm-5.3-flash at roughly 5x lower cost ($0.0008–$0.0016 per task).
  • Prompt-tuning overhead: ~40 input tokens for three behavioral rules, with no increase in output tokens or tool-call counts.
  • Additional suites: smoke.eval.ts passes on zai/glm-5.3; documentation-audit.eval.ts passed 41/44 pages at thinking off, with one borderline page flipping to match on re-run.

Evaluation harness and methodology

Dexter separates behavioral evaluations under packages/evals/evals/ into two execution shapes built on vitest-evals:

  • Host evals (*.eval.ts): ordinary vitest-evals suites executed locally via npm run eval:host. These cover fast behavioral checks such as smoke.eval.ts, documentation-audit.eval.ts, and glm-tuning.eval.ts.
  • Documentation-lift evals (*.docs.eval.ts): paired comparisons orchestrated by src/cli.ts, src/docker.ts, src/plan.ts, and src/report.ts. Each case runs in isolated without_docs and with_docs Docker containers built from local workspace tarballs, with eval definitions, fixtures, and Vitest config made root-owned and unreadable after the harness drops permanently to an unprivileged UID. Only read, write, edit, grep, find, and ls are exposed by default, repetition order alternates by run number to reduce order bias, and blocked pairs withhold headline lift while exiting nonzero.

Every suite follows one grading rule: set judgeThreshold: null for comparative scoring so a low score is recorded as data rather than an infrastructure error, reserving Vitest assertions for broken suite invariants.

The GLM thinking-level matrix

packages/evals/evals/glm-tuning.eval.ts sweeps three distinct agent task shapes across every reasoning level listed in GLM_TUNING_LEVELS (default off,low,high):

  1. fact-retrieval: read a single configuration file and return region/replicas.
  2. code-fix: fix an even-length median() bug, verify the change with node, and submit the verified result.
  3. investigation: inspect three files to determine which one defines DEFAULT_PORT, then submit path:value.

Each cell requires exactly one validated submit_answer call matching the expected string. Token counts, tool-call counts, and costs are written to a JSONL sidecar configured via GLM_TUNING_RESULTS. Switching between the tuned production prompt and the unedited baseline is controlled by GLM_TUNING_PROMPT=stock:

ZAI_API_KEY=... PI_PROVIDER=zai PI_MODEL=glm-5.3 \
GLM_TUNING_RESULTS=results.jsonl \
npm run eval:host -- evals/glm-tuning.eval.ts        # tuned (production) prompt
GLM_TUNING_PROMPT=stock ...                           # baseline without GLM guidelines

Measured results across thinking levels

On the 26 October 2026 runs, all 9 cells of the glm-5.3 matrix passed for both the stock prompt and the tuned production prompt. Because correctness did not vary with thinking level on these bounded tasks, the measurements isolate what higher reasoning effort costs in tokens, tool calls, and dollars.

GLM-5.3 with stock prompt

Task Level Input / Output tokens Tool calls Cost
fact-retrieval off 222 / 42 2 $0.0020
fact-retrieval low 210 / 30 2 $0.0020
fact-retrieval high 252 / 93 2 $0.0023
code-fix off 437 / 204 4 $0.0052
code-fix low 626 / 302 5 $0.0069
code-fix high 871 / 659 4 $0.0079
investigation off 203 / 33 2 $0.0022
investigation low 199 / 33 2 $0.0022
investigation high 398 / 216 4 $0.0042

Three patterns stand out immediately in the stock table:

  • Lookup tasks get nothing from high: on fact-retrieval, moving from low to high raised output tokens from 30 to 93 (over 3x) while keeping tool calls at 2 and accuracy unchanged.
  • Simple investigations double tool calls at high: on investigation, off and low each solved the task in 2 tool calls and 33 output tokens ($0.0022). Raising thinking to high triggered 4 tool calls (mostly re-reading) and 216 output tokens, nearly doubling task cost to $0.0042.
  • Code edits pay for self-verification at high: on code-fix, off used 204 output tokens ($0.0052), low used 302 output tokens ($0.0069), and high rose to 659 output tokens ($0.0079) as the model produced more self-verification output.

Stock vs. tuned production prompt

The tuned production prompt appends three behavioral rules targeted specifically at observed GLM habits: narrating plans before calling tools, restating tool output back to the user, and adding decorative markdown to short replies. Those rules live in glmPromptGuidelines inside packages/coding-agent/src/core/system-prompt.ts, wired through agent-session.ts, and gate on Z.ai providers or GLM model identifiers (including gateway IDs such as zai-org/GLM-5.2):

  • Call tools directly without narrating the plan first; report results only after they return.
  • Do not restate tool output back to the user; summarize the conclusion instead.
  • Use markdown structure only when it aids comprehension, not decoration.
Prompt variant Matrix pass rate Cache-warm fact-retrieval (off) Input overhead Output tokens & tool calls
Stock (GLM_TUNING_PROMPT=stock) 9 / 9 222 in / 42 out Baseline Baseline
Tuned (production default) 9 / 9 258 in / 30 out ~40 input tokens No increase

A measurement subtlety on Z.ai’s endpoint is worth flagging explicitly: inputTokens is prompt-cache-dependent. Cold-cache rows report the full ~2.7k-token system prompt, whereas cache-hit rows report only the uncached remainder. Input token columns are therefore not directly comparable across runs unless cache state matches. Cross-run prompt comparisons must look at output tokens and tool-call counts instead; on both metrics, the tuned guidelines added zero overhead while costing roughly 40 input tokens on cache-warm turns.

GLM-5.3-Flash cost and caching profile

glm-5.3-flash passed 9/9 cells across off, low, and high at roughly 5x lower cost than flagship glm-5.3: $0.0008 to $0.0016 per task. Unlike flagship glm-5.3, the Flash endpoint has no prompt caching, so input token counts charge the full context on every request. Even without caching, Flash’s unit economics make it a strong default for high-volume mechanical work, reserving flagship glm-5.3 for investigation-heavy coding.

Combining the matrix numbers with longer-form evaluation behavior yields five operational defaults for GLM-5.3 inside Dexter:

Task type Recommended level Basis from observed runs
Factual retrieval / lookup off or low Answer is one read away; high adds ~3x output tokens with no accuracy gain in the matrix.
Code fixes, verified edits low–high low solved the median fix with fewer tokens than high, while high produced more self-verification output. Both were correct; Dexter’s default medium→high mapping is a safe floor on real repositories where fixes are less localized.
Multi-file investigation low Correct at every level; high tripled token use (mostly re-reading) on simple sweeps. Escalate to high or max only when trails are long or cross-cutting.
Documentation audits high Verdict quality depends on reading discipline; borderline pages flip between match and inconclusive across runs when the model reads less carefully.
Interactive chat / cheap iterations off Fastest and cheapest; GLM-5.3 remains accurate on short factual turns.

In practice, keep Dexter’s shipped medium→high mapping for general agentic coding, drop to low via /model glm-5.3:low (or a models.json override) for bulk mechanical sweeps, and route cost-sensitive batch tasks to glm-5.3-flash.

Broader suite observations

Two existing host suites were also exercised against zai/glm-5.3:

  • smoke.eval.ts: passes on zai/glm-5.3.
  • documentation-audit.eval.ts: 41 of 44 pages passed on glm-5.3 with thinking set to off. Three borderline pages (custom-provider.md, environment-variables.md, and usage.md) returned non-match verdicts on the initial pass, and custom-provider.md flipped back to match on a re-run. That behavior reflects verdict noise rather than deterministic documentation bugs; operators should re-run individual flagged pages with -t "'<page>.md' matches" (and prefer high thinking for audit passes) before filing documentation defects.

Limitations and open measurements

Several boundaries limit what these runs prove:

  • Ceiling saturation on host fixtures: 9/9 pass across every level for both glm-5.3 and glm-5.3-flash means the tuning matrix measures token and tool-call efficiency, not where off or low begins to lose accuracy on multi-hop repository edits.
  • Unscored prose style: the three glmPromptGuidelines bullets govern conversational prose—suppressing pre-tool narration, output echo, and decorative formatting—which the matrix’s structured submit_answer validator does not score. Keeping the GLM_TUNING_PROMPT=stock flag ensures future prose or transcript rubrics can still run clean A/B checks.
  • Cache-state confounding on input tokens: because Z.ai’s inputTokens figure drops from ~2.7k (cold) to the uncached delta (warm), input-token rows cannot be compared blindly across sessions.
  • Single-run variance: as Dexter’s eval documentation notes, one repetition cannot establish stability; the documentation-audit.eval.ts flip on custom-provider.md illustrates that borderline judgments require repeated runs before drawing conclusions.
  • Docker documentation-lift evals deferred: paired *.docs.eval.ts container runs require an active Docker daemon and were outside the scope of this pass.

Sources

← All papers