---
title: "DeepSeek V4 Pro 0423 on Pydantic AI Geo Analyst"
description: "Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 80%, code mode 80%; rank 15 of 20."
canonical: https://models.pydantic.dev/models/deepseek-v4-pro/geo_analyst/
---

# DeepSeek V4 Pro 0423 on Pydantic AI Geo Analyst

> Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 80%, code mode 80%; rank 15 of 20.
>
> Markdown copy of https://models.pydantic.dev/models/deepseek-v4-pro/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/deepseek-v4-pro.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 80%   | 8 of 10      | $2.04 | 362      | 386        | 57.4 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

The model passed 16 of 20 runs: 8/10 with tool calling and 8/10 in code mode. Its domain reasoning is strong. Three of the four failures had the same cause: it repeated identical calls until it hit the 80-request limit. The fourth failure was a coordinate-projection error. Neither mode passed every case. Each mode failed two different cases.

#### Where it does well

- **It reads the data dictionary first, every time.** It applied the encoded conventions correctly in all runs:
  - magnitudes stored in hundredths
  - `z` in metres, negative down
  - `k='T'` for earthquakes
  - `mk` magnitude types
  - excluded place kinds S/H/Q
  - VIIRS = VJ1/VJ2
- **It avoids traps in names and data.**
  - It picked Anchorage, Alaska over Anchorage, Kentucky (`b_gof`).
  - It excluded Mato Grosso do Sul (`mato_grosso`).
  - It handled antimeridian crossings in `cross_section` and `pair_map_hypo`.
  - It used 3D hypocentral distance where the task required it.
- **It checks its own work.**
  - It computed results two ways: two formulas in `cross_section`, and Python vs DuckDB in `exposed` and `b_only_hypo`.
  - It tested how DuckDB's `median` behaves.
  - It proved the bounding box was safe in `brazil_nn` (tools).
  - It checked cell size at high latitude in `world_clusters` (code).
- **It is cheap on simple lookups.** `deep_moment` and `mato_grosso` took 4–9 requests and about $0.014–0.018 each.

#### Mistakes it makes

- **Degenerate repetition loops (the main risk).**
  - `local_night` (tools) had already computed the correct 787. It then reran the same verification about 30 times and never submitted.
  - `world_clusters` (tools) reran one lat-range query about 65 times.
  - `brazil_nn` (code) resubmitted the same cells 14–19 times each. It was 2–3 queries from finishing.
  - The same habit wasted calls in passing runs. `b_only_hypo` (tools) made about 23 `list_files` calls, and `brazil_nn` (tools) repeated one count about 26 times.
- **Unchecked assumptions.** It often left DATA.md partly unread after truncation (`deep_moment`, `mato_grosso`, `cross_section`). It also hardcoded overlap windows without checking them. These assumptions happened to be right every time.
- **No sanity check on outputs.** `pair_map_hypo` (code) set the top edge at 10°N instead of 10°S. Every y value was wrong, and clamping to 0–900 hid the error.
- **Minor slips it caught itself.** Examples include a units error in `b_gof` (code), angle misuse in `exposed` (code), and DuckDB reserved-word aliases in `cross_section` (tools).

#### Tool calling compared with code mode

| Mode      | Passed | Requests | Cost  |
| --------- | ------ | -------- | ----- |
| tools     | 8/10   | 362      | $2.04 |
| code_mode | 8/10   | 225      | $1.74 |

- **Code mode used fewer requests.** Excluding failed runs, it was also usually cheaper (for example, `cross_section` $0.086 vs $0.188). It completed `world_clusters` with label propagation (35 requests) and `local_night` (20 requests), both of which looped out under tools.
- **Code mode has its own failure risks.**
  - It hit sandbox quirks: file iteration, a missing `io` module, `time.time()`.
  - Its one looping failure was the most expensive run overall (`brazil_nn`, $0.82).
  - Its only non-loop failure was a logic error (`pair_map_hypo`).
