Skip to content

Commit 83067cc

Browse files
authored
Merge pull request #17 from john0isaac/update-llms
Update deprecated and outdated llms
2 parents 8af2377 + ef6385a commit 83067cc

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎code/chapter03/ch03_synthetic_data_generation.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
)
3737

3838
SEED_DATASET = "takala/financial_phrasebank" # public, CC-BY-NC-SA 3.0
39-
TEACHER_MODEL = "claude-sonnet-4-6" # teacher LLM (direct Anthropic id)
40-
OPENROUTER_TEACHER_MODEL = "anthropic/claude-sonnet-4.5" # same family, via OpenRouter
39+
TEACHER_MODEL = "claude-sonnet-5-5" # teacher LLM (direct Anthropic id)
40+
OPENROUTER_TEACHER_MODEL = "anthropic/claude-sonnet-5.5" # same family, via OpenRouter
4141

4242

4343
def call_teacher(prompt: str, max_tokens: int = 4096, system: str = None) -> str:

‎code/chapter07/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,9 @@ The default capture (one prompt against three frontier models plus the local SFT
466466

467467
| Model (default set) | OpenRouter id | Cost per prompt (approx) |
468468
|---|---|---|
469-
| Claude Sonnet 4.5 | `anthropic/claude-sonnet-4.5` | ~$0.006 |
470-
| Gemini 2.5 Pro | `google/gemini-2.5-pro` | ~$0.025 (thinking-mode tokens) |
471-
| DeepSeek V3.1 | `deepseek/deepseek-chat-v3.1` | ~$0.001 |
469+
| Claude Sonnet 5.5 | `anthropic/claude-sonnet-5.5` | ~$0.004 |
470+
| Gemini 3.1 Pro | `google/gemini-3.1-pro-preview` | ~$0.025 (thinking-mode tokens) |
471+
| DeepSeek V4.1 Flash | `deepseek/deepseek-v4.1-flash` | ~$0.001 |
472472

473473
A test budget of $5 covers thousands of comparisons.
474474

@@ -497,12 +497,12 @@ The script writes a single JSON to `chapter07/runs/frontier_comparison.json` (or
497497

498498
### Reading the output
499499

500-
The chapter quotes the Ch6 SFT response (terse, generic) alongside Claude Sonnet 4.5's response (structured by category, with command examples and a follow-up question). The same gap will show up on most domain-specific prompts where you have an SFT model trained on a few hundred examples and the frontier model has been trained on the entire internet:
500+
The chapter quotes the Ch6 SFT response (terse, generic) alongside Claude Sonnet 5.5's response (structured by category, with command examples and a follow-up question). The same gap will show up on most domain-specific prompts where you have an SFT model trained on a few hundred examples and the frontier model has been trained on the entire internet:
501501

502502
- If the frontier response is dramatically more thorough and specific, distillation has a clear quality target. The cost model in §7.3 then tells you whether the per-request economics justify it.
503503
- If the responses are roughly comparable, your SFT model is already close to the ceiling for this task type and distillation may not move the needle. Save the budget for a different intervention (a better prompt, more training data, a different metric).
504504

505-
The Gemini 2.5 Pro response includes a `reasoning` field with the model's internal scratchpad; the `content` field is the user-facing answer. The chapter quotes only `content`; the JSON keeps both for audit.
505+
The Gemini 3.1 Pro response includes a `reasoning` field with the model's internal scratchpad; the `content` field is the user-facing answer. The chapter quotes only `content`; the JSON keeps both for audit.
506506

507507
## Understanding the results
508508

‎code/chapter07/scripts/capture_frontier_comparison.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
- responses from each frontier model, with usage and cost,
1414
- ISO timestamp + each model's exact id-as-served (for stable footnoting).
1515
16-
Default frontier set is Claude Sonnet 4.5, Gemini 2.5 Pro, DeepSeek
17-
V3.1. Override with ``--frontier_models`` if needed.
16+
Default frontier set is Claude Sonnet 5.5, Gemini 3.1 Pro, DeepSeek
17+
V4.1 Flash. Override with ``--frontier_models`` if needed.
1818
1919
Run from code/ (with the venv activated and OPENROUTER_API_KEY in
2020
``code/.env``):
@@ -38,9 +38,9 @@
3838
DEFAULT_PROMPT = "How do I troubleshoot a VPN connection failure?"
3939
DEFAULT_SYSTEM = "You are an IT support assistant."
4040
DEFAULT_FRONTIER_MODELS = [
41-
"anthropic/claude-sonnet-4.5",
42-
"google/gemini-2.5-pro",
43-
"deepseek/deepseek-chat-v3.1",
41+
"anthropic/claude-sonnet-5.5",
42+
"google/gemini-3.1-pro-preview",
43+
"deepseek/deepseek-v4.1-flash",
4444
]
4545

4646

@@ -122,7 +122,7 @@ def main() -> None:
122122
help="OpenRouter model ids to query",
123123
)
124124
parser.add_argument("--max_tokens_local", type=int, default=400)
125-
parser.add_argument("--max_tokens_remote", type=int, default=1024)
125+
parser.add_argument("--max_tokens_remote", type=int, default=3072)
126126
parser.add_argument(
127127
"--skip_local",
128128
action="store_true",

‎code/common/openrouter.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def chat(
5252
5353
Args:
5454
messages: Chat messages in OpenAI format ([{"role": "user", "content": "..."}]).
55-
model: OpenRouter model id (e.g. ``anthropic/claude-sonnet-4.5``).
55+
model: OpenRouter model id (e.g. ``anthropic/claude-sonnet-5.5``).
5656
max_tokens: Cap on total generated tokens. Reasoning-mode models (Gemini)
5757
consume some of this budget on hidden reasoning before emitting
5858
``content``; default 1024 is enough for typical chapter prompts.

‎code/contoso_qa_demo/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ It is a **starter**: 24 hand-authored rows are enough to illustrate the idea, no
3838

3939
## Results (domain LoRA on a single GPU)
4040

41-
The seed was expanded to **166 training rows** (18 hand-authored, 148 synthesized with `anthropic/claude-sonnet-4.5` via OpenRouter, all gated to the house style and balanced across categories: hardware 34, access 30, software 27, cloud/network/security 25 each), with 6 held out for evaluation. A LoRA (r=16, about 5 epochs, roughly a minute on a single 24 GB GPU) was scored against the base model and a format-prompted base. Timing varies by accelerator; the functional results below do not. Full numbers are in `results/results.json`, with a chart in `results/contrast.png`:
41+
The seed was expanded to **166 training rows** (18 hand-authored, 148 synthesized with `anthropic/claude-sonnet-5.5` via OpenRouter, all gated to the house style and balanced across categories: hardware 34, access 30, software 27, cloud/network/security 25 each), with 6 held out for evaluation. A LoRA (r=16, about 5 epochs, roughly a minute on a single 24 GB GPU) was scored against the base model and a format-prompted base. Timing varies by accelerator; the functional results below do not. Full numbers are in `results/results.json`, with a chart in `results/contrast.png`:
4242

4343
| config | internal tool in body | house format | token-F1 |
4444
| --- | --- | --- | --- |

‎code/contoso_qa_demo/expand_seed.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
SEED = HERE / "data" / "it_qa_train.jsonl"
2929
OUT = HERE / "data" / "expanded"
3030
SYSTEM = "You are Contoso's internal IT support assistant. Give clear, accurate help."
31-
TEACHERS = ["anthropic/claude-sonnet-4.5", "openai/gpt-4o", "openai/gpt-4o-mini"]
31+
TEACHERS = ["anthropic/claude-sonnet-5.5", "openai/gpt-4o", "openai/gpt-4o-mini"]
3232

3333
HOUSE_RULES = (
3434
"Answer STYLE (follow exactly):\n"

‎code/scripts/reformat_it_answers.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from common.jsonl import read_jsonl, write_jsonl
3939
from common.openrouter import chat
4040

41-
TEACHER = "anthropic/claude-sonnet-4.5"
41+
TEACHER = "anthropic/claude-sonnet-5.5"
4242

4343
SYSTEM = (
4444
"You are a senior IT support engineer and technical editor. You rewrite "

0 commit comments

Comments
 (0)