---
title: "Gemma 4 31B on Pydantic AI - Structured output"
description: "Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 0%; rank 44 of 44."
canonical: https://pydantic.dev/models/list/gemma-4-31b-it/structured_output/
---

# Gemma 4 31B on Pydantic AI - Structured output

> Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 0%; rank 44 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/gemma-4-31b-it/structured_output/. Index for agents: https://pydantic.dev/models/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://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://pydantic.dev/models/select.md
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/api/ask?query=<question>`

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

About the benchmark: https://pydantic.dev/models/benchmarks/structured_output.md. The model on every Pydantic AI benchmark: https://pydantic.dev/models/list/gemma-4-31b-it/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | -------- |
| Tool calling | 0%    | 0 of 10      | $0.044 | 16       | 16         | 15.7 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

Gemma-4-31B failed all 10 cases in tools mode. One failure was a provider timeout (tier4-05840865, 0 requests), and one ended on `Exceeded maximum output retries (3)` (tier4-NI626135). The other 8 runs submitted an accepted answer that was incomplete. The runs were cheap (about $0.002–0.012) and short (1–4 requests), and the model never went back to the accounts.

#### Where it does well

- **Headline figures:** where it gave a subtotal (net current assets, net assets, shareholders' funds, P&L reserve, PBT, PAT), it was almost always correct. Signs on reserves and losses were right, and £000 figures were scaled correctly (tier1 cases).
- **Group and parent separation:** it split group and parent correctly in the tier3 and tier5 cases.
- **Company details and directors:** names, numbers, dates and directors were right in every case that asked for them.
- **Sign fixes:** in both tier1 cases, a sign error on prior-year `tax` was fixed after the check message.

#### Mistakes it makes

- **Leaves out line items (8 of 8 answered cases):** it habitually returned only the subtotals that tie the statements together. Intangible assets, tangible assets, investments, cash, debtors and stocks were null in every case. Interest receivable was dropped in three cases (11600506, SC121467, 12026946). In the tier3 cases it even left out creditors and net current assets. The handbook says null is only for lines the accounts do not show.
- **Fakes the creditors note (3 cases):** in 12026946 it got past the sum check by sending `creditors: []`. In NI037684 it invented one `amounts_owed_to_group` line equal to total creditors. In NI626135 it repeated `other_tax_and_social_security` up to five times and ran out of retries. It never supplied `prior_amount` values.
- **Breaks explicit rules:** it gave `creditors_within_one_year` as negative (-8804000) in SC121467, and `accounts_type` as `full` instead of `medium` in NI037684.
- **Malformed JSON:** in several first calls it closed objects early with stray `,` or brace placement (`company`, `group`). The harness seems to have repaired these.

The validator accepts null and empty lists, so leaving data out passes the checks. That is why most runs "succeeded" with answers missing large parts of the expected data.

## Runs

### tier1-07054261

**Tool calling: failed.** Made two `accounts` calls. The second call was accepted, with every subtotal correct but `intangible_assets`, `tangible_assets`, `investments`, `cash` and `total_assets_less_current_liabilities` left null in both years. ($0.0057, 2 requests, 34 s)
- Right: Company details and dates were all correct, and £000 figures were correctly multiplied by 1,000.
- Right: All P&L lines for both years matched, including the negative `operating_profit`, `profit_before_tax` and P&L reserve.
- Right: After the error `profit_before_tax - tax gives -10715000`, it changed prior `tax` from 138000 to -138000, which matches the tax credit in the expected values.
- Mistake: In the first and only real extraction (call 1), it left out the balance sheet line items: intangible 2640000, tangible 110000, investments 30000, cash 1687000, and the prior-year equivalents.
- Mistake: Left `total_assets_less_current_liabilities` null (expected -6187000 and -6319000), although it filled `net_assets` with the same figure.
- Mistake: In call 1, the JSON had a misplaced brace in `company`.

### tier1-11022760

**Tool calling: failed.** Made two calls. The validator rejected prior `tax: -632000`, and the model flipped it to 632000, which is correct. The answer was accepted, but `tangible_assets`, `investments`, `debtors` and `cash` were null in both years. ($0.0043, 2 requests, 42 s)
- Right: All balance sheet subtotals, the equity lines and `creditors_after_one_year` were correct for both years.
- Right: Responded to the check error by flipping the sign of `tax`, which matched the accounts' treatment.
- Mistake: In call 1, it left out debtors (10267000 and 6215000), cash (3269000 and 10217000), investments (16705000 and 27264000) and tangible assets.
- Mistake: Gave prior `other_operating_income` as null where the expected value is 0.

### tier2-11600506

**Tool calling: failed.** Made one call, which was accepted. Subtotals and P&L were correct, but intangible assets, tangible assets, cash and `interest_receivable` were missing. ($0.0024, 1 requests, 17 s)
- Right: All group subtotals, equity, cost of sales, admin expenses, other operating income, interest payable and tax were correct for both years.
- Mistake: Left out `intangible_assets` (2828132 and 3770157), `tangible_assets` and `cash` for both years.
- Mistake: Left out `interest_receivable` (91 and 1486).

### tier2-SC121467

**Tool calling: failed.** Made one call, which was accepted. It set `fixed_assets` and `current_assets` explicitly to null, gave creditors within one year as negative, and left out the asset lines and `interest_receivable`. ($0.0026, 1 requests, 18 s)
- Right: Net current assets, net assets, share capital, the P&L reserve, and profit before and after tax were correct in both years.
- Mistake: Gave `creditors_within_one_year` as -8804000 and -12695000, which breaks the handbook rule that creditors are positive.
- Mistake: Set `fixed_assets` and `current_assets` to null, although the accounts show 4627000 and 13197000.
- Mistake: Left out `distribution_costs` (1387000 and 1725000) and `interest_receivable` (301000 and 614000). With these missing, operating profit 474000 less interest payable 336000 cannot reach the PBT of 439000.

### tier3-05959188

**Tool calling: failed.** Made one call, which was accepted. For group and parent it gave only `current_assets`, total assets less current liabilities, net assets and equity, and left everything else null. ($0.0031, 1 requests, 16 s)
- Right: Group and parent were correctly separated, and every figure it gave matched the expected values for both years.
- Mistake: Left out fixed assets, intangible assets, tangible assets, investments, cash, debtors, `creditors_within_one_year` and `net_current_assets` for both entities in both years.
- Mistake: Left out the parent's `creditors_after_one_year` (34780864 and 27414845).

### tier3-09727592

**Tool calling: failed.** Same pattern as 05959188: one accepted call that gave only current assets, total assets less current liabilities, net assets and equity for group and parent. ($0.0024, 1 requests, 23 s)
- Right: Every figure it supplied, for both entities and both years, was correct, including the parent's positive prior net assets of 783514.
- Mistake: Left out fixed and tangible assets, investments, cash, debtors, creditors and `net_current_assets` for both entities.
- Mistake: Left out the parent's `creditors_after_one_year` (2162032 and 1529090).

### tier4-05840865

**Tool calling: error.** Timed out after 600 s with 0 requests completed, and no conversation was recorded. ($0.00, 0 requests, 10.0 min)
- Mistake: The run produced no output: it timed out at the provider before the first response.

### tier4-NI626135

**Tool calling: error.** Call 1 listed only bank and lease creditors and failed the within-one-year sum check. Calls 2 and 3 repeated the `other_tax_and_social_security` line up to five times. The run ended on `Exceeded maximum output retries (3)`. ($0.012, 4 requests, 72 s)
- Right: The staff cost figures were correct for group and parent.
- Right: Call 2 added trade creditors, group creditors and corporation tax correctly.
- Mistake: Calls 2 and 3 got stuck repeating `other_tax_and_social_security, within_one_year, 487414` five times. Call 3 resent the group block unchanged after the duplicate-line error.
- Mistake: Never added the accruals (437064) or other creditors (781030) lines, and never gave any `prior_amount`.
- Mistake: Put the parent's prior-year bank loan after one year (5836) in the current `amount`; the expected current value is 0.

### tier5-12026946

**Tool calling: failed.** Two calls failed with `sum of the creditor lines due within_one_year gives 0`. Instead of reading the creditors note, the third call sent `creditors: []`, which was accepted. Staff cost lines other than the totals, the interest lines and the asset lines were all missing. ($0.0092, 3 requests, 87 s)
- Right: Company details, all four directors, and group and parent subtotals and equity were correct.
- Right: Group turnover, cost of sales, admin expenses, operating profit, PBT, tax and PAT were correct for both years.
- Mistake: Got past the creditors check by emptying the list instead of extracting the note: in call 3 it sent `creditors: []` for both entities. This lost about 15 group and 9 parent creditor lines.
- Mistake: Reduced `staff_costs` to `total` only, leaving out wages, social security and pension for both years.
- Mistake: Left out interest receivable (374360) and payable (292474), as well as stocks, debtors, cash, intangible assets, tangible assets and investments.

### tier5-NI037684

**Tool calling: failed.** Made one call, which was accepted. It gave `accounts_type: full` (expected `medium`), and in place of the creditors note it invented one `amounts_owed_to_group` line equal to total creditors. Asset lines were missing and parent staff costs were null. ($0.0024, 1 requests, 32 s)
- Right: Group and parent subtotals, the group P&L and group staff costs were correct for both years.
- Right: Both directors were found.
- Mistake: Gave `accounts_type` as `full`; the expected value is `medium`.
- Mistake: Invented a creditor line `amounts_owed_to_group` with amounts 1423359 and 3486122, the total creditors figures. The real breakdown is trade creditors 911239, corporation tax 84860, accruals 160963 and others.
- Mistake: Left out tangible assets, stocks, debtors and cash for both entities, and the parent's investments of 300.