- **The deciding factor is the request budget.** Whichever mode you choose, enforce a stop or submit rule, because loops caused 3 of the 4 failures.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md, inspected catalogue A, and ran a single filtered count: class T, mk=3, m>=500, z\<-70000, UTC window 1–15 Nov. It got 7, listed the 7 events to check them, and answered 7, which is correct. ($0.018, 9 requests, 30 s)
- Right: Read the data dictionary first and applied its codes: class T counts as an earthquake, mk=3 is moment magnitude, and m is stored in hundredths, so 5.0 becomes m>=500.
- Right: Read depth z as metres with negative meaning below sea level, so 'more than 70 km below' became z < -70000 with a strict inequality.
- Right: Saw that DuckDB converted the offset timestamps to UTC and used a half-open window \[Nov 1, Nov 16) so all of 15 November was included.
- Right: Listed the matching rows to sanity-check the count. Boundary cases (m=500, z=-74384) came out as intended.
- Mistake: Part of DATA.md was truncated (the rest of the quakes_a key table, including fields like rv) and the agent never read the missing section. It did not check whether rv (revision) or any duplicate or superseded-event convention should affect the count. It passed, but it did not confirm that no such rule applied.

### mato_grosso

**Tool calling: passed.** The agent looked up Mato Grosso (BRA-602) in regions.tsv and spatially joined fires.parquet filtered to cls='H' and the UTC day 21 November 2026. The query returned 5, which matches the expected answer. ($0.017, 9 requests, 35 s)
- Right: It read DATA.md first, as the handbook asks, and learned the fires column meanings (cls 'H' = high confidence, t = epoch seconds UTC).
- Right: It matched the region name exactly with name='Mato Grosso' and country='BRA', so it did not mix in 'Mato Grosso do Sul', which the ILIKE lookup had also returned.
- Right: It checked the epoch conversion against a known value (1794960000 = 2026-11-18) before computing the day bounds 1795219200 to 1795305600.
- Right: It answered in one efficient spatial join query using ST_Within on ST_Point(lon, lat).
- Mistake: Both read_text calls on DATA.md came back truncated, including '[6124 more characters]' in the fires section. The agent never read the rest of the fires conventions (e.g. which day boundary to use, possible duplicates or flags) before querying. It passed, but it relied on UTC-day and no-dedup assumptions it had not confirmed.

### b_only_hypo

**Tool calling: passed.** The agent parsed both catalogues and limited B to M≥4.5 events inside A's coverage window (442 candidates). It then ran a NOT EXISTS anti-join using 30 s time tolerance and 3D hypocentral distance ≤50 km, got 36, confirmed that with a second formulation, and submitted the correct count of 36. ($0.18, 37 requests, 4.7 min)
- Right: Read DATA.md first, then sampled both files to learn the formats: A's local-offset timestamps with z in metres (negative down), and B's year-day plus seconds-of-day with N/S/E/W hemisphere suffixes.
- Right: Converted B's 'YYYY-DDD' plus seconds into proper timestamps and checked the parse on sample rows.
- Right: Restricted B to the overlap period. It used A's coverage start (26 Oct 16:00 UTC, matching A's minimum epoch) and an end bound past A's last event.
- Right: Computed true 3D hypocentral distance with ECEF coordinates, using the correct depth signs for each catalogue (A: 6371 + z/1000; B: 6371 − depth_km).
- Right: Cross-checked the result with a second query (squared distance ≤ 2500) that also returned 36, and checked for nulls and the depth range.
- Mistake: The overlap start was derived from A's first event (1793030551.9) rounded down to 16:00 UTC, not from an explicit coverage boundary in DATA.md. It happened not to matter, but it was assumed rather than confirmed.
- Mistake: After the final LEFT JOIN diagnostic query failed on a typo (length(1984)), the agent never fixed and reran it. Instead it called list_files about 23 times in a row with no purpose before answering. This wasted many requests.

### local_night

**Tool calling: error.** The agent loaded the settlements (excluding kinds S/H/Q), filtered catalogue A to class T with m≥250, and found each quake's nearest settlement with expanding haversine radius joins. It then computed night_count = 787, which matches the expected answer. It never submitted that number: it repeated identical verification queries (~20× 'SELECT count(\*) FROM nearest', ~30× the same min-distance check) until it hit the 80-request limit. ($0.51, 80 requests, 11.7 min)
- Right: Read DATA.md and correctly applied class T and the magnitude scale (m in hundredths, so m >= 250).
- Right: Worked around the OOM error and the failed ST_DWithin filter (it returned all 162307 places because of degree units) by writing a haversine macro and searching incrementally wider radii (20 to 5000 km) until all 1804 quakes had a nearest place.
- Right: Converted each quake's time with AT TIME ZONE n.tz and applied the 20:00–06:00 window correctly, getting 787.
- Right: Ran a verification query confirming no closer settlement was missed (it returned empty).
- Mistake: After the expanding-radius loop finished it called 'SELECT count(\*) FROM nearest' about 20 times in a row with the identical result 1804, wasting requests.
- Mistake: After computing night_count = 787 it re-ran the same min-distance verification query about 30 times, each returning empty, and never gave a final answer.
- Mistake: It exhausted the 80-request limit (UsageLimitExceeded) when the correct answer was already in hand; it should have answered {"count": 787} right after the first empty verification result.

