Lucky Lenny Learning

Book 11: Picking the Right Tool

The Story

Suppose a program is asked to add up dice that have already been rolled. Does it need a language model? What if it must decide whether to keep dice, bank points, or risk another roll? What if the rules are uncertain, the choices are complicated, and a wrong move matters?

The tool question starts before the tool. First ask what the problem lets you know, what choices are available, and what happens when the answer is wrong. A small script may be enough. A learned policy may help when examples or experience reveal a pattern. A language model may help when choices need flexible reasoning or language context. Whether a larger model earns its added cost is an open experiment for us.

This chapter uses the classroom Farkle variant in the three-games practice artifacts: play to a banked total of 4,000. In this track, the engine keeps scoring dice automatically; the player's decision is whether to bank or roll. The research game (game_mechanics) lets players choose which dice to keep, and none of its results are mixed into this chapter's classroom results. The model runs used practice seeds 40000–40009, not the judged seed block 50000–50199. The samples are small. Treat them as clues to inspect, not a verdict about which tool is best.

Central question

How can we tell whether a problem calls for written rules, a learned tool, a language model, or a system that combines them?

Dragnet: Just the Facts

Three kinds of tool

Let’s use a simple vocabulary.

Hand-written rules are instructions a programmer writes directly. “If there is only one legal move, take it.” “If the turn score is above this threshold, bank.” The rule is visible and easy to run. It can be fast and predictable. Its limits are the limits of the cases its author anticipated.

A machine-learned tool gets a decision rule from data or experience. It might learn a table of choices from practice turns, or adjust parameters by comparing outcomes. The learned artifact can be small and quick to use. But it takes work to make the data, train it, and check that it behaves well on new situations. “Learned” does not mean “knows the best answer.” We must name what it learned to do and how we checked it.

A language model choosing among legal choices receives a description of the state and a menu of actions. The game code still owns the dice, score, and legal moves. The model selects from the menu. This setup gives a language model a bounded job; it does not let it rewrite the rules. The model can still misunderstand a request, answer in the wrong format, or make a poor legal choice. A validator must check the reply.

These are tools for different shapes of problem, not three rungs where the last one always wins. If an addition is fully specified, plain code is a natural fit. If patterns are hard to express but examples are available, a learned policy might help. If choices depend on messy context, a language model may be worth trying. The evidence has to show whether that extra capability earns its cost.

A real surprise: an invalid reply

The A0 capability report describes a prompt with two numbered choices: “1 bank, 2 roll again.” Qwen and Gemma each replied “2.” The report says that both chose roll again in a spot where the lab's R5 rule banks; this was one observation, not a result. It does not say that either model answered “2” to a one-option prompt. Separately, the planning record describes a live run where Qwen returned an invalid number when only one legal option was offered, forfeiting the game. That invalid-reply finding prompted the forced-move fix: the code now takes the only legal move, so forced moves never call the model.

This is a small example of understanding the problem before selecting a tool. There is no choice for a model to make on a forced move, so the engine handles it in code and counts it separately.

The later practice artifacts record forced moves answered by code, with no model call. Qwen’s run had 575 forced moves; Gemma’s had 541. Those are counts in these practice games, not universal shares of classroom Farkle decisions. An earlier planning note estimates that about 23% of moves in the first live LLM run were forced. That estimate has no denominator or raw move log in the committed record, so it is a reported estimate, not a recomputed rate. Keep the setup attached to the number: rules, target, players, and run matter.

Cost is more than a price tag

The project’s cost_record keeps several currencies separate. They answer different questions. They do not combine into one magic score.

CurrencyAsk thisExamples of what to record
EffectivenessDid the tool meet the stated goal?Wins, ties, losses, score, failures, and uncertainty against a named opponent.
PreparationWhat had to happen before use?Training episodes and seeds, elapsed preparation time, artifact size, model identity.
OperationWhat does each use consume?Calls, decisions, latency, elapsed time, throughput, tokens, measured processor time or energy.
Capital/environmentWhat equipment and setting does it depend on?Host, runtime, processor or accelerator, local assets and configuration.
DevelopmentWhat effort made the component?Active and elapsed work, changed parts, and any measured development fees. Unknown effort stays unknown.
VerificationWhat effort checks it?Tests, review, rework, and measured time. A tool that is difficult to inspect has a real cost.
AdaptationWhat changes when the task changes?Updates to rules, data, prompts, model, or integration. Record the actual changes and effort.

For example, a learned Farkle artifact may be cheap to operate but still require training and checking. A local language model may avoid a per-call service bill, yet use substantial time and hardware. A hand-written rule may be easy to run but expensive to adapt when the rules change. Some currencies in the practice records say not_applicable; others say not measured. Those mean different things. Missing information is not zero.

