---
title: "Qwen3.8 27B on Pydantic AI - Structured output"
description: "Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 80%; rank 30 of 44."
canonical: https://pydantic.dev/models/list/qwen3.8-27b/structured_output/
---

# Qwen3.8 27B on Pydantic AI - Structured output

> Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 80%; rank 30 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/qwen3.8-27b/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/qwen3.8-27b/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | ------- |
| Tool calling | 80%   | 8 of 10      | $0.33 | 10       | 10         | 5.9 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

Qwen3.8-27B passed 8 of 10 cases, all in tool-calling mode, at $0.02–$0.06 per case. Every case used exactly one request: read the accounts, reason, call `accounts` once. Both failures are tier-1 cases, and both come from the same single field, `company.accounts_type`. No expected money figure was wrong in any of the 10 cases.

#### Where it does well

- **Number extraction.** Several hundred expected figures across the 10 cases were all correct, including £000 scaling in three cases (`tier1-07054261`, `tier1-11022760`, `tier2-SC121467`).
- **Signs.** Bracketed costs and creditors came back positive, deficits negative. It resolved ambiguous tax lines from the tax note and arithmetic: `-138000` in `tier1-07054261`, `-571000` in `tier2-SC121467`.
- **Group versus parent.** In the six tier 3–5 cases it never mixed the two columns, even where they differ by a few hundred pounds (`tier5-NI037684`).
- **Dash cells.** It consistently returned `-` as `0`, which matched the expected values.
- **Accounts type when stated.** Where the accounts state the regime explicitly ("large companies regime", "medium-sized companies"), it got the type right.

#### Mistakes it makes

- **Guessing `accounts_type` (2 of 10, both failures).** Where the accounts gave no explicit regime statement, it read FRS 102 reduced-disclosure exemptions for a qualifying subsidiary as the small companies regime and answered `small` instead of `full`. In `tier1-07054261` its own reasoning ran the size thresholds, found the company was not small, and still sent `small`.
- **Bending a field to fit a guessed check.** In `tier1-11022760` it put a share-based-payment "Equity reserve" into `share_premium` (167000 / 444000), reasoning that the equity components had to sum to `shareholders_funds`. The other cases with a similar unmapped reserve (`tier3-05959188`, `tier3-09727592`) left it out.
- **Computing a figure.** In `tier1-07054261` it summed two debtor lines into `debtors`, against the handbook rule.
- **Very long deliberation.** Reasoning ran up to 55k characters on one tier-1 case, much of it circling the same `0`-versus-`null` or small-versus-full question. That is why the two priciest cases include a tier-1 one ($0.061).
- **No use of feedback.** It never needed a retry, so its handling of a failed check is untested here.

#### Tool calling compared with code mode

Only tool-calling mode was run for this benchmark, so there is no comparison.

## Runs

### tier1-07054261

**Tool calling: failed.** One request: about 55k characters of reasoning, then a single `accounts` call. Every expected money figure matches, but `company.accounts_type` was returned as `small` where `full` was expected, so the case failed. ($0.061, 1 requests, 1.9 min)
- Right: All balance sheet and profit and loss figures correct, with £000 scaled by 1,000 and deficits negative (`net_assets` -6187000, `profit_and_loss_reserve` -8457000).
- Right: Read the prior-year tax line shown as `138` without brackets as a credit by checking note 11 and the arithmetic (-10,577 + 138 = -10,439), giving `tax: -138000`.
- Right: Treated `-` cells as 0 (`tax` 2025, prior `interest_receivable`), matching the expected values.
- Mistake: In its reasoning it took the FRS 102 reduced-disclosure exemptions (no cash flow statement, a single `Investment in subsidiaries` line) as evidence of the Section 1A small regime and set `accounts_type: "small"`. Those exemptions are also open to a qualifying subsidiary filing full accounts.
- Mistake: Later in the same reasoning it ran the size test itself (turnover £16.4m, total assets about £14.3m, meeting only 1 of 3 small thresholds) and concluded the company was not small, yet the final call still sent `small`.
- Mistake: Returned `debtors` as 9792000 and 10162000 by adding the within-one-year and after-one-year lines (134 + 9,658), although the handbook says not to compute figures the accounts do not show. These fields are not in the expected list.

### tier1-11022760

**Tool calling: failed.** One request with a single `accounts` call. All expected money figures match, but `company.accounts_type` was `small` instead of `full`, and the case failed. ($0.029, 1 requests, 29 s)
- Right: All expected balance sheet and profit and loss values correct, including `called_up_share_capital: 0` for the `-` line and prior `other_operating_income: 0`.
- Right: Bracketed tax charges (312) and (632) correctly returned as positive `312000` and `632000`; net liabilities returned negative.
- Right: Verified each subtotal arithmetically before answering (e.g. 13,536 - 50,167 = -36,631).
- Mistake: Reasoned that being a "qualifying entity" under FRS 102 and using the section 401 consolidation exemption are features of the small companies regime, and set `accounts_type: "small"`. Qualifying-entity reduced disclosure is not Section 1A; with turnover of £32.4m it should have returned `full`.
- Mistake: Put the `Equity reserve` (167 and 444, which its own reasoning identified as a share-based payment reserve) into `share_premium` as 167000 and 444000. It justified this by guessing that a check needs capital + premium + reserves to equal `shareholders_funds`; the accounts show no share premium and the field should be `null`. The expected list has no `share_premium` for this case.
- Mistake: Name returned as `TaskUs Limited` against the filed `TASKUS LIMITED` (case difference only).

