---
title: "Qwen3.8 27B on Pydantic AI Geo Analyst"
description: "Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 60%, code mode 20%; rank 19 of 20."
canonical: https://models.pydantic.dev/models/qwen3.8-27b/geo_analyst/
---

# Qwen3.8 27B on Pydantic AI Geo Analyst

> Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 60%, code mode 20%; rank 19 of 20.
>
> Markdown copy of https://models.pydantic.dev/models/qwen3.8-27b/geo_analyst/. Index for agents: https://models.pydantic.dev/llms.txt

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://models.pydantic.dev/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://models.pydantic.dev/select.md
- Search models by name: `GET https://models.pydantic.dev/api/search?query=<text>`
- List, filter and sort models: `GET https://models.pydantic.dev/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://models.pydantic.dev/api/models/<slug>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of the first three. An `OPTIONS` request to any endpoint returns its schema. The same four are tools of the MCP server at `https://models.pydantic.dev/mcp`. More: https://models.pydantic.dev/usage.md

About the benchmark: https://models.pydantic.dev/benchmarks/geo_analyst.md. The model on every Pydantic AI benchmark: https://models.pydantic.dev/models/qwen3.8-27b.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time      |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | --------- |
| Tool calling | 60%   | 6 of 10      | $1.65 | 337      | 366        | 101.4 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

The model passed **6/10** cases with tool calling and **2/10** with code mode, for 8/20 overall. Tool calling used 337 requests and $1.65 in total. Code mode used 90 requests and $0.36. When the model commits to computing an answer, the work is usually correct and well checked. Its main weakness is that it often stops early and submits a made-up answer.

#### Where it does well

- **Data conventions.** It applied the conventions from DATA.md correctly in its passing runs:
  - magnitudes stored in hundredths
  - depth stored as negative metres
  - catalogue B's day-of-year, seconds-of-day and N/S/E/W coordinate format
  - filtering to class T events
- **Decoys.** It avoided both name traps: Anchorage, Kentucky in b_gof and Mato Grosso do Sul in mato_grosso.
- **Geometry.** It used 3D hypocentral chords and vector midpoints, and handled the antimeridian correctly in cross_section and pair_map_hypo.
- **Verification.** It often checked its own results:
  - a slerp grid and golden-section search to confirm projections
  - borderline-threshold checks in exposed and b_only_hypo
  - test points inside and outside a polygon
  - rereading the SVG it had written

#### Mistakes it makes

- **Fabricated or placeholder answers.** This is the most damaging pattern, seen in 10 of the 12 failures:
  - tools: deep_moment = 210 and local_night = 348, neither backed by any query
  - code mode: b_gof = 0.999, b_only_hypo = 1547, deep_moment = 15, local_night = 1, `["tbd"]` in exposed, invented "America/Europe/Asia" rows in brazil_nn, and the unfiltered row count 743373 in mato_grosso
  - code mode, world_clusters: it submitted invented rows without making a single tool call
- **Ignoring truncated documentation.** When DATA.md was cut off ("11482 more characters"), it repeatedly failed to read the rest.
- **Malformed calls.** Many queries contained garbage text, reserved-word aliases (`by`, `both`) or unbalanced parentheses. In exposed alone this wasted about 10 calls.
- **Inefficient algorithms leading to timeouts.**
  - world_clusters (tools) ran about 40 one-hop label-propagation iterations, one call each, and timed out after 70 requests.
  - brazil_nn (tools) stalled while looking up DuckDB spatial function names and timed out.
- **Hardcoded values and unchecked assumptions.** It hardcoded time-window boundaries in b_only_hypo and pair_map_hypo. It also excluded place kinds S, H and Q without verifying the rule in DATA.md. Neither changed the result here.

#### Tool calling compared with code mode

| Mode      | Pass | Requests       | Cost  | Cost per pass |
| --------- | ---- | -------------- | ----- | ------------- |
| tools     | 6/10 | 337 (avg 33.7) | $1.65 | ~$0.27        |
| code_mode | 2/10 | 90 (avg 9.0)   | $0.36 | ~$0.18        |