We also need to ask who handles each component. If a program routes forced moves to code, ordinary choices to a small model, and uncertain cases to a larger model, then each component gets its own cost record. Do not hide a long model call inside one average for the whole system. Record the number of times each component was asked, what share of decisions it handled, and how often a reply needed validation or fallback.

Throughput and freedom to choose

Throughput asks how much work a tool completes per unit of time: for example, games per second, decisions per second, or calls per decision. Decision freedom asks how often there is a real choice and how many legal choices are available. A game can have many steps but little decision freedom if most actions are forced.

The practice cost tables include operation counts and elapsed time for the local models. Each played twenty completed practice games against R5. Qwen recorded 1,887 calls and Gemma recorded 1,931 calls. These are measurements from those runs, on that setup. They are not a controlled speed comparison against the script: the models ran on a lab server, and other recorded orientation timings used a different target and machine. A matched throughput experiment is still needed before making a precise speed ratio.

In the effectiveness column, each local model won zero of twenty completed games against R5. Their Wilson 95% intervals are 0.000–0.161. The artifact's interval column uses a different, cluster-based method and gives 0.000–0.000 for zero of twenty; that result can look as if the true rate must be exactly zero, so here we calculate the familiar Wilson score interval directly from wins and completed games. The learned tool won eleven of twenty (55%); its Wilson 95% interval is 0.342–0.742. These samples are small. The zero wins do not prove that language models cannot play Farkle. The prompt was bare, and the records do not test a better prompt or a larger model. They tell us what happened in this practice setup.

The practice numbers use seeds 40000–40009. The plans reserve 50000–50199 for judged work, and say those judged seeds have not been used for the three-game work. Do not tune a prompt on the judged block and then call the result an independent check. Practice is for trying; judged runs are for evaluating a frozen choice.

Build a hybrid, then orchestrate it

A hybrid router is a small piece of code that decides which tool should handle a decision. It can resolve obvious, low-stakes cases with written rules and call a smarter component when genuine choices matter. For example, if a Farkle state has only one legal action, code takes it. For a choice that R5 handles with a documented certain rule, code can answer. For an unclear state, a learned policy or language model can be asked.

The route must be written down before judged play. Otherwise the router could quietly use the outcome to decide which tool to call. The router should log its choice, and each component should log its own costs and results. Compare the hybrid with the same standalone tools on the same frozen seeds and seat schedule. If the router leans on R5 for most decisions, the hybrid may simply behave like R5. That is useful information.

The larger idea is orchestration: a system can be a collection of components with different jobs. The game engine owns state, scoring, and legality. A forced-move handler takes the only legal move. A rule component handles cases with known answers. A solver or lookup table provides exact answers where affordable. A small learned model handles routine choices. A larger model can be reserved for cases where cheaper components disagree or abstain. A validator checks responses, and a fallback handles invalid output.

The orchestration plan calls for one cost record per component. We should record each component’s calls, tokens, seconds, preparation, development, verification, adaptation, and environment where measured. Also record which component handled what fraction of decisions, how often escalation occurred, and what fallback did. Do not add seconds, tokens, developer hours, and energy into one total without a justified conversion. Keep the different currencies visible.

In these classroom-variant practice games, the local language models won 0 of 20 each. That does not show a bigger model winning; it shows no LLM win in this setup. The measured case where more computation wins is a separate research-game result: the exact one-turn solver beat the human-style R5 rule book in 59.5% of non-tie wins. That is a solver result, not an LLM result, and its dice-keeping rules differ from the classroom variant. The LLM-wins case remains open. A cheap next experiment is to ask a small and a larger model to summarize the same messy, unstructured text, then compare both summaries with a human-checked checklist. That task tests language handling a script cannot do directly; record accuracy and time before deciding whether the larger model earns its cost.

What you can now do

The chapter's router example is a FAKE-model demonstration: it illustrates routing and cost records, and is not evidence of an evaluated language-model system. You can describe the difference between written rules, a learned policy, and a language model selecting from legal choices. You can spot a forced move and explain why it should not consume a model call. You can compare tools across separate cost currencies, reason about a hybrid router, and explain what an orchestrated system should record. You can propose a fair experiment to ask whether a bigger model earns its cost.

The Scripted Journey

Open the committed practice result for either model. The files are readable JSON and include separate effectiveness, preparation, and operation records. This short Python program reads the recorded results; it does not rerun games or infer missing costs.

Run from the repository root with python3 and this code:

import json

for name in ("qwen3_5_9b", "gemma3_12b"):
    path = "artifacts/three_games_v1/farkle_practice/" + name + ".json"
    with open(path, encoding="utf-8") as source:
        data = json.load(source)
    result = data["results"]["llm"]
    print(
        name,
        "games=" + str(result["completed_games"]),
        "wins=" + str(result["wins"]),
        "forced=" + str(result["forced_moves"]),
        "calls=" + str(result["operation_cost_record"]["currencies"]["operation"]["attempted_calls"]["value"]),
    )