### brazil_nn

**Tool calling: passed.** The agent filtered VIIRS fires (VJ1/VJ2) to Brazil's 27 regions and found the nearest settlement with pop ≥10,000 (excluding kinds S/H/Q) using a ±5° bounding-box prefilter with ST_Distance_Sphere. It then took the count and median per region. All 27 rows matched the expected answer. ($0.46, 78 requests, 17.4 min)
- Right: Read DATA.md first. Applied the settlement kind exclusion (S, H, Q) and the VIIRS satellite filter (VJ1, VJ2).
- Right: Checked that there were no duplicate fids from the region join, and compared ST_Within with ST_Intersects (both gave 93,791 detections, 0 duplicates).
- Right: Showed the ±5° box was safe: the largest nearest distance (387 km) is below the ~466 km minimum box half-width. It also recomputed the worst-case fire (fid 546965) against all settlements and got the same distance.
- Right: Confirmed that DuckDB's median averages the two middle values for an even count (test gave 2.5 for 1–4).
- Mistake: Wasted many calls: the same correlated-subquery nearest-neighbour query was rerun 9 times, timing out after 30 s each time.
- Mistake: The same `SELECT count(*) ... americas_settlements` query was issued about 26 times in a row with identical results, which looks like a loop. The 1k-sample cross join was also run three times.
- Mistake: The RTREE index was created but never used. The working approach was a simple bounding-box join.

### exposed

**Tool calling: passed.** The agent read DATA.md, loaded catalogue A tectonic events with magnitude/100 scaling and places with pop >= 500,000 (excluding kinds S/H/Q), then computed 3D hypocentral distance using the law of cosines with depth. It returned 23 place ids that match the expected answer. ($0.050, 14 requests, 1.8 min)
- Right: Read DATA.md in segments before querying and applied its conventions: earthquake = class T, m stored in hundredths, z in metres negative-down.
- Right: Computed true hypocentral (slant) distance from depth and great-circle angle rather than epicentral surface distance.
- Right: Checked z ranges, including 143 positive z values (above sea level), and handled them through the depth_km = -z/1000 sign convention.
- Right: Recovered quickly from the read_psv error by switching to read_csv with delim='|'.
- Right: Listed the matching place-quake pairs with distances to sanity-check before collapsing to distinct pids.
- Mistake: The filter kind NOT IN ('S','H','Q') was applied without the transcript showing the kind-code definitions being reviewed in detail (the place section was truncated). It happened to give the right set.
- Mistake: Minor redundancy: the same expensive join was run three times (count, detail, distinct) when one detailed query would have sufficed.

### b_gof

**Tool calling: passed.** The agent filtered catalogue A to local-magnitude tectonic events within 300 km of Anchorage (61.218, -149.900) and rounded the magnitudes as integer tenths. It computed the goodness-of-fit R for every candidate Mc in SQL and submitted b = 1.152, which matched the expected answer. ($0.079, 16 requests, 2.3 min)
- Right: Read DATA.md and used its codes: mk=1 is local magnitude and class k='T' is an earthquake, which drops non-tectonic events.
- Right: Chose the Anchorage, US entry with population 289,600, not the small Kentucky Anchorage.
- Right: Worked on m/10 rounded to integer tenths with floor(x+0.5), so halves round up and floating-point rounding errors are avoided.
- Right: Ran candidate Mc values from -1.5 to 4.4 in 0.1 steps. Bins with no events counted as zero observed (COALESCE in a LEFT JOIN), and log10(e) was hard-coded as 0.4342944819.
- Right: Computed a, b, predicted counts and R exactly as the task defined them.
- Mistake: The first SELECT on the fit table was repeated identically, and the output was truncated both times. Neither visible result shows the first Mc with R ≥ 85, so the agent submitted 1.152 without an explicit filter query (e.g. WHERE R >= 85 ORDER BY c LIMIT 1) to confirm it. The step that picked the answer is not visible in the transcript.
- Mistake: An early query building the table with a float magnitude was thrown away and rebuilt with integers, which was minor wasted effort.