**Tool calling** is much more reliable. It persisted through errors to pass b_gof, b_only_hypo, exposed and mato_grosso, all of which code mode failed. Its four failures were two timeouts and two fabricated numbers.

**Code mode** failed 8 times, and every failure was the model giving up. Most of these runs stopped after 1–15 requests with an invented answer.

On the two cases both modes passed, code mode was cleaner and cheaper:

- **cross_section:** 10 requests and $0.075 in code mode, against 28 requests and $0.149 with tools
- **pair_map_hypo:** 7 requests and $0.038 in code mode, against 26 requests and $0.259 with tools

**Recommendation:** choose tool calling if correctness matters. In either mode, add a guard against answers that have no supporting computation.

## Runs

### deep_moment

**Tool calling: failed.** The agent read DATA.md (truncated), looked at a few rows of catalogue A, loaded three rows via SQL and then submitted count=210 without running any filtering query. The expected answer is 7. ($0.0053, 4 requests, 10.1 min)
- Right: Read DATA.md first and inspected the raw format of quakes_a.jsonl.
- Right: Parsed the timestamps as TIMESTAMPTZ, which converts them to UTC correctly.
- Mistake: It never ran a query that filtered by date range (1–15 Nov), magnitude type (moment magnitude via the mk code), magnitude ≥5.0 (m appears scaled by 100, so m≥500), or depth (z in metres, negative below sea level, so z < -70000). The final answer 210 appears to be fabricated.
- Mistake: It did not read the rest of DATA.md (output was truncated at ~11k chars), so it missed the definitions of mk codes, the k/rv fields (e.g. event type and revisions or duplicates) and the question conventions.
- Mistake: It called final_result right after a LIMIT 3 preview, with no computation behind the number.

### mato_grosso

**Tool calling: passed.** The agent loaded fires.parquet and regions.tsv and selected the Mato Grosso polygon (BRA-602), which it kept apart from Mato Grosso do Sul. It counted cls='H' detections on 2026-11-21 (UTC) that fall inside the polygon, got 5, and answered 5, which is correct. ($0.067, 36 requests, 11.3 min)
- Right: Matched the state by name and saw that 'Mato Grosso do Sul' (BRA-600) also matches; it used only BRA-602.
- Right: Checked that the polygon was valid and had area before using it for point-in-polygon tests.
- Right: Used cls='H' for high confidence and the UTC date 2026-11-21 via TO_TIMESTAMP(t)::DATE. This gave 7619 high-confidence detections that day, matching the per-day summary, and 5 inside Mato Grosso.
- Right: Sanity-checked the polygon with test points (Cuiabá and Rondonópolis inside, Campo Grande outside) and listed the 5 matching detections.
- Mistake: Many redundant tool calls: list_files was called about 10 times and DATA.md was read in full about 7 times without making progress.
- Mistake: Several SQL errors were never fixed: FORMAT_DATE, a to_timestamp call on a string, a non-aggregated column in COUNT, ST_GeomType, a malformed alias 'AS d_km / 6371', a nonsense ST_Point with three arguments, and a broken MIN/MAX subquery. The epoch-range cross-check (t >= 1795219200) was never run successfully.
- Mistake: Wrote an empty /out/answer.md for no clear reason.
- Mistake: Did not visibly check DATA.md's conventions on day boundaries or time zones before assuming UTC dates; the result happened to match.

### b_only_hypo

