Skip to main content

Practical Guide to Language Models in Statistical Production

A cookbook for methodologists and production managers in national statistical organizations. Version 0.1 (working draft), October 2026.

Working draft

This guide is a working draft from the AI for Data – Data for AI program. It collects practical approaches and open standards. It does not represent official World Bank Group guidance or policy and is not legal advice; an organization applies it under its own statistical law, data protection rules, and institutional policies. Comments and corrections are welcome as GitHub issues, and the contributing page explains how to propose a recipe.

The other cookbooks of this series concern dissemination: how data and metadata are found, understood, served, and used. This guide concerns production: the phases in which statistics are designed, collected, processed, and analysed before anything is published. Language models assist several of those phases well. They read a draft questionnaire and flag the questions that ask two things at once; they code "sells vegetables at the market" to an occupation group; they explain in plain language why a record failed an edit rule; they draft the commentary of a release from its tables. Each of these is text work that production staff do by reading, and a model does the reading at scale. What makes the result official is the same as for any method: defined points of human decision, measured performance, pinned versions, and a statement in the quality report.

This guide is organized around seven questions. The first asks where in the production process a model can assist and where it should not. The next four follow the phases of production: whether a model can assist questionnaire and concept work, whether open text can be coded with a model, whether it can support editing and the explanation of anomalies, and whether it can draft commentary whose numbers are verified. The last two are operational: how models are run inside the production environment, and how model use is documented and quality-assured. Each chapter answers one question with recipes, maturity levels, worked examples, and a checklist.

The recipes follow the Generic Statistical Business Process Model (GSBPM) phases and build on the program's workstreams that serve them: Anomaly Detection and Explanation for processing and analysis, the statistical classification and coding workstream, the Global Question Bank for design, and Efficient and Inclusive AI for running models locally. The standards page lists each and where it applies.

Model roles and human decisions

Every recipe in this guide keeps a person at the point of decision: the methodologist on the questionnaire, the coder on the routed share, the editor on the proposal, the analyst on the explanation and the commentary. The model's role is named in each case, and a role of "decide" is not among them.

Prerequisites​

The recipes assume the following are in place or can be arranged:

  • A production process with defined steps (the organization's own or GSBPM), and the methodologists and production managers who run it.
  • Access to a language model that can run inside the production network for confidential text (an open-weight model on a local server), and a hosted model for public inputs under the AI-use policy.
  • A developer who can run Python scripts and batch jobs; for the AI-ready level, coders and editors willing to label a sample and rate outputs.

First steps​

For a team with limited time, this sequence gives the most useful result first:

  1. Write the map of model-assisted tasks and the list of tasks that stay with people, following chapter 1. This takes a day.
  2. Start with coding, following chapter 3. A model proposes codes for one survey's open text, coders accept or change them, and accuracy is measured against the final codes. This takes a week.
  3. Publish a statement of model use with that survey's release, following chapter 7. This takes an hour.

Edit explanations and anomaly explanations (chapter 4), commentary (chapter 5), and questionnaire review (chapter 2) follow the same pattern; chapter 6 covers the server and the batch jobs they need.

Self-assessment​

The self-assessment takes about five minutes and places an organization's use of models in production at a level in each chapter.

Chapters and questions​

ChapterQuestionPractical topics
1. Model assistance across the production processWhere in the production process can a model assist, and where should it not?GSBPM map, five roles, review and data rules, tasks that stay with people
2. Questionnaire and concept workCan a model assist the design of questionnaires and the harmonization of concepts?Wording checklist, question bank matching, variable descriptions, translations
3. Coding of open textCan open-text responses be coded to classifications with a model?Classification as context, accuracy by level, confidence threshold, re-coded sample
4. Editing, imputation, and anomaly explanationCan a model support editing and the explanation of anomalies?Plain-language explanations, proposals checked by rules, anomaly explanations with evidence
5. Commentary and summaries with verified numbersCan a model draft commentary whose numbers are verified?Drafting from tables, number and claim check, analyst approval, other languages
6. Models inside the production environmentHow are models run inside the production environment?Local open-weight models, batch jobs, cost and time, pinned versions, switch-off test
7. Quality assurance and documentation of model useHow is model use documented and quality-assured?Decision points, suites per task, effect on the statistics, statement of model use, audit

Maturity levels​

Each chapter describes three levels. An organization can sit at different levels in different chapters, and the first level is a complete, useful state on its own.

LevelMeaning
FoundationalModels assist a task with every output reviewed by a person, the task mapped, and the versions recorded.
AI-readyEach task has a labelled sample, measured performance, a production rule set from it, a local model where the data require it, and a statement of model use in the quality report.
AI-nativeModel assistance runs as pipeline stages gated by evaluation suites, corrections feed back into the models and indexes, and the effect on the statistics is measured and published each release.

Running example​

The labour force survey of the example organization, in its 2025 second quarter round: a draft questionnaire with a double-barrelled question, twenty open-text occupation responses coded by a model and a coder, six model-proposed values for records that failed edit rules, a draft commentary with seven figures, a batch coding job of 250,000 responses, and the statement of model use for the release. All records, responses, and figures are invented.

Scope of the examples​

The examples are small on purpose: twenty responses, six suggestions, one draft, so that a reader can run them in an afternoon and see the shape of each check. They are starting points. Each recipe ends with a What this does not do note that says where the example stops and what the full version adds. The model calls themselves use the organization's chosen model; the scripts here map, measure, check, and document what comes back.

Files​

FileUsed in
gsbpm_map.csv and map_components.pyChapter 1: the component map and its check
occupation_coding.csv and coding_eval.pyChapter 3: coded responses and the accuracy and threshold evaluation
edit_rules.csv, suggested_values.csv, and check_suggestions.pyChapter 4: edit rules, model proposals, and the rule check
release_table.csv, commentary_draft.md, and commentary_check.pyChapter 5: the release table, a draft, and the number and claim check
batch_cost.pyChapter 6: cost and time estimate for a batch job
model_use_statement.md and check_statement.pyChapter 7: the statement of model use and its check
ResourcePurpose
This guideWhere models assist production and under which controls, in a sequence of practical steps.
Mapping to the GSBPMThe program's workstreams placed in the production phases.
Anomaly Detection and ExplanationDetection and structured explanation of unusual values.
Practical Guide to Metadata Curation with Language ModelsDrafting, review, and translation workflows reused in the design and commentary chapters.
Practical Guide to Evaluation Suites for Statistical AIThe suites and report cards the assurance chapter requires.
CodeOpen-source software to deploy or adapt.

Citation​

World Bank. 2026. Practical Guide to Language Models in Statistical Production: A cookbook for methodologists and production managers in national statistical organizations. Version 0.1. AI for Data – Data for AI. https://worldbank.github.io/ai4data/cookbook/language-models-in-production/

Version history​

  • 0.1 (October 2026). First draft: seven chapters, recipes, scripts, self-assessment.