evidoria

← Back to browse

Good practice Imported

Brazil's National Treasury Cuts Expenditure Classification From 1,000 Hours to 8 With a Machine-Learning Model

Brazil · Brasília · See the Brazil profile · See the Brasília profile

Evidence: Observational / pre–post Top 24% 73/100 · Ask Evidence Copilot about this practice

Brazil's National Treasury replaced a 1,000-hour manual process with a machine-learning classifier that codes subnational spending to the UN's COFOG standard in 8 hours at over 97% accuracy, feeding the government's annual expenditure-by-function report.

~1,000 hours
Classification time for subnational data, before the model (before 2021)
~8 hours
Classification time for subnational data, with the model (since 2021)
>97 %
Classification accuracy (since 2021)
~100,000 records/year
Budget records processed per year (since 2021)
5,500+ municipalities
Municipalities covered (since 2021)

Details

Maturity
Established
Promoter
Secretaria do Tesouro Nacional (STN), Brazilian Ministry of Finance
Period
2021-2024
Keywords
public financial management, fiscal transparency, machine learning, text classification

Context

Brazil's National Treasury (Secretaria do Tesouro Nacional, STN) is responsible for publishing 'Despesa por Função do Governo Geral', Brazil's official report classifying public spending by all levels of government according to COFOG, the UN's international standard for comparable fiscal statistics.

Objectives

Classifying subnational government spending line items to COFOG categories was historically a slow, manual, error-prone task; the model aims to automate this classification without losing accuracy.

Activities

Since 2021, STN has used a probabilistic text-classification model, built with convolutional and recurrent neural networks, to automatically assign COFOG functional categories to expenditure records reported by Brazil's states and over 5,500 municipalities, processing roughly 100,000 budget records a year.

Results

The model cut classification time for subnational data from around 1,000 hours to about 8 hours while exceeding 97% accuracy, letting STN publish the annual expenditure-by-function report faster and more consistently.

Conclusions

Brazil has since begun extending the same approach, with support from the Inter-American Development Bank, to classify climate-related public expenditure; the cited accuracy figure has not been externally validated against a manually classified gold-standard sample at scale.

Implementation

Indicative cost
Low (< €50k)
Time to results
Medium (1–3 years) — In production since 2021 and now being extended with IDB support to classify climate-related public expenditure.
Staffing & skills
Secretaria do Tesouro Nacional (STN) data and analytics team, Inter-American Development Bank support for the climate-expenditure extension

Conditions for success

  • A defined, internationally recognised target taxonomy (the UN's COFOG standard) to classify against
  • Sustained institutional ownership within STN's recurring annual reporting cycle

Common failure modes

  • The accuracy figure has not been externally validated against a manually classified gold-standard sample at scale.

Where it fits

Governance type
national treasury / ministry of finance
Scale
national (states and 5,500+ municipalities)
Income level
upper-middle-income

Commonly funded by

National / regional programmes

Indicative funding routes for practices of this type — always check each programme's current calls and eligibility rules.

Do you run this practice? Claim it — verified implementers get a public contact pathway and can propose corrections.

Data sources

Where this practice's information was retrieved from, and when.

Similar practices you may find useful