### tier2-11600506

**Tool calling: passed.** One request, short reasoning (about 8.5k characters), one `accounts` call with the group balance sheet and profit and loss for both periods. Passed. ($0.021, 1 requests, 15 s)
- Right: All 40 expected group figures match, including negative `net_current_assets` -6090208 and `total_assets_less_current_liabilities` -857995.
- Right: Bracketed cost of sales and creditors returned as positive amounts, as the handbook requires.
- Right: Mapped the deferred tax liability under provisions for liabilities to `provisions` (346932 / 284368).

### tier2-SC121467

**Tool calling: passed.** One request and one `accounts` call for a group reporting in £000. Passed. ($0.025, 1 requests, 19 s)
- Right: Scaled every figure by 1,000.
- Right: Resolved tax signs from note 11: face shows (299) and 571, returned `tax: 299000` and prior `tax: -571000`, checked against profit after tax 140 and (1,107).
- Right: Left the separately shown `Provision for bad debts` (619) out of `administrative_expenses` and `other_operating_income` rather than folding it in.
- Mistake: Returned `creditors_after_one_year: 0` for the current year (prior 4300000); not in the expected list, so its correctness is not confirmed by the result.

### tier3-05959188

**Tool calling: passed.** One request, terse reasoning (about 9.5k characters), one `accounts` call with group and parent balance sheets for both periods. Passed. ($0.021, 1 requests, 15 s)
- Right: All group and parent figures match, including the restated prior-year column.
- Right: Kept group and parent columns apart (e.g. `creditors_within_one_year` 2483825 group vs 3852856 parent).
- Right: Did not force the unmapped equity reserve into `share_premium`; `share_premium` stayed at the stated 318501.

### tier3-09727592

**Tool calling: passed.** One request and one `accounts` call with group and parent balance sheets for a 31 January 2026 year end. Passed. ($0.025, 1 requests, 20 s)
- Right: All expected figures match for both entities and both periods.
- Right: Returned parent prior `investments: 0` for the `-` cell, as expected.
- Right: Did not map `Other reserves` (771,891) into any field; deficits on `profit_and_loss_reserve` returned negative (-32613535).

### tier4-05840865

**Tool calling: passed.** One request (about 30k characters of reasoning) and one `accounts` call with staff costs and the creditors notes for group and parent. Passed. ($0.042, 1 requests, 42 s)
- Right: Staff cost lines and totals correct for group and parent, both years.
- Right: Creditor rows correctly categorised and split by `due`, with `-` cells returned as 0 (group `bank_loans_and_overdrafts` 0 / 10251).
- Right: Parent `finance_leases` after one year (28174 / 39831) taken from the separate after-one-year note.
- Mistake: Also returned group after-one-year rows (`finance_leases` 130386, `other` 133857) and `creditors_after_one_year: 264243`, which are not in the expected list; they did not stop the pass.

### tier4-NI626135

**Tool calling: passed.** One request with compact reasoning (about 12k characters) and one `accounts` call for staff costs and creditors, group and parent. Passed. ($0.025, 1 requests, 20 s)
- Right: All staff cost and creditor figures match, including `amounts_owed_to_group` 3668476 (group) and 10067741 (parent).
- Right: After-one-year bank loan shown as `-` in the current year returned as `amount: 0`, `prior_amount: 5836`.
- Right: Totals `creditors_within_one_year` and `creditors_after_one_year` taken from the notes for both entities.

### tier5-12026946

**Tool calling: passed.** One request (about 32k characters of reasoning) and one `accounts` call covering company details, directors, group and parent statements, staff costs and creditors. Passed. ($0.045, 1 requests, 40 s)
- Right: `accounts_type: "full"` taken from the explicit statement that the accounts follow the large companies regime, rather than inferred.
- Right: All four directors returned and all group and parent figures match, including group `profit_and_loss_reserve` -43056856 and a positive tax charge of 72816 on a loss.
- Right: Kept the associates' loss (420,005) out of `other_operating_income` and `interest_receivable`.
- Mistake: Added group `amounts_owed_to_group` rows with `amount: 0` and `prior_amount: 0` that the expected list does not contain; harmless here.

### tier5-NI037684

**Tool calling: passed.** One request (about 35k characters of reasoning) and one `accounts` call for the full tier-5 structure. Passed. ($0.040, 1 requests, 40 s)
- Right: `accounts_type: "medium"` taken from the statement that the provisions applicable to medium-sized companies are complied with.
- Right: Left `investment_property` as `null` because the balance sheet shows only `Tangible assets` 4122359; the 523,300 appears only in note 15.
- Right: Group and parent creditors kept distinct where they differ slightly (`other_tax_and_social_security` 152260 vs 151765), and `amounts_owed_to_directors` used as its own category.