### world_clusters

**Tool calling: error.** The agent read DATA.md, built a VIIRS table (VJ1+VJ2, 680,723 rows) with an RTREE index, and tested a spheroid distance join on a small subset. It then got stuck re-running the same lat-range filter query about 65 times until it hit the 80-request limit, never computing clusters or giving an answer. ($0.32, 80 requests, 5.2 min)
- Right: Read DATA.md and correctly picked VJ1/VJ2 as the VIIRS satellites (sat column).
- Right: Checked the available spatial functions and confirmed that ST_DWithin_Spheroid with 1000 m matches a 1 km threshold.
- Right: Created a geometry table with an RTREE index and tested the pairwise link condition (abs(t diff) \<= 43200 s) on a small subset (1270 links among fid\<=1000).
- Mistake: After the EXPLAIN and lat min/max checks, the agent issued the identical query 'SELECT count(*) FILTER (WHERE lat < -80), count(*) FILTER (WHERE lat > 80) FROM v' roughly 65 times in a row. Every result was [0,0], and the loop used up the whole request budget.
- Mistake: It never built the edge table or ran connected components (for example, an iterative min-label propagation in SQL), so there was no cluster computation at all.
- Mistake: It did not convert frp_kw to MW (divide by 1000) or aggregate by cluster, so no final answer was produced.

### cross_section

**Tool calling: passed.** The agent computed along-track and cross-track distances for catalogue A events against the 23°S 178°E to 17°S 174°W great circle in DuckDB, found 25 events, wrote an SVG with 25 circles, and answered 25. The run passed. ($0.19, 15 requests, 5.6 min)
- Right: Read DATA.md first and used the z field in metres (negative down) for depth, converting with -z/1000\*500/700.
- Right: Kept only events with a magnitude (m IS NOT NULL) and k='T'. The set of 25 matched the expected ids.
- Right: Checked the result two ways, first with bearing-based cross-track/along-track formulas and then with a 3D vector projection. Both gave 25.
- Right: Handled the antimeridian crossing correctly, using dlon=8° for the first method and lon=-174 for the vector method.
- Right: The SVG satisfied the spec: width=1000, height=500, r=4 circles, and data-id only on the circles.
- Mistake: Several wasted calls on DuckDB parser errors from reserved words: 'lambda' was used as a column alias, and 'by' was used as an alias in the vector query.
- Mistake: Earlier, a modulo expression was rewritten to mod() needlessly, since the actual error was the lambda alias.
- Mistake: The k='T' filter was added without the transcript showing a justification. It happened to match the expected set.

### pair_map_hypo

**Tool calling: passed.** The agent loaded both catalogues, filtered A (m≥450 in hundredths, class T) and B (mag≥4.0, class T) to the overlap period and area, and matched them on 3D hypocentre distance with a recursive greedy CTE, finding 67 pairs. It wrote 158 circles (67 midpoints, 67 unmatched A, 24 unmatched B≥4.5) to /out/map.svg; the run passed. ($0.22, 24 requests, 7.6 min)
- Right: Read DATA.md first and correctly read catalogue A magnitudes as hundredths (m>=450) and depth z as negative metres.
- Right: Parsed catalogue B's year-day date plus seconds-of-day into timestamps, and its N/S/E/W hemisphere suffixes into signed degrees.
- Right: Handled the antimeridian-crossing box with (lon >= 160 OR lon \<= -170), and mapped x by shifting negative longitudes +360 before scaling by 30 px/degree.
- Right: Used 3D hypocentre distance (radius minus depth) for the 50 km test, as the task asks.
- Right: Computed true great-circle midpoints by averaging unit vectors, not by averaging lat/lon.
- Right: Ran a sanity check showing the 67 candidates had 67 distinct A ids and 67 distinct B ids, so greedy acceptance was trivially one to one.
- Right: The final count of 158 matches the expected number of points.
- Mistake: The overlap-period bounds (2026-10-26 16:00 UTC to 2026-11-25 15:36 UTC) were hardcoded without querying the actual min/max timestamps of each catalogue. The upper bound in particular looks arbitrary. The result matched, but this was unverified.
- Mistake: Wasted effort: the first view-creation call referenced the nonexistent column lat_deg, and the first recursive query omitted RECURSIVE. Both needed retries.
