Anthropic shipped Claude Fable 5.2 on November 9, and OpenAI followed on November 17 with GPT-6.2 Astra and Sol. Any ChatGPT vs Claude writing test that predates those releases now describes models you can no longer pick as the newest. Most of those tests also share a weak spot. A reader opens two drafts, decides which one sounds better, and calls the result a ranking. Taste is hard to repeat, and it hides a failure that costs real money: a model that writes fluent prose in the wrong kind of English.
Picture a US startup that sends a product update to customers in Leeds, Brisbane, Hamilton and Pune. A draft that talks about a neighborhood center, a color theme and a month-first launch date reads as sloppy to the first three audiences, and a fundraising figure written as 1,250,000 reads as foreign to the fourth. These slips are countable, which makes them a better target for a test than style. That also separates this job from a voice-match test, which asks whether a model can sound like one specific writer. Here the question is narrower and easier to score: does the model write in the dialect you asked for, and does it leave alone the strings it should not touch?
The project below is a small Python harness of roughly 420 lines, including tests. It sends 15 prompts (five English locales times three task types) to both models under two conditions, bare and with a system prompt, three samples each. That makes 180 short generations for a full two-model run. It then scores every answer with a lexicon of spelling, vocabulary, date and number-format rules, flags answers that “fix” brand names or CSS they were told to keep, and exits with an error code when the leak rate crosses a threshold you set. An offline mode with stub models lets you check every moving part before you spend a cent.
One limit up front. The harness measures dialect fidelity and nothing else. A model can score zero leaks and still write flat copy, so treat the result as one gate among several, next to checks for rules compliance or human review.
Don't miss new tech stories on Google
Add Shattered once in the Google app and our stories show up in your news suggestions.
Prerequisites and Step 1: Create the Project #
You need a machine that runs Python, two API accounts, and about 75 minutes. Most of that time goes to reading outputs, not to waiting on APIs. The table lists what the project expects.
| Requirement | Version or setting | Why it matters |
|---|---|---|
| Python | 3.12 or newer | Standard library only for scoring, so no extra packages in the scorer |
| anthropic SDK | Latest release from PyPI | Provides the Messages API client used for Claude |
| openai SDK | A release that includes the Responses API | The harness calls responses.create for ChatGPT models |
| pytest | Optional, any current release | The test file also runs directly with python tests/test_scorer.py |
| API keys | ANTHROPIC_API_KEY andOPENAI_API_KEY |
Both SDKs read these from the environment |
| Model IDs | CLAUDE_MODEL andOPENAI_MODEL |
Copy the exact strings from each vendor’s model page |
Create the folder, a virtual environment and the two environment variables. The model IDs stay out of the code on purpose. Vendors rename and retire IDs, and a harness that hardcodes one will quietly test last month’s model after the next release.
mkdir dialectbench && cd dialectbench
python3 -m venv .venv && source .venv/bin/activate
pip install anthropic openai
mkdir tests results cache
export ANTHROPIC_API_KEY="..." # from your Anthropic console
export OPENAI_API_KEY="..." # from your OpenAI dashboard
export CLAUDE_MODEL="<exact ID from Anthropic's models page>"
export OPENAI_MODEL="<exact ID from OpenAI's models page>"
The finished layout has seven Python files and two folders that the scripts fill themselves. lexicon.py holds the rules, scorer.py applies them, prompts.py builds the 15 prompts, providers.py talks to the APIs, run.py drives a run, report.py summarizes it, and tests/test_scorer.py pins the scorer’s behavior. Keep the keys out of the repository. A .gitignore with .venv/, cache/ and results/ covers the generated material, and the cache folder also holds model output you may not want to publish.
Step 2: Pick the Models and Fix the Test Conditions #
A fair ChatGPT vs Claude comparison pairs the models tier against tier. On the frontier tier that means Claude Fable 5.2 against GPT-6.2 Astra. On the everyday tier it means Claude Sonnet 5.5 against GPT-6.2 Sol, the model OpenAI ties to day-to-day ChatGPT conversation. Run the harness once per pairing and keep the result files apart.
| Tier | Claude side | ChatGPT side | Status on Nov. 24, 2026 |
|---|---|---|---|
| Frontier | Claude Fable 5.2 | GPT-6.2 Astra | Fable 5.2 released Nov. 9, Astra released Nov. 17 |
| Everyday | Claude Sonnet 5.5 | GPT-6.2 Sol | Both listed as current |
| Sibling models (optional) | Claude Mythos 5.2 | GPT-6.1 Sol | Mythos 5.2 shipped alongside Fable 5.2, GPT-6.1 Sol remains listed |
Cost stays modest because the prompts are short. Anthropic’s pricing page lists Fable 5.2 at $8 per million input tokens and $40 per million output tokens, and each answer here runs a few hundred tokens. The ChatGPT pricing page shows that model access varies by plan, which matters if you later compare the API results against what a Plus or Pro subscriber sees in the app. For a longer view of what each plan buys, see the ChatGPT vs Claude pricing and usage limits breakdown.
Reportedly, GPT-6.2 Astra lists at $8 and $40 per million input and output tokens as well, so the frontier pairing costs about the same on both sides. If you want to turn token spend into a per-article figure, the cost per accepted 1,000 words test shows how to build that metric.
Four conditions stay fixed across every run:
- Same prompts. Both models see byte-identical user text. The harness never rewrites a prompt per model.
- Two prompt conditions.
baresends only the user message.specadds a one-line system prompt naming the dialect. Comparing them tells you whether a model needs the instruction. - Three samples per cell. One sample proves nothing, because a model can get a locale right once and wrong the next time.
- No sampling parameters by default. Some current models restrict temperature or manage it themselves. The harness sets
temperatureonly when you exportTEMP, so the first run uses each vendor’s defaults.
Test through the API, not the chat apps. The apps layer their own system prompts, memory and custom instructions on top of the model, and a dialect score from a chat window with memory switched on says little about the model. The same text from a different user profile can come back in a different spelling.
Step 3: Build the Spelling and Vocabulary Lexicon #
The lexicon is the core of the test. Each entry is a pair of regular expressions, one for the US form and one for the British form, wrapped in word boundaries and compiled case-insensitively. Entries sit in groups (our, re, ence, ize, ll, misc, vocab) so that each locale can say which side of each group it wants.
import re
def _p(us, uk):
return (re.compile(rf"\b(?:{us})\b", re.I), re.compile(rf"\b(?:{uk})\b", re.I))
GROUPS = {
"our": [
_p(r"colors?|colored|coloring|colorful", r"colours?|coloured|colouring|colourful"),
_p(r"flavors?|flavored|flavorful", r"flavours?|flavoured|flavourful"),
_p(r"behaviors?|behavioral", r"behaviours?|behavioural"),
_p(r"favorites?|favorable", r"favourites?|favourable"),
_p(r"neighbors?|neighborhoods?|neighboring", r"neighbours?|neighbourhoods?|neighbouring"),
_p(r"labor|labors|labored", r"labour|labours|laboured"),
_p(r"honors?|honored|honorable", r"honours?|honoured|honourable"),
_p(r"humor", r"humour"),
_p(r"harbors?", r"harbours?"),
],
"re": [
_p(r"centers?|centered|centering", r"centres?|centred|centring"),
_p(r"theaters?", r"theatres?"),
_p(r"fibers?", r"fibres?"),
_p(r"liters?", r"litres?"),
_p(r"calibers?", r"calibres?"),
],
"ence": [
_p(r"defense|defenses", r"defence|defences"),
_p(r"offense|offenses", r"offence|offences"),
_p(r"pretense", r"pretence"),
],
"ize": [
_p(r"organiz(?:e|es|ed|ing|ation|ations|er|ers)", r"organis(?:e|es|ed|ing|ation|ations|er|ers)"),
_p(r"realiz(?:e|es|ed|ing|ation)", r"realis(?:e|es|ed|ing|ation)"),
_p(r"recogniz(?:e|es|ed|ing)", r"recognis(?:e|es|ed|ing)"),
_p(r"optimiz(?:e|es|ed|ing|ation)", r"optimis(?:e|es|ed|ing|ation)"),
_p(r"customiz(?:e|es|ed|ing|ation)", r"customis(?:e|es|ed|ing|ation)"),
_p(r"summariz(?:e|es|ed|ing)", r"summaris(?:e|es|ed|ing)"),
_p(r"prioritiz(?:e|es|ed|ing)", r"prioritis(?:e|es|ed|ing)"),
_p(r"apologiz(?:e|es|ed|ing)", r"apologis(?:e|es|ed|ing)"),
_p(r"analyz(?:e|es|ed|ing)", r"analys(?:e|es|ed|ing)"),
],
"ll": [
_p(r"traveling|traveled|traveler|travelers", r"travelling|travelled|traveller|travellers"),
_p(r"canceled|canceling", r"cancelled|cancelling"),
_p(r"labeled|labeling", r"labelled|labelling"),
_p(r"modeled|modeling", r"modelled|modelling"),
_p(r"fulfill|fulfillment", r"fulfil|fulfilment"),
_p(r"enrollment", r"enrolment"),
],
"misc": [
_p(r"gray", r"grey"),
_p(r"catalogs?|cataloged", r"catalogues?|catalogued"),
_p(r"aluminum", r"aluminium"),
_p(r"jewelry", r"jewellery"),
_p(r"pajamas", r"pyjamas"),
_p(r"sulfur", r"sulphur"),
_p(r"aging", r"ageing"),
],
"vocab": [
_p(r"zip codes?", r"postcodes?"),
_p(r"parking lots?", r"car parks?"),
_p(r"cell ?phones?", r"mobile phones?"),
_p(r"diapers?", r"nappies|nappy"),
_p(r"eggplants?", r"aubergines?"),
_p(r"zucchinis?", r"courgettes?"),
_p(r"sneakers", r"trainers"),
_p(r"gasoline", r"petrol"),
],
}
LOCALES = {
"en-US": {"country": "the United States", "groups": {g: "us" for g in GROUPS}, "dates": "MDY", "numbers": "western"},
"en-GB": {"country": "the United Kingdom", "groups": {"our": "uk", "re": "uk", "ence": "uk", "ize": "either", "ll": "uk", "misc": "uk", "vocab": "uk"}, "dates": "DMY", "numbers": "western"},
"en-AU": {"country": "Australia", "groups": {"our": "uk", "re": "uk", "ence": "uk", "ize": "uk", "ll": "uk", "misc": "uk", "vocab": "uk"}, "dates": "DMY", "numbers": "western"},
"en-CA": {"country": "Canada", "groups": {"our": "uk", "re": "uk", "ence": "uk", "ize": "us", "vocab": "us"}, "dates": None, "numbers": "western"},
"en-IN": {"country": "India", "groups": {"our": "uk", "re": "uk", "ence": "uk", "ize": "either", "ll": "uk", "misc": "uk", "vocab": "uk"}, "dates": "DMY", "numbers": "indian"},
}
DATE_RE = re.compile(r"(?<![\d/])(\d{1,2})/(\d{1,2})/(\d{4})(?![\d/])")
INDIAN_RE = re.compile(r"(?<![\d,])\d{1,2}(?:,\d{2})+,\d{3}(?![\d,])")
WESTERN_BIG_RE = re.compile(r"(?<![\d,])(?:\d{3},\d{3}|\d{1,3}(?:,\d{3}){2,})(?![\d,])")
Three design choices keep the scorer honest. First, suffixes are spelled out inside each pattern. A bare colou?r pattern would miss colourful and coloured, so every entry lists its inflections. Second, analyz and analys carry explicit endings (e, es, ed, ing), because the noun analysis is the same in both dialects and must never count as a leak. The same reasoning removed humorous from the our group after the first test run showed it matching on both sides. Third, the vocab group stays short and limited to words with no common second meaning. lift, flat and tap would cause more false positives than they catch.
Each locale lists a side per group. en-US wants the US side everywhere. en-AU wants British spelling and strict -ise verbs. en-CA mixes the two systems: -our and -re endings with -ize verbs, and it skips the ll and misc groups because Canadian usage varies there. en-GB and en-IN mark the ize group as either, which matters more than it looks.
British publishers split on -ize. Oxford-style house guides accept organize and realize, while many newsrooms and government bodies use -ise. If you score -ize as a leak for en-GB, you will penalize output that a legitimate style guide approves. The harness defaults to either for Britain and India and to strict -ise for Australia. Change those values to match your own style guide before you trust any number.
The lexicon is a starting set of 47 word-family patterns, each covering several inflections, and it is not a dictionary. Expect to add words after your first real run, and expect your product’s own vocabulary to need entries the starter set lacks.
Adding a word takes one line, and the hard part is deciding which words deserve one. To catch mold and molded against mould and moulded, append this to the misc group and add a matching assertion to the test file.
_p(r"molds?|molded", r"moulds?|moulded"),
Skip any word that is legitimate on both sides. program is the classic trap, because British writers use it for software and programme for a broadcast or a schedule. practice and licence split by part of speech in British usage, so a flat pattern flags correct sentences. A pattern that fires on correct text does more damage than a missing one, since it punishes the exact behavior you want to see.
Step 4: Score Dates, Numbers and Leaks #
Spelling is only one slice of dialect. Dates and digit grouping give you two more signals that need no word list. The scorer reads numeric dates with a slash, classifies each one by which part cannot be a month, and counts a date as ambiguous when both parts are 12 or lower. A prompt that asks for a date whose day is above 12 therefore yields DD/MM/YYYY (day first) or MM/DD/YYYY (month first), and either one classifies cleanly.
Number grouping works the same way. Indian English groups digits as 12,50,000 for the figure 1250000, while the other four locales use 1,250,000. Two regular expressions in lexicon.py capture the patterns, and the scorer applies them only to en-IN.
import re
from collections import Counter
from lexicon import GROUPS, LOCALES, DATE_RE, INDIAN_RE, WESTERN_BIG_RE
FENCE = re.compile(r"```.*?```|`[^`\n]+`", re.S)
WORD = re.compile(r"[A-Za-z][A-Za-z'-]*")
def strip_code(text):
return FENCE.sub(" ", text)
def date_orders(text):
out = Counter()
for a, b, _ in DATE_RE.findall(text):
a, b = int(a), int(b)
if a > 12 and b <= 12:
out["DMY"] += 1
elif b > 12 and a <= 12:
out["MDY"] += 1
else:
out["ambiguous"] += 1
return out
def mask(text, protected):
for p in protected:
text = text.replace(p, " ")
return text
def score_text(text, locale, protected=()):
cfg = LOCALES[locale]
prose = strip_code(mask(text, protected))
words = max(len(WORD.findall(prose)), 1)
hits, leaks = Counter(), Counter()
for group, side in cfg["groups"].items():
if side == "either":
continue
for us_re, uk_re in GROUPS[group]:
target, other = (us_re, uk_re) if side == "us" else (uk_re, us_re)
hits[group] += len(target.findall(prose))
leaks[group] += len(other.findall(prose))
orders = date_orders(prose)
if cfg["dates"]:
wrong = "MDY" if cfg["dates"] == "DMY" else "DMY"
hits["dates"] += orders[cfg["dates"]]
leaks["dates"] += orders[wrong]
if cfg["numbers"] == "indian":
hits["numbers"] += len(INDIAN_RE.findall(prose))
leaks["numbers"] += len(WESTERN_BIG_RE.findall(prose))
n_leaks = sum(leaks.values())
return {
"words": words,
"hits": dict(hits),
"leaks": dict(leaks),
"leak_total": n_leaks,
"leaks_per_1000": round(1000 * n_leaks / words, 2),
"ambiguous_dates": orders["ambiguous"],
"clean": n_leaks == 0,
}
def missing_protected(text, protected):
return [p for p in protected if p not in text]
Read the return value from the bottom up. clean is true when a sample has zero leaks. leaks_per_1000 normalizes the count by prose length so a long answer does not look worse than a short one. hits records how many target-side forms appeared, which lets you spot a sample that avoided every dialect marker by luck, and ambiguous_dates reports the dates the scorer refused to classify.
| Metric | Definition | What a bad value means |
|---|---|---|
leak_total |
Count of wrong-side spellings, vocabulary, dates and number groupings | The model slipped into another dialect |
leaks_per_1000 |
Leaks divided by prose words, times 1,000 | Same as above, comparable across lengths |
clean |
True when leak_total is 0 |
Used for the clean-sample percentage in reports |
hits |
Count of target-side forms | Near zero means the sample gave the scorer little to judge |
ambiguous_dates |
Dates with both parts at 12 or lower | Your prompt date choice is hiding signal |
protected_lost |
Protected strings missing from the output | The model rewrote text it should have kept |
Two lines in score_text deserve attention. mask blanks out protected strings before scoring, and strip_code removes fenced and inline code. Without them, a model that correctly keeps Harbor Center Credit Union untouched would be charged for two leaks. The first offline run here made exactly that mistake and reported 110 leaks per 1,000 words for a stub that was written perfectly. Here is a worked example. Score the sentence Your favorite center opens 03/25/2027. against en-GB and the scorer finds three leaks in four prose words: favorite (group our), center (group re) and a month-first date (group dates). That works out to 750 leaks per 1,000 words, clean is false, and the date does not count as ambiguous because 25 cannot be a month. The same sentence scored against en-US returns zero leaks. Short strings inflate the per-1,000 figure, which is why the report sums words and leaks across a group before dividing, instead of averaging per-answer rates.
The scorer is the part of the harness that most deserves its own tests, and the AI and machine learning section of this site has more model-behavior tests built on the same principle.
Step 5: Write Prompts That Do Not Leak Their Own Spelling #
A prompt that says color scheme hands the model a US spelling to echo. Models copy surface forms from the prompt, so a dialect test must describe things without using the words under test. The prompt for the first task asks the model to describe the shades used in the studio, the classes members prefer most, the area around the site and how members arrange their weekly timetable. A well-behaved model reaches for colours, favourite, neighbourhood and organise on its own in British English, and for the US forms in American English.
Three task types cover three failure modes:
- fresh : write a 120-word email from scratch. This tests default behavior, including the date and the 1250000 figure.
- convert : rewrite a US paragraph for another locale while keeping two fictional brand names unchanged. This tests conversion and over-correction at once, and the
en-USversion is a control that should come back untouched. - code : rewrite a short note and leave a CSS block alone. This tests whether the model edits text it was told to preserve, since
coloris a property name, not a spelling choice.
from lexicon import LOCALES
PLACES = {"en-US": "Austin, Texas", "en-GB": "Leeds", "en-AU": "Brisbane", "en-CA": "Hamilton, Ontario", "en-IN": "Pune"}
CURRENCY = {"en-US": "US dollars", "en-GB": "pounds sterling", "en-AU": "Australian dollars", "en-CA": "Canadian dollars", "en-IN": "Indian rupees"}
SYSTEMS = {
"en-US": "Write in American English: -or and -er endings, -ize verbs, MM/DD/YYYY dates.",
"en-GB": "Write in British English: -our and -re endings, -ence nouns, double l in travelling, DD/MM/YYYY dates.",
"en-AU": "Write in Australian English: British spellings with -ise verbs, DD/MM/YYYY dates.",
"en-CA": "Write in Canadian English: -our and -re endings, -ize verbs, -ence nouns.",
"en-IN": "Write in Indian English: British spellings, DD/MM/YYYY dates, and lakh-style digit grouping such as 12,50,000.",
}
CONVERT_SOURCE = (
"Our neighborhood center will organize a color run on Saturday. Harbor Center Credit Union "
"and Color Theory Labs are sponsoring the favorite-flavor tasting, and the defense of the "
"route plan is a team effort. Please analyze the schedule, park in the new parking lot, "
"and bring a cell phone."
)
CONVERT_PROTECTED = ["Harbor Center Credit Union", "Color Theory Labs"]
CODE_NOTE = (
"The gray button uses a custom color so members can recognize it. "
"Do not change this snippet:\n\n``` css\n.btn { background-color: #444; color: #fff; }\n```"
)
CODE_PROTECTED = ["background-color: #444; color: #fff;"]
def build_prompts():
items = []
for loc, cfg in LOCALES.items():
country = cfg["country"]
items.append({
"id": f"{loc}-fresh", "locale": loc, "task": "fresh", "protected": [],
"user": (
f"Write a 120-word announcement email from a community gym in {PLACES[loc]} that opens a "
f"second branch on 25 March 2027. Describe the shades used in the studio, the classes members "
f"prefer most, the area around the site, and how members can arrange their weekly timetable. "
f"Mention a fundraising target of 1250000 {CURRENCY[loc]} and write that figure the way "
f"readers in {country} expect. Give the opening date once in numbers only (day, month, year, "
f"separated by slashes). Write for readers in {country}."
),
})
items.append({
"id": f"{loc}-convert", "locale": loc, "task": "convert", "protected": CONVERT_PROTECTED,
"user": (
f"Rewrite this text for readers in {country}. Keep these names exactly as written: "
f"{', '.join(CONVERT_PROTECTED)}.\n\n{CONVERT_SOURCE}"
),
})
items.append({
"id": f"{loc}-code", "locale": loc, "task": "code", "protected": CODE_PROTECTED,
"user": f"Rewrite this note for readers in {country} and keep the code block untouched.\n\n{CODE_NOTE}",
})
return items
The brand names (Harbor Center Credit Union, Color Theory Labs) are fictional, so no real company’s spelling is being second-guessed. The date in the prompt was picked so that the day exceeds 12 and no sample ends up ambiguous. The SYSTEMS dictionary holds the one-line instructions for the spec condition. Keep those short. A paragraph of detailed style rules would turn the second condition into a test of instruction-following in general, and general instruction-following belongs in a separate check such as an editing fidelity test.
Step 6: Wrap Both APIs With Caching and Retries #
The provider file hides three differences between the vendors. Anthropic takes the system prompt as a system argument on messages.create. OpenAI’s Responses API takes it as instructions. And the two SDKs return text in different shapes, so each wrapper flattens its response into a plain string. Everything else in the harness sees only text.
import hashlib, json, os, pathlib, time
CACHE = pathlib.Path("cache")
CACHE.mkdir(exist_ok=True)
STUB = {
"en-US": "The new center opens 03/25/2027. Pick your favorite class, organize your week. Target: $1,250,000.",
"en-GB": "The new centre opens 25/03/2027. Pick your favourite class, organise your week. Target: £1,250,000.",
"en-AU": "The new centre opens 25/03/2027. Pick your favourite class, organise your week. Target: A$1,250,000.",
"en-CA": "The new centre opens in March. Pick your favourite class, organize your week. Target: C$1,250,000.",
"en-IN": "The new centre opens 25/03/2027. Pick your favourite class, organise your week. Target: ₹12,50,000.",
}
NAMES = " Harbor Center Credit Union and Color Theory Labs help."
CSS = "\n``` css\n.btn { background-color: #444; color: #fff; }\n```"
def _stub(locale, user):
text = STUB[locale]
if "Harbor Center Credit Union" in user:
text += NAMES
if "``` css" in user:
text += CSS
return text
def _key(label, model, system, user, i):
raw = json.dumps([label, model, system, user, i], ensure_ascii=False)
return hashlib.sha256(raw.encode()).hexdigest()[:24]
def _claude(model, system, user, max_tokens):
import anthropic
kwargs = {"model": model, "max_tokens": max_tokens, "messages": [{"role": "user", "content": user}]}
if system:
kwargs["system"] = system
if os.getenv("TEMP"):
kwargs["temperature"] = float(os.environ["TEMP"])
msg = anthropic.Anthropic().messages.create(**kwargs)
return "".join(b.text for b in msg.content if b.type == "text")
def _openai(model, system, user, max_tokens):
from openai import OpenAI
kwargs = {"model": model, "input": user, "max_output_tokens": max_tokens}
if system:
kwargs["instructions"] = system
if os.getenv("TEMP"):
kwargs["temperature"] = float(os.environ["TEMP"])
return OpenAI().responses.create(**kwargs).output_text
def generate(label, locale, system, user, i, max_tokens=900):
if label == "stub-good":
return _stub(locale, user)
if label == "stub-leaky":
return _stub("en-US", user)
model = os.environ["CLAUDE_MODEL" if label.startswith("claude") else "OPENAI_MODEL"]
path = CACHE / f"{_key(label, model, system, user, i)}.json"
if path.exists():
return json.loads(path.read_text(encoding="utf-8"))["text"]
fn = _claude if label.startswith("claude") else _openai
for attempt in range(4):
try:
text = fn(model, system, user, max_tokens)
path.write_text(json.dumps({"label": label, "model": model, "text": text}, ensure_ascii=False), encoding="utf-8")
return text
except Exception as exc:
wait = 2 ** attempt
print(f"retry {attempt + 1} for {label}: {exc.__class__.__name__}; sleeping {wait}s")
time.sleep(wait)
raise RuntimeError(f"{label} failed after 4 attempts")
Four details matter here. The cache key hashes the label, the model ID, the system prompt, the user prompt and the sample index, so changing any of them forces a fresh call, while rerunning an unchanged prompt costs nothing. Retries back off at 1, 2, 4 and 8 seconds, which handles short rate-limit bursts without a queue library. The Anthropic wrapper joins only blocks whose type is text, so thinking blocks from reasoning models never end up in the scored string. And the two stub labels let run.py --offline exercise the whole pipeline with canned answers, one perfect and one that writes American English no matter what it is asked.
The wrappers call the vendors sequentially. That is slower than a thread pool, but it keeps the run order stable, makes retry logs easy to read, and stays inside the rate limits of a fresh account. Add concurrency only after the first clean run.
Step 7: Run the Offline Dry Run Before Spending Money #
Write the driver and the reporter, then run the tests and a stub-only pass. This is the step people skip, and it is the one that catches scorer bugs while they cost nothing.
import argparse, json, pathlib
from prompts import build_prompts, SYSTEMS
from providers import generate
from scorer import score_text, missing_protected
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--labels", default="claude,chatgpt")
ap.add_argument("--samples", type=int, default=3)
ap.add_argument("--out", default="results/results.jsonl")
ap.add_argument("--offline", action="store_true", help="use stub providers to test the plumbing")
args = ap.parse_args()
labels = ["stub-good", "stub-leaky"] if args.offline else args.labels.split(",")
out = pathlib.Path(args.out)
out.parent.mkdir(parents=True, exist_ok=True)
rows = []
for item in build_prompts():
for label in labels:
for cond in ("bare", "spec"):
system = SYSTEMS[item["locale"]] if cond == "spec" else None
for i in range(args.samples):
text = generate(label, item["locale"], system, item["user"], i)
s = score_text(text, item["locale"], item["protected"])
lost = missing_protected(text, item["protected"])
rows.append({"label": label, "cond": cond, "locale": item["locale"], "task": item["task"],
"sample": i, "text": text, "protected_lost": len(lost),
"protected_total": len(item["protected"]), **s})
with open(out, "w", encoding="utf-8") as fh:
for r in rows:
fh.write(json.dumps(r, ensure_ascii=False) + "\n")
print(f"wrote {len(rows)} rows to {out}")
if __name__ == "__main__":
main()
python
import argparse, csv, json, sys
from collections import defaultdict
def load(path):
return [json.loads(line) for line in open(path, encoding="utf-8")]
def summarize(rows, keys):
groups = defaultdict(list)
for r in rows:
groups[tuple(r[k] for k in keys)].append(r)
table = []
for key, rs in sorted(groups.items()):
words = sum(r["words"] for r in rs)
leaks = sum(r["leak_total"] for r in rs)
prot = sum(r["protected_total"] for r in rs)
lost = sum(r["protected_lost"] for r in rs)
table.append({
**dict(zip(keys, key)), "n": len(rs),
"leaks_per_1000": round(1000 * leaks / max(words, 1), 2),
"clean_pct": round(100 * sum(r["clean"] for r in rs) / len(rs), 1),
"overcorrect_pct": round(100 * lost / prot, 1) if prot else None,
})
return table
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--file", default="results/results.jsonl")
ap.add_argument("--by", default="label,cond,locale")
ap.add_argument("--max-leak-rate", type=float, default=None)
ap.add_argument("--csv", default="results/summary.csv")
args = ap.parse_args()
keys = args.by.split(",")
table = summarize(load(args.file), keys)
head = keys + ["n", "leaks_per_1000", "clean_pct", "overcorrect_pct"]
print(" | ".join(f"{h:>14}" for h in head))
for row in table:
print(" | ".join(f"{str(row[h]):>14}" for h in head))
with open(args.csv, "w", newline="") as fh:
w = csv.DictWriter(fh, fieldnames=head)
w.writeheader()
w.writerows(table)
if args.max_leak_rate is not None:
bad = [r for r in table if r["leaks_per_1000"] > args.max_leak_rate]
if bad:
print(f"FAIL: {len(bad)} group(s) above {args.max_leak_rate} leaks per 1000 words")
sys.exit(1)
if __name__ == "__main__":
main()
The report groups rows by any comma-separated list of fields. --by label,locale gives a per-locale table, --by label,cond compares bare against spec, and --by label,task isolates the three task types. Add --max-leak-rate to turn the report into a gate. Run the tests first.
python tests/test_scorer.py
ok test_ambiguous_date_is_counted_separately
ok test_canadian_mix
ok test_code_blocks_are_ignored
ok test_humorous_is_neutral
ok test_indian_grouping
ok test_oxford_ize_is_not_a_leak_in_gb_but_is_in_au
ok test_protected_names
ok test_protected_names_are_masked_before_scoring
ok test_uk_text_is_clean_for_gb
ok test_us_text_leaks_in_gb
10 passed
The test file, shown next, covers the cases that broke during development: the Oxford -ize policy, the code-block exemption, the ambiguous date, Indian grouping, the Canadian mix and the masking of protected names.
import sys, pathlib
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from scorer import score_text, missing_protected
def test_uk_text_is_clean_for_gb():
s = score_text("Your favourite centre will organise a colour run on 25/03/2027.", "en-GB")
assert s["leak_total"] == 0 and s["hits"]["our"] == 2
def test_us_text_leaks_in_gb():
s = score_text("Your favorite center will analyze the color plan on 03/25/2027.", "en-GB")
assert s["leaks"]["our"] == 2 and s["leaks"]["re"] == 1 and s["leaks"]["dates"] == 1
def test_oxford_ize_is_not_a_leak_in_gb_but_is_in_au():
assert score_text("We organize and realize it.", "en-GB")["leak_total"] == 0
assert score_text("We organize and realize it.", "en-AU")["leak_total"] == 2
def test_code_blocks_are_ignored():
s = score_text("Plain prose.\n``` css\n.btn { color: #fff; }\n```", "en-GB")
assert s["leak_total"] == 0
def test_ambiguous_date_is_counted_separately():
s = score_text("Opens 03/04/2027.", "en-GB")
assert s["ambiguous_dates"] == 1 and s["leak_total"] == 0
def test_indian_grouping():
assert score_text("Target: ₹12,50,000.", "en-IN")["leak_total"] == 0
assert score_text("Target: ₹1,250,000.", "en-IN")["leaks"]["numbers"] == 1
def test_canadian_mix():
s = score_text("Your favourite centre will organize it.", "en-CA")
assert s["leak_total"] == 0
assert score_text("Your favorite center will organise it.", "en-CA")["leak_total"] == 3
def test_humorous_is_neutral():
assert score_text("A humorous note.", "en-GB")["leak_total"] == 0
assert score_text("A humorous note.", "en-US")["leak_total"] == 0
def test_protected_names():
assert missing_protected("Color Theory Labs", ["Color Theory Labs", "Harbor Center Credit Union"]) == ["Harbor Center Credit Union"]
def test_protected_names_are_masked_before_scoring():
text = "Sponsored by Color Theory Labs and Harbor Center Credit Union."
assert score_text(text, "en-GB")["leak_total"] == 3
assert score_text(text, "en-GB", ["Color Theory Labs", "Harbor Center Credit Union"])["leak_total"] == 0
if __name__ == "__main__":
tests = [f for n, f in sorted(globals().items()) if n.startswith("test_")]
for t in tests:
t()
print("ok", t.__name__)
print(f"{len(tests)} passed")
Now run the stubs and print the per-locale summary.
python run.py --offline --samples 1 --out results/offline.jsonl
python report.py --file results/offline.jsonl --by label,locale
wrote 60 rows to results/offline.jsonl
label | locale | n | leaks_per_1000 | clean_pct | overcorrect_pct
stub-good | en-AU | 6 | 0.0 | 100.0 | 0.0
stub-good | en-CA | 6 | 0.0 | 100.0 | 0.0
stub-good | en-GB | 6 | 0.0 | 100.0 | 0.0
stub-good | en-IN | 6 | 0.0 | 100.0 | 0.0
stub-good | en-US | 6 | 0.0 | 100.0 | 0.0
stub-leaky | en-AU | 6 | 315.79 | 0.0 | 0.0
stub-leaky | en-CA | 6 | 157.89 | 0.0 | 0.0
stub-leaky | en-GB | 6 | 236.84 | 0.0 | 0.0
stub-leaky | en-IN | 6 | 315.79 | 0.0 | 0.0
stub-leaky | en-US | 6 | 0.0 | 100.0 | 0.0
Those numbers come from canned strings and say nothing about either model. They do show the scorer behaving as designed. stub-good writes each dialect correctly and scores zero in every locale. stub-leaky writes American English everywhere, so it scores zero for en-US (correct, because that is its dialect) and between roughly 158 and 316 leaks per 1,000 words elsewhere. Canada scores lowest because Canadian English keeps -ize and vocab on the US side, which shrinks the number of places the US text can go wrong. If your offline run does not reproduce this shape, fix the harness before moving on.
Step 8: Run the Real Test, Bare Prompts First, Spec Prompts Second #
Export both model IDs for one tier, run the harness, and write the results to a tier-specific file. For the frontier pairing:
export CLAUDE_MODEL="<exact ID for Claude Fable 5.2>"
export OPENAI_MODEL="<exact ID for GPT-6.2 Astra>"
python run.py --labels claude,chatgpt --samples 3 --out results/frontier.jsonl
env | grep -E 'CLAUDE_MODEL|OPENAI_MODEL' > results/frontier-models.txt
Then repeat with the everyday-tier IDs and --out results/everyday.jsonl. The grep line saves the exact model IDs next to each results file. Without it, a file named frontier.jsonl will mean nothing three months from now.
The driver loops over 15 prompts, two models and two conditions, with three samples in each cell. Because of the cache, an interrupted run resumes where it stopped, and a repeated run finishes in seconds. The bare condition measures what a model does when nobody tells it which English to use. The spec condition measures what happens after a one-line instruction. The gap between the two is useful on its own. A model with a small gap defaults well, while a model with a large gap needs a system prompt in production. If you plan to ship that instruction as a reusable setting, the custom instructions pack shows how to keep one spec in sync across ChatGPT, Claude and other assistants.
Set a spend cap in each vendor console before the first real call, and watch the first few lines of output for retry messages. A run that prints several retries in a row usually means a bad key or a wrong model ID, and stopping early costs less than letting the loop grind through all 180 calls. Open one or two cached files in the cache folder as well. Each holds the label, the model ID and the raw text, so you can confirm the right model answered before you trust a single score.
Do not touch the lexicon during a run. If you spot a missing word halfway through, finish the run, add the pattern, and rescore. Rescoring is free because run.py reads cached answers and scores them again without a single API call.
Step 9: Read the Results Without Fooling Yourself #
Start with the broadest cut, then narrow. A 180-call run supports a few honest statements and rules out a lot of confident ones. Each cell in a per-locale table holds only nine samples per model and condition (three tasks times three samples), so a difference of one leak is noise. The math is unforgiving. If 7 of 9 samples come back clean, the confidence interval for the true clean rate is very wide. Even nine clean samples out of nine leaves a lower bound well short of perfect, and 27 clean answers out of 30 still leave a noticeable range. Any ChatGPT vs Claude claim that rests on a two-point gap in cells this small is a guess, so lean on gaps of 30 points or more, and rerun with more samples when the gap is smaller.
Reading the per-locale table
Run python report.py --file results/frontier.jsonl --by label,cond,locale. Look for locales where one model’s clean percentage collapses while the other holds. A model that scores well on en-GB and badly on en-IN likely handles British spelling but ignores Indian digit grouping. The numbers group only applies to en-IN, so that split points to a specific habit, not a general weakness.
Reading the per-task table
Run --by label,task. If the convert task scores worse than fresh, the model keeps source spellings when editing existing text. That pattern is plausible, because a model rewriting a paragraph can lean on the words it was handed. If code scores worst, check whether the leak comes from prose outside the fence or from a model that edited the snippet.
Reading the condition gap
Compare bare and spec for each model. A drop in leaks from bare to spec shows that the instruction works. No change on a model that leaks in bare shows the instruction is not enough, and you should look at the per-group counts. This short script prints the leak groups ranked across a results file.
import json
from collections import Counter
rows = [json.loads(line) for line in open("results/offline.jsonl", encoding="utf-8")]
by = Counter()
for r in rows:
for group, n in r["leaks"].items():
by[(r["label"], group)] += n
for (label, group), n in sorted(by.items(), key=lambda kv: -kv[1])[:6]:
print(f"{label:<11} {group:<6} {n}")
stub-leaky our 24
stub-leaky re 24
stub-leaky dates 18
stub-leaky ize 6
stub-leaky numbers 6
stub-good our 0
On the stub data, our and re lead because the US stub text uses favorite and center in every locale. On real data the ranking tells you where to aim a fix. If dates leads, ask for a numeric date format in the system prompt. If ize leads for en-AU, name -ise explicitly. To decide how much a gap matters, use the table below as a starting point, then adjust to your tolerance.
| Reading | What it suggests | Next move |
|---|---|---|
Clean percentage above 90 in bare |
The model defaults well for this locale | Spot-check five outputs and move on |
Clean percentage below 50 in bare , above 90 inspec |
The model obeys but does not infer | Ship the system prompt |
| Clean percentage below 50 in both | Instruction does not fix it | Read the leak groups, test a longer spec |
Leaks concentrated in dates |
The model picks US order by default | State the date format in the prompt |
High ambiguous_dates |
Test dates are too low in the month | Change the prompt date so the day exceeds 12 |
For a human check on top of the numbers, pull a handful of answers from each model and read them with the labels hidden. A blind writing test is the natural companion to this one.
Step 10: Measure Over-Correction and Protected Strings #
A model can score zero leaks by being too eager. Told to write for readers in Britain, it may turn Color Theory Labs into Colour Theory Labs or edit color: #fff inside a CSS block, and both changes break something. The overcorrect_pct column counts those cases. It divides protected strings that vanished from the output by protected strings in the prompts, for the cells where a prompt carried any.
The fresh task has no protected strings, so its over-correction shows as None in the report. That is expected. Only convert and code rows carry a number. To see the offending answers, list them straight from the results file.
import json
rows = [json.loads(line) for line in open("results/frontier.jsonl", encoding="utf-8")]
for r in [r for r in rows if r["protected_lost"]][:5]:
print(r["label"], r["cond"], r["locale"], r["task"])
print(" ", r["text"][:140].replace("\n", " "))
Build your own protected list from the material that must survive a rewrite: product and company names, legal entities, code and file paths, URLs, customer quotes and anything inside a contract clause. Each entry costs one line in prompts.py, and each one adds a free check on whether the model respects boundaries. Names that carry a US spelling, such as a company called Color Theory Labs, make the best test cases, because they pull hardest against a model’s urge to localize everything.
Treat any non-zero value as a defect, not as a score to trade off against leaks. A model that edits background-color in a stylesheet will break a page, and a model that rewrites a registered company name changes a legal entity. An over-correcting model combined with a low leak rate means the fix is a blunt rule, which is the opposite of what you want from a writing assistant. Whether a model obeys a leave-this-alone instruction is a narrower question than whether it follows rules in general, and the scorer answers only the first.
The control row matters here too. For en-US, the convert task hands a US paragraph to a model that is asked to write for US readers. The correct answer is a near-copy. If a model rewrites neighborhood into neighbourhood for an American audience, something is wrong with either the model or the prompt, and the scorer will show it as a leak.
Steps 11 and 12: Gate the Run in CI and Archive the Evidence #
Step 11 turns the report into a pass-or-fail check. report.py --max-leak-rate 5 exits with code 1 when any group exceeds five leaks per 1,000 words, which blocks a pipeline. The threshold is a choice, and you should calibrate it instead of guessing. Take five or six paragraphs of text that a human editor wrote for each locale, run them through score_text, and see what leak rate the scorer assigns to known-good writing. Expect a few false positives from names and quoted material. Set the gate above that baseline so that a pass means the model matched a competent human, and a fail means it fell short of one. Five is strict enough to catch a systematic habit and loose enough to tolerate a single slip in a short answer. Group by label for a global check, or by label,locale to hold each locale to its own bar. The offline stubs show the gate working:
python report.py --file results/offline.jsonl --by label --max-leak-rate 5
echo "exit=$?"
label | n | leaks_per_1000 | clean_pct | overcorrect_pct
stub-good | 30 | 0.0 | 100.0 | 0.0
stub-leaky | 30 | 205.26 | 20.0 | 0.0
FAIL: 1 group(s) above 5.0 leaks per 1000 words
exit=1
A scheduled GitHub Actions job can run the real harness weekly and fail when a model update shifts behavior. Store both API keys as repository secrets, and pass the model IDs as repository variables so you can change them without editing code.
name: dialect-check
on:
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install anthropic openai
- run: python tests/test_scorer.py
- run: python run.py --samples 3 --out results/weekly.jsonl
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CLAUDE_MODEL: ${{ vars.CLAUDE_MODEL }}
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
- run: python report.py --file results/weekly.jsonl --by label,locale --max-leak-rate 5
Step 12 archives the evidence. Copy results/*.jsonl, results/summary.csv and the saved model-ID files into a dated folder, commit the lexicon and prompts with them, and tag the commit. A dialect score without the exact lexicon version behind it cannot be reproduced, and a lexicon edit alone can move a number by several points. The finished project then looks like this, with the generated folders filled by your runs:
dialectbench/
lexicon.py scorer.py prompts.py
providers.py run.py report.py
tests/test_scorer.py
cache/ (one JSON file per generation)
results/ (frontier.jsonl, everyday.jsonl, summary.csv, *-models.txt)
Once the archive exists, a multi-stage writing pipeline can reuse the scorer as a final gate before anything publishes.
Common Pitfalls That Skew a Dialect Test #
- The prompt leaks its own spelling. Writing
color schemein the prompt hands the model the US form and inflates leaks for every other locale. Describe the thing in neutral words, as the prompts in Step 5 do. - Oxford
-izecounted as an error. Scoringorganizeas a leak foren-GBpenalizes a spelling that Oxford-style guides accept. Pick a house rule, write it down, and set theizegroup to match. - Ambiguous dates.
03/04/2027is both 3 April and 4 March. If your prompt date has a day of 12 or lower, the scorer can classify nothing. Use a day above 12. - Scoring names and code. Brand names, URLs and CSS properties contain US spellings that must stay. Mask protected strings and strip code before scoring, or the cleanest answers will score worst.
- Reading three samples as a verdict. A model that writes British English twice and American English once has only two clean samples out of three. Increase
--samplesto 10 for any locale where the call matters, and report the sample count with every number. - Comparing the app to the API. The chat apps add memory, custom instructions and their own system prompt. An app result and an API result are different experiments, and you should never put them in one table.
- Forgetting to freeze the lexicon. Edit the word list between two runs and you compare patterns, not models. Version the lexicon with the results.
- Trusting zero-leak answers. A model that avoids every dialect word scores perfectly and shows nothing. Check the
hitscount, and discard samples where it is near zero.
None of these mistakes announces itself. A harness with a masking bug, a loose lexicon or a prompt that leaks its own spelling still prints a tidy table, and the table looks just as authoritative as a correct one. The offline dry run, the tests and a habit of reading raw answers are the only defenses, so keep all three in the routine.
Style problems that have nothing to do with dialect also slip through a spelling scorer. Stock phrases and filler pass cleanly, which is why a pairing with the cliché test catches what this harness cannot.
Troubleshooting: 11 Failures and Their Fixes #
KeyError: 'CLAUDE_MODEL'. The environment variable is not set in the shell that runs the script. Export both model IDs again, or runenv | grep MODELto confirm they exist.- A 400 error that mentions temperature. Some models do not accept sampling parameters. Unset
TEMP(unset TEMP) and rerun. The harness only sends temperature when that variable exists. AttributeError: 'OpenAI' object has no attribute 'responses'. The installedopenaipackage predates the Responses API. Runpip install --upgrade openaiinside the virtual environment.- Retries exhausted with a rate-limit message. The harness gives up after four attempts. Wait a minute, rerun, and let the cache skip finished calls. If it recurs, add a short
time.sleepbetween calls or raise the attempt count. - Empty text from a Claude call. The answer may have hit
max_tokensbefore any text block appeared, which can happen when a model spends its budget reasoning. Raisemax_tokensingenerateand delete the empty cache file. - A model scores zero leaks but its answers look American. The lexicon is missing the words it used. Print three answers, read them, add the missing patterns to
lexicon.pyand rescore. en-USshows leaks. Check the answer for a stray25/03/2027, a UK word such aspetrol, or a quoted brand name that your protected list does not cover. Print the sample and read it.- Changing the lexicon did not change the numbers. You probably read an old results file. Rerun
run.pywith the same--outpath (it scores from cache) and then rerun the report. UnicodeEncodeErroron₹or£in a Windows console. SetPYTHONIOENCODING=utf-8before running, or use Windows Terminal. The harness already reads and writes its files as UTF-8.overcorrect_pctprintsNone. That is correct for thefreshtask and for any group with no protected strings. It is not a bug.pytestis not installed. Skip it.python tests/test_scorer.pyruns everytest_function and prints a count.
Advanced Tips for a Sharper Test #
Add locales. en-IE, en-NZ and en-ZA need only a new entry in LOCALES and one line in SYSTEMS. Prompts pick up the new locale automatically because build_prompts loops over the dictionary.
Cross-check the lexicon against a spelling dictionary. Hunspell ships en_US and en_GB dictionaries. A word that one dictionary accepts and the other rejects is a leak candidate, and this approach covers words your hand-built lexicon never listed. Use it to grow the lexicon, then keep the lexicon as the scoring source so results stay deterministic.
Put a confidence interval on the clean percentage. With nine samples per cell, a bootstrap over rows (resample with replacement 1,000 times) shows how wide the range is. If two models’ ranges overlap, say so, and run more samples before claiming a winner.
Track drift over time. Append each weekly summary.csv to a trend file with the run date, and chart leaks per 1,000 words by locale. ChatGPT vs Claude results move after every model update, and a trend line shows whether a new release fixed a habit or introduced one. Pair it with a saved copy of the prompts, because a prompt edit moves the line as much as a model edit.
Record the model ID in every row. The current driver stores a label, and the saved *-models.txt file carries the ID. Writing os.environ[...] into each row removes the dependency on that sidecar file.
Score edits, not only drafts. In daily use, writers paste existing text and ask a model to polish it. The convert task approximates that workflow, and you can extend it by feeding in a real paragraph that carries mixed spellings and checking whether the model normalizes all of them or only the first few. Mixed-input cases expose lazy editing faster than clean-slate prompts do.
Test your own content. Replace the three task prompts with real samples from your support tickets, product pages or release notes. A harness that scores your actual text, with your actual brand names in the protected list, tells you more than any public benchmark.
FAQ #
Which is better at British English in a ChatGPT vs Claude test, Claude or ChatGPT?
No published measurement answers that for the models released this month, and a ranking from someone else’s prompts will not transfer to your content. The harness gives you a number for your own prompts, tier by tier, and the two conditions show which model needs help.
Does a system prompt fix dialect leaks?
Often, but not always, and the size of the effect differs by model and by locale. The spec condition exists to measure it. A model that leaks under bare and stays clean under spec needs the instruction in production. One that leaks under both needs a stronger fix, such as a rewrite pass.
Why not ask a model to grade the dialect of another model’s answer?
A grader model shares the same blind spots and can be inconsistent run to run. Regular expressions return the same count every time, which makes a change in the score traceable to a change in the model, not in the judge.
How many samples do I need?
Three per cell is a smoke test. Ten or more per cell supports a comparison. If a decision depends on one locale, run that locale alone with more samples instead of raising the count everywhere.
Is -ize wrong in British English?
No. Oxford-style guides use -ize in British text, while many newsrooms and public bodies use -ise. The harness lets you choose per locale through the ize group. Decide once, record the decision, and apply it to every model equally.
Can I adapt this to other languages?
Yes, for dialect pairs such as Spain and Mexico Spanish or Brazil and Portugal Portuguese. Replace lexicon.py with word pairs for those variants and keep the scorer, prompts and report unchanged. Dates and number grouping also differ between those regions.
Does the test cover the ChatGPT and Claude apps?
No. It calls the APIs. The apps add memory, custom instructions and extra system text, so their behavior can differ. To test an app, paste the same 15 prompts by hand, save the answers in the results format, and run the scorer on them.