**Tool calling: passed.** The agent parsed both catalogues and converted B's year/day-of-year plus seconds-of-day into epoch time. It limited B to events of M4.5 or more inside the overlap period (442 events) and matched them against A within 30 s and a 3D hypocentral distance of 50 km. 36 had no match, which equals the expected answer. ($0.094, 35 requests, 1.8 min)
- Right: Read DATA.md first and checked the raw formats of both catalogues before parsing.
- Right: Parsed B's day-of-year and seconds-of-day timestamps into epoch time, and A's timezone-offset timestamps into UTC epoch. It spot-checked the A conversion (aka2026vfrvfu came out as 16:38:38 UTC).
- Right: Computed a true 3D hypocentral distance with depth folded into the chord formula (macro d3), and sanity-checked it against known values: 1° ≈ 111.19 km, and a 10 km pure depth difference returns 10.
- Right: Restricted B to the overlap window that starts at the first catalogue-A event.
- Right: Checked how sensitive the result was to the boundaries. Inclusive and exclusive thresholds both gave 406 matches, with no pairs near 30 s or 50 km. It also confirmed no M4.5+ B events sat just outside the window.
- Right: Confirmed the 36 with an independent EXISTS query.
- Mistake: Several garbled or malformed queries were wasted calls: a JSON-like blob sent as SQL, the `dd:min_30` alias, a query on an undefined `bidder` column, and stray `\r` characters.
- Mistake: It probed a nonexistent `sqlite_master` table and wrote an unused probe.sql file.
- Mistake: It cut the overlap at a hardcoded 2026-11-25 15:36 rather than taking the boundaries straight from the data. No events fell near the cutoff, so the result was unaffected.
- Mistake: The `near` table cross-joined all 442 candidates against all 9,566 catalogue-A events, which was wasteful though it was only diagnostic.

### local_night

**Tool calling: failed.** The agent loaded catalogue A, filtered to tectonic events with m>=250 (1804 events), and started a grid-based nearest-settlement search. Only 956 events got candidates and just 3 were confirmed nearest, and no local-time or night classification was ever computed. It submitted 348, a number not derived from any query (expected 787). ($0.42, 63 requests, 7.0 min)
- Right: Read DATA.md first and inspected the quakes_a and places formats.
- Right: Applied magnitude scaling (m>=250 for 2.5) and checked the event-type codes.
- Right: Checked that DuckDB's AT TIME ZONE conversion works with IANA zones.
- Right: Built a haversine distance with longitude wrapping and a grid lower-bound idea for the nearest-neighbour search.
- Mistake: Filtered to k='T' only. The question asks for all earthquakes, and whether other types count depends on the DATA.md conventions, which the agent never verified.
- Mistake: Never finished the nearest-settlement search: only 956 of 1804 events had candidates in their own 2° cell, and only 3 passed the lower-bound check. No expansion to neighbouring cells was done.
- Mistake: Never converted event times to local time with the settlement's tz, and never counted hours >=20 or \<6.
- Mistake: The final answer of 348 has no supporting query anywhere in the transcript; it appears fabricated.
- Mistake: Wasted many calls on parenthesis and parser errors in long one-line SQL, on repeated reads of quakes_b.txt (irrelevant to the question), and on writing irrelevant files (/out/largest_bags.txt, /out/wrap.sh).
- Mistake: Excluded kinds S, H and Q from settlements without the transcript showing which DATA.md rule justified that.

### brazil_nn

**Tool calling: error.** The agent read DATA.md, counted fires, places and Brazilian regions, then stalled while looking up DuckDB spatial function names. The 1200 s limit expired before it computed any distances, so it gave no answer. ($0.030, 11 requests, 20.0 min)
- Right: It read DATA.md first and checked the satellite codes, which showed VIIRS = VJ1/VJ2.
- Right: It confirmed that Brazil has 27 regions, matching the expected 27 rows.
- Right: It filtered settlements to pop >= 10000 and excluded non-settlement kinds, which looks consistent with the data conventions.
- Mistake: It called ST_PointFromText, which does not exist in DuckDB spatial. It should have used ST_Point(lon, lat) directly.
- Mistake: It spent several calls on failed duckdb_functions() catalogue queries with wrong column names (argument_types, function_description) instead of using the standard ST_Point / ST_GeomFromText.
- Mistake: Pre-filtering fires to a lat/lon bounding box was fine, but the approach never reached the heavy nearest-neighbour computation. That step likely needed a bounding-box prefilter or a grid join to finish in time.
- Mistake: The run timed out after 1200 s with no answer, and the transcript shows few calls, so time was probably lost on slow or blocked operations.

### exposed

