← TinyGPT · docs · devlog · roadmap · speedup
source: docs/learn/model-vs-agent.md · view on GitHub ↗

Model vs agent — what’s actually different

A recurring question worth pinning: what’s the difference between a fine-tuned model and an agent that uses it? Is an agent just a model with tools and an infinite loop?

Tools + loop is necessary but not sufficient. The honest version has more pieces.

The model is one component; the agent is the system

A model is a parameterized function: input tokens → output tokens. It has capabilities (what it can do when prompted right) but no autonomy, no loop, no memory beyond its context window. Every call is stateless.

An agent is a system built around a model. The model is the brain; the agent is everything else that lets the brain do something in the world over time.

The minimum extra pieces:

PieceRoleWhere it lives in this repo
ToolsRead + write surfaces the model can call (search, run code, click a button, write a file)Sources/TinyGPT/Agent.swift tool registry; pace’s Action.* schema
The loopTurn-taking orchestrator: model proposes → tool runs → result feeds back → repeatSources/TinyGPTServe/AgentLoop.swift
State / memoryWhat persists across turns beyond the model’s context window — scratchpad, RAG hits, episodic memory, task goalCurrently: chat history + KV prompt-cache. Beyond that: deferred (a known gap)
Goal managementWhat the agent is trying to do; decomposition for long horizonsImplicit in the prompt today; explicit task-graph is a future feature
Error recoveryWhat happens when a tool fails or the model goes off-railsCloud-escalate fallback (regex today; B5 trained signal next)
Safety / scopingWhat the agent IS and ISN’T allowed to do; destructive-action gatingPace’s confirm_destructive intent + the H4 rule in pace-system-prompt-v11.txt

You can have a model without an agent (every call to tinygpt sample qualifies). You cannot have an agent without a model.

What makes a “good” agent — beyond the bare minimum

The “tools + loop” minimum runs an agent. Making it a good agent is mostly orchestration discipline, not model capability:

  1. Tool design. Tool names + descriptions + arg schemas are the model’s interface to the world. Bad tool surfaces produce bad agents regardless of model quality. This is why factory-pace-planner-v6_1.md spends most of its words on the action registry’s wording, not on the model.

  2. Context discipline (the L1/L2/L3 framing). Per docs/learn/agent-context-hierarchy.md: tier the available capabilities so the always-resident prompt stays small. A model degrading under context bloat looks like an agent that “got worse” — but the model is fine; the context is misallocated.

  3. Verifiable rewards / observable progress. A good agent knows when it’s done. Tool calls that return success/failure, eval suites that score the trajectory, B22 trajectory recorder that captures input_ids/output_ids/rewards — these are what let the loop terminate honestly instead of running forever.

  4. Loop bounds. Step limits, sandbox CPU/RAM, sampling-budget caps. Agents without bounds are bugs waiting. B23 agent-eval-protocol formalizes this for evaluation; the same bounds apply at runtime.

  5. Tool-call efficiency as a metric, not an afterthought. B28 composite reward includes tool_call_efficiency as a first-class scoring dimension. An agent that solves the task but calls 50 tools when 5 would do is a bad agent.

How fine-tuning helps the agent

A fine-tuned model is a better substrate for the agent — same loop, same tools, but the substrate behaves more reliably. Useful fine-tuning targets, in rough priority:

What fine-tuning does NOT fix

The TinyGPT framing

This repo treats the two layers explicitly:

The two layers ship and improve independently. A1 specialist (the fine-tune) and B6 Factory Mac app (the agent UX surface) are both doing agent work, but at different layers. B22-B23-B28-B29-B30 form the feedback loop from agent traces back into model training — closing the substrate-improvement cycle that real products depend on.

Sources