TL;DR
TokenGolf is a Track-1 agent for the AMD Developer Hackathon ACT II. It answers eight capability categories - factual recall, math, sentiment, summarisation, named-entity recognition, code debugging, logic, and code generation - and is scored on a single axis above an accuracy gate: the number of Fireworks tokens it spends. Fewer tokens wins. So the whole agent is a cost-ordered cascade: every task tries the cheapest path first and only pays when nothing free can prove an answer.
The tiers, in cost order: a $0 calculator, a $0 sandboxed code executor, and a free local model (Qwen2.5-3B on CPU under llama.cpp) that owns sentiment and named entities - each exact-or-abstain, so it can never lower accuracy. A separate calibrated mode, which neither the :local nor the :smartlocal image runs, adds a free confidence gate that keeps a local answer when its self-consistency clears the threshold - free, but decided on agreement rather than proof, so it is counted as a gate and not as a tier. Then, only for what is left, a single Fireworks call with reasoning_effort = none (the hidden reasoning was the dominant cost; turning it off cuts scored tokens about 46% at .958 accuracy). The submitted :local image goes all the way: it answers every task on the free tiers and never calls Fireworks at all - 0 scored tokens, the only kind of entry that can win a fewest-tokens ranking. 216 offline tests, shipped as a Docker amd64 image verified to fit the 4 GB / 2 vCPU grading box.
Ranked by tokens, not by answers
Track 1 does not rank agents by how many questions they get right; correctness is a floor, and the leaderboard is the token bill above it. That inverts the usual instinct. The straightforward way to raise accuracy - sample more, reason longer, chain a few calls - is exactly the way to lose, because every one of those tokens is charged. The design question becomes: for each task, what is the cheapest path to a correct answer, and can we tell in advance which path that is?