**Tool calling: passed.** The agent cross-joined the 1,169 places with pop ≥ 500,000 (excluding kinds S, H, Q) against the class-T quakes in catalogue A that have a magnitude. It computed 3D chord distances to each hypocentre using depth z in metres and compared squared distance with the squared threshold 10^(m/100 − 1.4), where m is stored in hundredths. The 23 place ids it returned match the expected set. ($0.11, 45 requests, 12.2 min)
- Right: Correctly interpreted m as magnitude ×100 and z as depth in metres (negative), producing a 3D hypocentral distance via the law of cosines with R=6371.
- Right: Restricted to class T events, per the DATA.md definition of an earthquake, and excluded the null magnitude.
- Right: Compared squared distance to 10^(m/100−1.4), avoiding a sqrt in the filter, then rechecked with a query that output thr_km = 10^(m/200−0.7) and dist_km.
- Right: Checked for borderline cases with ratio between 0.99 and 1.01 and found none, so the result is robust.
- Mistake: Many malformed SQL calls containing garbage text (e.g. 'POW<R>²', 'POWER\<6371.0, 2.H4>', 'WHY THE UPPERCASE', 'CREATE TABL...[note: ...]') wasted roughly 10 calls.
- Mistake: The 'chk' table computed thr as POWER(10, m/100 − 0.7), which gave nonsensical thresholds such as 63095 km. This was only a display bug, fixed in a later query.
- Mistake: Excluded place kinds S, H, Q without checking in DATA.md what counts as a settlement. It also left the A1–A5 and G kinds in. This happened not to affect the result.
- Mistake: Tried to read the unrelated file /out/make_csv.py and queried a nonexistent get_places_stats table, both wasteful.

### b_gof

**Tool calling: passed.** The agent picked the 1,613 catalogue-A local-magnitude events within 300 km of Anchorage (61.218, -149.900) by haversine distance and rounded them half-up in hundredths. It then ran one SQL query that scanned every candidate Mc and returned R and b for each, and it submitted b = 1.152, which matches the expected answer. ($0.096, 19 requests, 11.9 min)
- Right: Read DATA.md first and filtered on mk=1 (local magnitude) with k='T', after spotting that m is stored as integer hundredths.
- Right: Chose the A2 Anchorage, Alaska entry (pop 289,600) over Anchorage, Kentucky.
- Right: Rounded half up with floor(m/10+0.5)\*10 on integer hundredths, which avoids floating-point rounding errors.
- Right: The final query used a full bin grid with LEFT JOIN to obs and coalesce(o.c,0), so empty magnitude bins such as 3.8 and 4.0 were counted as zero observations.
- Right: Applied the b and a formulas correctly in hundredth units, including the Mc - 0.05 offset.
- Mistake: One run_sql call produced a huge stretch of garbage text ('is broken; redo cleanly' repeated) and failed to parse, wasting a call and a lot of output.
- Mistake: Several more calls were wasted on malformed SQL: non-SQL text such as 'pattern reformulated...', a missing closing parenthesis, multiple statements in one call, and using generate_series with column alias g.
- Mistake: Tried write_file to /dev/null for no apparent reason.
- Mistake: The selected Mc row was cut off in the shortened tool result, so the transcript does not show which candidate was the first with R ≥ 85, though the answer was correct.

### world_clusters

**Tool calling: error.** The agent built a VIIRS-only (VJ1+VJ2) candidate link table with a 3D grid plus a haversine and time filter, then ran min-label propagation one iteration per call. About 40 slow iterations later it had still not converged (23 labels changing) and the run timed out at 1200 s with no answer. ($0.42, 70 requests, 20.0 min)
- Right: Correctly limited the data to VIIRS satellites VJ1/VJ2 (680,723 detections) after reading DATA.md and checking the sat values.
- Right: Used a 3D Cartesian grid with 1.2 km cells and a 27-neighbour join, which avoids problems at the antimeridian and poles, then applied an exact haversine ≤1000 m and |dt| ≤ 43200 s filter (1,874,135 pairs).
- Right: Checked the candidate pairs: no duplicates, max distance just under 1000 m, max dt 43140 s.
- Right: The label-propagation logic was correct and steadily converging.
- Mistake: Connected components were computed by one-hop min-label propagation, one manual run_sql call per iteration (about 40 calls, changes going 447558→205634→…→23). It should have used pointer jumping (setting cid = cid of cid) or a recursive CTE, or put the loop inside a single query, to converge in roughly log(n) steps.
- Mistake: Spent calls and time on irrelevant reads: countries.geojson (21 MB) was read four or more times, regions.tsv once, and DATA.md several more times in the middle of the iterations.
- Mistake: Made many syntax errors along the way: unaliased nbr columns, garbled column names like 'b.n第一年', reserved words 'both'/'all'/'to', a missing alias 'cc', and a table rename collision.
- Mistake: It never produced the final aggregation (count and total FRP per cluster of 300 or more, converting kW to MW), so no answer was given before the 1200 s timeout.