Actual output:

qwen3_5_9b games=20 wins=0 forced=575 calls=1887
gemma3_12b games=20 wins=0 forced=541 calls=1931

To calculate Wilson 95% intervals for the LLM and learned-tool results in both practice artifacts, run this exact snippet from the repository root with python3:

import glob
import json
import math

z = 1.959963984540054
for path in sorted(glob.glob("artifacts/three_games_v1/farkle_practice/*.json")):
    with open(path, encoding="utf-8") as source:
        data = json.load(source)
    for track in ("llm", "learned"):
        result = data["results"][track]
        wins = result["wins"]
        games = result["completed_games"]
        p = wins / games
        denominator = 1 + z * z / games
        center = (p + z * z / (2 * games)) / denominator
        margin = z * math.sqrt(p * (1 - p) / games + z * z / (4 * games * games)) / denominator
        print("{} {}: wins={}/{}, Wilson 95%={:.3f}-{:.3f}".format(
            path.rsplit("/", 1)[-1][:-5], track, wins, games, center - margin, center + margin
        ))

Actual output:

gemma3_12b llm: wins=0/20, Wilson 95%=0.000-0.161
gemma3_12b learned: wins=11/20, Wilson 95%=0.342-0.742
qwen3_5_9b llm: wins=0/20, Wilson 95%=0.000-0.161
qwen3_5_9b learned: wins=11/20, Wilson 95%=0.342-0.742

Now predict what would change if the FAKE-model router handled every forced move, and a model handled only actual choices. This is a demonstration, not a measured system. What would you measure in a real comparison? Count calls per game, elapsed time, and wins against the same opponent, and compare against a model-only arm. We do not know the outcome until that comparison is run.

Tools for the Job activity

Use the existing student worksheet, Tools for the Job. It asks you to predict, inspect practice results, edit one rule, and choose a tool for different problems. Do not treat its blank cells as a claim that a result is already known. It is a worksheet for exploration; the recorded language-model numbers are practice results with small samples.

As you work, ask: Is there a real choice? What is the goal? How bad is a wrong answer? Which cost matters here? What evidence would change your mind? There is no single tool that wins every problem. Your explanation matters more than picking the fanciest one.

Evidence table

ClaimVALUECommitted source path or reproducing commandCommit read from
Classroom practice protocol: banked-total target, practice seeds, reserved judged seeds.4,000; 40000–40009; 50000–50199sidecar/plans/2026-11-25-done-enough-three-games-three-tools.md and sidecar/plans/three-games-three-tools-plan-v1.md5b59520; 7d55a55
Qwen classroom practice: completed/wins/forced moves/calls.20 / 0 / 575 / 1,887artifacts/three_games_v1/farkle_practice/qwen3_5_9b.json4fe0254
Gemma classroom practice: completed/wins/forced moves/calls.20 / 0 / 541 / 1,931artifacts/three_games_v1/farkle_practice/gemma3_12b.json4fe0254
Wilson intervals for LLM and learned-tool results in the two classroom practice artifacts.LLM: 0/20, 95%: 0.000–0.161 each; learned: 11/20 (55%), 95%: 0.342–0.742 eachExact Python snippet above, run with python3 from repository rootInputs 4fe0254; snippet in this branch flo/ch-tools (pin at merge)
Earlier forced-move share estimate, first live LLM practice run.About 23%; denominator/raw move log unavailable in committed sourcesidecar/plans/2026-11-25-done-enough-three-games-three-tools.md, section 75b59520
A0 prompt and responses: two options, with both models replying “2”; reply selected roll again where R5 banks.Prompt options: 1 bank / 2 roll again; one observation, not a resultsidecar/reports/three-games-A0-maise-recon.mdde8c92d
Invalid reply on a one-option prompt and resulting forced-move handling rationale.Invalid number / game forfeited; forced moves handled in code without model callssidecar/plans/2026-11-25-done-enough-three-games-three-tools.md, section 75b59520
Research-game exact solver versus human-style R5, ties excluded.59.5% non-tie wins; traditional research-game rulesartifacts/solver_vs_r5_v1/summary.md46bdc67
Cost currency names / cost-record structure.7 named currencies: effectiveness, preparation, operation, capital/environment, development, verification, adaptationgame_mechanics/cost_record.pyb4aec19
Worksheet activity source.Worksheet unchangedcapstone/curriculum/handouts/tools-for-the-job-worksheet.mdb4aec19
Scripted Journey JSON-reader output.Qwen: games=20 wins=0 forced=575 calls=1887; Gemma: games=20 wins=0 forced=541 calls=1931Exact Python snippet in The Scripted Journey, run with python3 from repository rootInput artifacts 4fe0254; output reproduced from base worktree 92ef071

One unanswered question: Can a larger language model produce a measurably more accurate summary of messy text than a smaller model, enough to justify its added time and cost?