A task tries each stage in cost order - three exact-or-abstain tiers, then the confidence gate - and stops at the first that can settle an answer. It only costs tokens if it reaches the bottom.
The submitted :local image stops at the free tiers for every task: 0 scored tokens, the only entry that can win a fewest-tokens ranking. The :smartlocal fallback keeps the three free tiers and pays one reasoning-off call for the rest. The confidence gate belongs to a separate calibrated mode; neither image runs it.
The 0-token play
The cleanest way to win a ranking by fewest tokens is to spend none. Local, in-container inference is not on the leaderboard - those tokens score zero - so the primary submission, the :local image, answers all eight categories on the local model plus the $0 deterministic solvers and never opens a Fireworks connection. Its scored-token total is exactly zero.
That only works if the free tiers clear the hidden accuracy gate on their own, which is why each tier is exact-or-abstain and why the local model is used only where it is measured-reliable. The :smartlocal fallback is the insurance: the same free tiers, but whatever they decline escalates to one reasoning-off Fireworks call, so it stays above the gate for a small, bounded token bill. :smartlocal also carries a zero-Fireworks-call guard that forces one paid call if an entire batch is somehow answered free - a hedge against a run with no API calls being ruled invalid, a rule the written Participant Guide does not state. The guard is off in :local, which never calls Fireworks by design.
Three $0 exact-or-abstain tiers, and a gate
Before any token is spent, three tiers try to answer for free. The discipline that makes them safe is the same in each: answer only when the answer can be proven, otherwise abstain and fall through. A tier that guessed would drag accuracy; a tier that abstains cannot. A fourth free stage exists in a separate calibrated mode - the confidence gate - and it is counted separately on purpose: it costs no scored tokens either, but it keeps an answer on measured agreement rather than on proof, so it is a gate, not a fourth exact-or-abstain tier. Neither the :local nor the :smartlocal image runs it.
- Arithmetic and percentages, a calculator. solve_math evaluates pure arithmetic (47 * 13, 15% of 240) with an AST-safe evaluator and returns the exact result; it abstains on word problems it cannot parse.
- "Evaluate this code", a sandbox. solve_code runs the snippet in an AST-locked sandbox - imports, dunder access, and dangerous builtins rejected, with a hard timeout - and returns the value. It abstains on generative debugging and generation, because a program running is not the same as a program being correct, and on anything unsafe.
- Sentiment and NER, a free local model. A Qwen2.5-3B on CPU answers the two categories it is actually reliable on: sentiment (1.00) and named entities (0.88). The NER prompt copies entities verbatim and carries no in-prompt example for the small model to parrot as phantom entities.
- A confidence gate on the rest - free, but not a tier. In a separate calibrated mode, enabled by a bundled calibrator, the local model's own self-consistency decides keep-or-escalate. Neither :smartlocal nor :local runs it: :smartlocal sends whatever the three tiers decline straight to one Fireworks call. The gate scores zero tokens like the tiers, but it keeps answers on agreement rather than proof, which is exactly why it is not counted among the exact-or-abstain tiers - the next section.
The local model is used narrowly on purpose. Measured on the dev bench, the 3B clears only sentiment and NER; it fails math (0.00), factual recall (0.25), and code generation (0.25), so those never go local. But sentiment and NER are expensive to buy remotely, so offloading just those two is worth about 22% off an all-remote baseline - the saving a leaner all-remote entry leaves on the table.
reasoning_effort = none
The single largest lever is the least glamorous. The Fireworks reasoning models emit a hidden reasoning trace before the answer, and those tokens are scored just like the answer's. On these eight categories the trace is not buying accuracy that survives measurement; it is buying cost. Setting reasoning_effort = none on the escalated call removes the trace and cuts scored tokens by roughly 46% with no measured accuracy loss (kimi-k2p7-code on the 24-task dev bench: 8192 scored tokens down to 4448, accuracy .917 to .958). The hidden reasoning was the dominant expense, and the tasks did not need it.
The calibrated confidence gate
For the part of the local model's range beyond the safe two categories, keep-or-escalate is a judgment call, and TokenGolf makes it from the local model's own self-consistency: sample it a few times and measure how tightly the samples agree. High agreement is kept for free; low agreement escalates. On held-out data this separates the local model's right answers from its wrong ones with an AUC of 0.807 (n=150) - keeping the most-confident ~40% local lands 0.90 accuracy on that slice.
The keep-or-escalate threshold τ is calibrated on held-out data, not hand-picked, to trade the two failure modes: too low and confident-but-wrong local answers cost accuracy; too high and easy tasks burn tokens the local model could have saved. The honest limit is that self-consistency rewards agreement, not correctness - a model consistently wrong (about 3% of cases here, all arithmetic slips) is kept when it should escalate - which is exactly why math routes to the deterministic solver or to Fireworks, never to the local vote. Escalation itself is always a single capped call, never a chain, so the token cost per task stays bounded.
The calibration package behind τ is reused, not new: it is copied verbatim from GAUGE, which took it verbatim from PARALLAX, and here it is pointed back at the model-routing decision it was built for. TokenGolf is a recombination of calibrated-abstaining routing and self-consistency, not a new method.
# :smartlocal - $0 tiers, then one call (:local answers the rest locally instead)
if (ans := solve_math(task)) is not None: return ans # $0 exact
if (ans := solve_code(task)) is not None: return ans # $0 sandbox
if category in (SENTIMENT, NER): return local(task) # $0 local
return fireworks(task, reasoning_effort="none", max_tokens=CAP)
# separate calibrated mode - the confidence gate
answer, votes = local.sample(task) # free: local tokens score 0
if agreement(votes) >= TAU: # threshold from held-out data
return answer # keep it, 0 scored tokens
return fireworks(task, # exactly one remote call
reasoning_effort="none", # drop the hidden trace: -46%
max_tokens=CAP) # terse, output-capped Built to not fall over
The grading box is unforgiving: linux/amd64, 4 GB of RAM, 2 vCPUs, an image of at most 10 GB compressed, 60 s to start, ten minutes total and under 30 s per request, and a crash or timeout scores whatever is in /output/results.json at that instant. So that file is written incrementally and atomically - it is a complete, valid JSON array after every task, never a half-written one - which turns any crash or the ten-minute cap into partial credit instead of zero. A time watchdog watches the clock and, as the budget runs low, stops handing tasks to the slow local model and flushes the rest to fast Fireworks, trading a few tokens to guarantee every task is answered.
The fit was measured, not assumed: under those constraints the :smartlocal image peaks at 2229 MiB (about 1.8 GB of headroom under the 4 GB cap), stays well under 30 s per request, and exits clean. The routing, the solvers, the sandbox's rejections, and the atomic writer are covered by 216 passing offline tests. Tasks and models were revealed only on launch day, so the agent is model-agnostic: model ids and thresholds are read from the environment, and retuning is a config change, not a rewrite. The calibration loop was rehearsed before launch on RouterBench, for $0, to protect a $50 Fireworks credit budget.
Measured, and left out
One tier was built, measured, and deliberately switched off. A "local model writes Python, the sandbox executes it" path would, in principle, solve math word problems for free. But measured on GSM8K the 3B mistranslates the word problem into the wrong setup stably - the same wrong translation across samples - so the agreement gate does not catch it, and only about one in five of its confident answers was correct. Shipping it would put wrong answers into the free tier and drag accuracy, so it stays dormant behind a flag and math word problems go to Fireworks (reasoning-off kimi was 100% on the dev math set). It stays in the code for a stronger local model. A measured negative, kept out, is the same discipline as the exact-or-abstain tiers: a free path may answer only when it can prove it is right.
Results
The submitted :local image answers all eight categories on the free tiers for 0 scored tokens; the :smartlocal fallback keeps accuracy above the gate by paying one reasoning-off call for what the free tiers decline, at about 46% fewer tokens than the same call with reasoning on. Escalation is bounded to one capped call per task, so the token bill is predictable rather than open-ended - the property a token-ranked leaderboard actually rewards. Which image ranks best is decided on the leaderboard, the only ground truth.
Limitations
- The 0-token play only wins if the free tiers clear the hidden accuracy gate on their own. If they do not, the :smartlocal fallback spends tokens to stay above it, and which image ranks best is decided on the leaderboard, not here.
- The −46% and .958 figures are the kimi model on a 24-task dev bench across the eight categories. "No measured accuracy loss" from reasoning-off is a result about these tasks, not a general claim that hidden reasoning is unnecessary elsewhere.
- τ is calibrated on held-out data drawn from the same distribution. A shift at judging time could move the keep-or-escalate boundary off its calibrated point.
- The confidence signal is local self-consistency, which rewards agreement, not correctness - the reason math is kept off the local vote and routed to the deterministic solver or Fireworks instead.
- The objective is scored tokens, not wall-clock latency. Local sampling on CPU adds compute time the leaderboard does not charge for, which the watchdog exists to bound; a latency-ranked track would trade off differently.
Conclusion
When the leaderboard is the token bill, the discipline is to answer as much as possible without sending anything to the cloud, and to prove you are right before answering for free. TokenGolf pushes that to the limit: a cost-ordered cascade of exact-or-abstain tiers that, in its submitted form, answers every task locally for zero scored tokens, with a reasoning-off Fireworks fallback for insurance and a set of guards so that even a crash still scores. The scoring rule, turned into the architecture.