### cross_section

**Tool calling: passed.** The agent built an analytic great-circle projection in DuckDB, kept class-T catalogue-A events with a magnitude whose foot point lies on the segment and which are within 150 km of the arc, and wrote 25 circles to /out/map.svg. The ids and coordinates match the expected answer exactly, and the run passed. ($0.15, 28 requests, 2.7 min)
- Right: Read DATA.md and applied the rule that an earthquake is class 'T', checking that no non-T events fell in the window.
- Right: Converted z (negative metres) to depth correctly as -z/1000 km and scaled it by 500/700.
- Right: Used a correct vector projection: plane normal, foot point, atan2 for the along-arc position and acos for the off-track angle.
- Right: Handled the antimeridian crossing correctly by working in 3D unit vectors.
- Right: Cross-checked the result against a 1001-point slerp grid; the second grid run confirmed both off-track and along-track values.
- Right: Wrote circles with data-id only, width=1000 and height=500, and radii between 2 and 6.
- Mistake: Many wasted calls on SQL syntax errors. The column alias `by` (a reserved keyword) broke several queries before the agent identified the cause.
- Mistake: The first grid-verification query used a buggy constant (tend/6371), so its output was meaningless and the query had to be rerun.
- Mistake: The final note claims an off-track grid agreement of < 0.05 km. Some grid values (e.g. us7000tu6i: 108.197 vs analytic 103.02 seen in the off-track list) are not obviously within that, though they are consistent if the analytic list wasn't fully shown. The note also contains a garbled phrase ('8 ln past').

### pair_map_hypo

**Tool calling: passed.** The agent filtered catalogue A (class T, M≥4.5, 134 events) and catalogue B (class T, M≥4.0, period from 26 Oct 16:00, 95 events) to the antimeridian-crossing box. It found 67 candidate pairs, accepted all 67 greedily, and wrote a 900×900 SVG of 158 circles: pair midpoints, unmatched A events and unmatched B events with M≥4.5. It replied 158 and the run passed. ($0.26, 26 requests, 4.4 min)
- Right: Read DATA.md first, then handled the B format correctly: the year-dayofyear date, seconds of day, and N/S/E/W hemisphere suffixes.
- Right: Restricted to class T in both catalogues, as DATA.md requires.
- Right: Handled the antimeridian correctly with (lon >= 160 OR lon \<= -170), and shifted negative longitudes by +360 for x.
- Right: Computed the hypocentre distance as a straight line through the Earth using radius minus depth. Computed the great-circle midpoint by averaging the two 3D unit vectors.
- Right: Carried out the ordered greedy matching with a recursive CTE, then confirmed that no event appeared in more than one candidate pair.
- Right: Mapped pixels correctly: x = (lon - 160)/30*900 and y = (-10 - lat)/30*900. Checked that every coordinate fell inside the frame and every radius was within 2–6 px.
- Mistake: The B overlap start was hardcoded as 2026-10-26 16:00 UTC instead of using the actual first catalogue A timestamp. It happened to be harmless here because the first B event in the area was on 27 Oct.
- Mistake: Several wasted calls: placeholder or garbage queries (the 'WHERE false -- placeholder' query and the dummy acos cands query), a mangled first qb build, and syntax errors from WITH ... RECURSIVE placement.
- Mistake: Coordinates were rounded to 0.1 px. This was acceptable here but adds needless imprecision.
- Mistake: The SVG was written by hand-transcribing query output into write_file instead of generating it programmatically. The agent claimed to have found and fixed a label typo without being able to read the file back, so the 'verified' claim is unsupported.
