Enterprise knowledge · Research feature

Automatic Occupational Coding through Retrieval-Augmented Generation

The study evaluates OPERAG, a retrieval-augmented generation system, on 36,062 real-world job descriptions from the AsiaLymph cohort.

Adapted from research by Mathijs A. Langezaal, Egon L. van den Broek, Lukas P.A. Arts and colleagues.

arXiv preprint revision · 2026-11-25 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

The study evaluates OPERAG, a retrieval-augmented generation system, on 36,062 real-world job descriptions from the AsiaLymph cohort. When applied to two Job Exposure Matrices, ALOHA+ and SHOCK, OPERAG achieved 89.9–98.6% accuracy in exposure assessment. The system uses retrieval of coding indices combined with large language models to classify jobs into any occupational classification, without requiring expert-labeled training data. Performance is measured using accuracy and PABAK metrics, allowing direct comparison with human coders and other tools.

Introduction

Work is a central part of adult life, with a large impact on overall health. Workers are exposed to various negative conditions, such as repetitive motions, noise pollution, and physical or chemical agents like welding fumes and silica dust. These occupational exposures are globally responsible for 1.5 million deaths annually and contribute 76.1 million disability-adjusted life years. Epidemiological studies that assess exposure-response associations are crucial for fueling interventions to promote worker health, but they rely on high-quality exposure assessments to ensure correct and unbiased results.

In large population-based cohorts, occupational data is typically collected through open-ended survey questions, yielding free-text job descriptions. Subsequently, a Job Exposure Matrix (JEM) can be used to assign a wide range of exposures to occupations. A JEM comprises estimated probabilities and intensities of exposure to harmful agents using standardized occupational titles and industries. Consequently, free-text job descriptions must first be standardized into such occupational groups using occupational classification systems. This process, known as occupational coding, is often performed manually by expert coders, which is time-consuming, expensive, and requires expert knowledge. Even with extensive documentation and training, consistent coding is challenging due to the large number of outcome categories in combination with the lack of a gold standard for each job description. Consequently, many large-scale studies must deploy multiple expert coders, which introduces an inter-coder reliability ranging from 44% to 89%.

To address manual occupational coding challenges, several automated coding tools have been developed with prediction accuracies ranging 46%–79% at the most detailed coding level. These classification models have been implemented in Decision Support Systems (DSS) and semi-automatic coding tools that provide confidence scores (i.e., estimated correctness probability) alongside predictions. This enables automatic coding of suggestions exceeding a customizable threshold, such as automatically coding all predictions with confidence scores above 95%. At this 95% threshold, estimated workload reductions range 19.7%–55.7%. When predictions with confidence scores are presented to experts solely as suggestions without automatic coding (i.e., as a DSS), experts experience a 37.5% workload reduction while maintaining outcome validity.

Large Language Models

Deep Learning (DL) architectures, such as feedforward and long short-term memory networks, have demonstrated state-of-the-art performance across diverse classification tasks, including text-classification. By employing multiple layers of interconnected neurons, these models automatically derive representations of data with multiple levels of abstraction, thereby minimizing the dependence on manually engineered features typically required for traditional ML approaches. However, their high parameterization requires extensive datasets to achieve competitive performance. Consequently, in domains with limited example-outcome pairs or homogeneous datasets that fail to capture the heterogeneity of the target domain, DL approaches are prone to overfitting or underfitting. Consequently, this restricts their generalizability and limits their successful application in such data-scarce environments.

LLMs reduce DL’s dependence on large labeled datasets through transformer-based architectures and large-scale unsupervised pretraining on diverse text corpora, resulting in base models with extensive linguistic representations and contextual understanding. After pretraining, these base models typically undergo additional supervised fine-tuning to improve conversational fluency, instruction adherence, or to adapt their internal knowledge and linguistic properties to specific domains. These include instruction-tuned LLMs, which are trained on datasets containing human-aligned instruction–response pairs, demonstrating strong dialogue and task-following abilities. However, LLMs’ performance is limited in domains that are insufficiently represented in their pretraining data. To address this limitation, domain-specific fine-tuning adjusts an LLM’s parameters to capture domain terminology and knowledge. However, the performance of such models is limited for complex tasks. Here, performance improves when “Chain-of-Thought” prompting is applied, which is a technique that explicitly prompts the model to produce a series of intermediate reasoning steps before generating the final output. To further improve performance in complex tasks, LLMs have been post-trained on curated datasets containing step-by-step reasoning-answer pairs. Through this training, models generate structured intermediate reasoning steps during inference, achieving state-of-the-art performance across a wide range of tasks, including text classification.

Interaction with an LLM typically occurs through a user-submitted prompt that specifies the query, after which the model generates a corresponding response. Such interactions can be preceded by a predefined system prompt to establish the model’s overall behavior or tone. Both prompt types can be engineered using various prompting structures and strategies (i.e., prompt engineering) to optimize performance for specific tasks. For text classification applications, the system prompt commonly instructs the LLM to assume the role of an expert within the relevant classification domain. Subsequently, the user prompt is structured following a consistent format, comprising: 1) a task description, 2) the input data requiring classification, and 3) an output schema to enable consistent parsing. To guide the model’s reasoning through domain-relevant classification steps, task-specific classification rules can be specified in the user-prompt. Additionally, prompting strategies such as chain-of-thought (CoT) prompting are often employed to further encourage step-by-step reasoning before final label prediction. Through the combination of these approaches, the LLM may mimic an expert’s decision-making process, which has been shown to yield state-of-the-art classification performance for task-specific applications.

Dataset

AsiaLymph is a hospital-based case–control study of lymphoma among Chinese populations in Eastern Asia. It includes free-text job episodes in traditional and simplified Chinese containing job titles, tasks, employers, and employers’ main products. This information was manually coded into the 5th revision of the Standard Occupational Classification System of the Republic of China (SOCS-ROC). Subsequently, the information was expert-translated to English, with the codes crosswalked to ISCO-88. Two study centers independently coded the occupational data in the original language, with discordances and crosswalk discrepancies (i.e., in the case of a one-to-many mapping) being resolved by a third expert coder. In our evaluation, we use the job episodes’ English translation with corresponding ISCO-88 codes.

Exposure assessment evaluation

The ALOHA+-JEM has originally been developed for a study assessing the association of occupational exposure and symptoms of chronic bronchitis and pulmonary ventilatory defects in a general population-based study of five areas in Spain. Subjects completed a respiratory questionnaire on symptoms and occupation and underwent baseline spirometry. Based on expert knowledge, the JEM was developed ad hoc by two occupational experts. It contains a job axis and an exposure estimate for 12 generic industrial exposures, namely: biological dust, mineral dust, gas fumes, VGDF (i.e., vapors, gases, dust, and fumes), all pesticides, herbicides, insecticides, fungicides, aromatic solvents, chlorinated solvents, other types of solvents, and metals. Exposure estimates for each aforementioned exposure can be obtained for all ISCO-88 codes. Here, three levels of exposure can be assigned, namely 0: no exposure, 1: low exposure, and 2: high exposure. For each gold standard manually coded and OPERAG-predicted ISCO-88 code, we applied the ALOHA+-JEM to obtain a level of exposure for each aforementioned exposure, and subsequently calculated percent-agreement and PABAK for each exposure separately. In line with, codes without an exposure estimate in the JEM (i.e., codes only assignable at an aggregated level, such as 6000) were assigned exposure level 0.

The SHOCK-JEM was developed to estimate the occupational risk of electric shocks using routinely collected national accident statistics from five European countries (Germany, UK, Austria, Switzerland, and the Netherlands). Electrical injury cases were drawn from national registries, and denominators (i.e., workers per occupation) were obtained from EUROSTAT, enabling calculation of annual electrical injury rates per 10,000 workers by occupation and country, which were then pooled with a random-effects model to account for heterogeneity across countries. The resulting SHOCK-JEM provides an exposure estimate for each 3rd level ISCO-88, with 0 being low, 1 being medium, and 2 being high chance of experiencing electric shocks. We applied the SHOCK-JEM to the gold standard 3-digit manually, and OPERAG predicted ISCO-88 codes to obtain the exposure assessment for all job episodes. Here, we computed overall accuracy and PABAK. Similar to the ALOHA+-JEM, we dichotomized the exposure estimate into low (0) versus medium or high (1–2) chance.

To account for the chance level of a non-exposure assignment being substantially higher, given the many occupational codes in the JEMs resulting in no exposure, we evaluated two groups: 1) all individuals and 2) exposed individuals. For the first group, we calculated the aforementioned metrics using all individuals in the AsiaLymph dataset. For the second group, we only included job episodes in the evaluation that were deemed exposed according to the gold-standard expert codes. For each exposure, we considered an episode exposed if its gold-standard exposure level for that exposure exceeded 0. Furthermore, assigning an exposed individual a not-exposed status often has the largest effect on the following epidemiological study. Hence, evaluating this group will give more insight into the applicability of these classification models in real-world scenarios and allow for a direct comparison with OPERAS’ ML-based classification models. Here, we compute accuracy and PABAK for both groups.

Performance evaluation

OPERAG’s classification performance varied substantially across major occupational groups, with “Legislators, Senior Officials, and Managers” achieving the lowest accuracy at 13.6%. This performance is largely attributable to the majority of AsiaLymph’s episodes in this group being coded as “Directors and Chief Executives” (i.e., 1210). In practice, these episodes were often classified into unit groups belonging to the sub-major group “General Managers” (i.e., 1300). Here, the key difference between this sub-major group and “Corporate Managers” (i.e., 1200) lies in the size of the managed company, which is rarely specified in AsiaLymph’s job episodes. Consequently, accurate classification into either group was often impossible without relying on the aforementioned context-dependent assumptions or rules. For example, AsiaLymph’s expert coders may have been trained to code episodes with titles such as “manager” or “boss” into “Directors and Chief Executives” (i.e., 1210) unless other information clearly indicated an alternative code. More likely, however, expert coders used external sources (e.g., company websites) when an employer name was provided, enabling them to infer company size and assign the appropriate code. Without such contextual information, the LLM frequently defaulted to codes corresponding to the generally more common smaller companies, thereby classifying them into unit groups under sub-major group 13. Moreover, as many of these job episodes contained industry-specific descriptors (e.g., “factory chief”), the OPERAG’s retriever often retrieved industry-specific minor groups from sub-major group 13 (e.g., 1312 – General Managers in Manufacturing) due to their semantic similarity, which have no equivalent in sub-major group 12. Consequently, these or similar entries were most prominent in such episode’s top-30 retrieval results and top-5 reranked candidates, making it highly unlikely for “1210” to be selected due to LLM’s position bias. A similar effect was observed in the major group “Skilled agricultural and fishery workers” (i.e., “6000”), where the most prevalent category, “Market gardeners and crop growers” (i.e., 6110, accounting for 7.1% of AsiaLymph episodes), achieved only 3.9% accuracy. Here, many episodes were instead coded into the more detailed occupational group 6111, reflecting the model’s tendency to assign to more detailed categories even in cases where information does not allow for coding to this level of detail.

Apart from the small Armed Forces group (2.1% of episodes), the major group “Professionals” obtained the highest classification accuracy. The comparatively strong performance for this group may be explained due to their unit groups being more distinctive, with related occupations often having clearer lexical cues, reducing ambiguity during retrieval and classification. Misclassifications that did occur in this major group typically arose when the model deemed the occupational episode to lack sufficient detail to support assignment to less aggregated coding levels. These findings highlight the need to incorporate additional expert-derived contextual rules into AOC frameworks to improve classification performance.

At each coding level, OPERAG’s macro F1 scores were comparable to, or marginally lower than, their respective accuracy. In contrast to supervised learning models, this shows that OPERAG does not exhibit disproportionate prediction of certain classes based on their prevalence in a study population. However, the overall macro F1 score (0.39) was still lower than the overall accuracy (42.6%) on the 4th coding level. This can be attributed to 55 rare ISCO-88 codes achieving F1 scores of zero. As the macro F1 calculates the harmonic mean across all classes and treats each occupational code with equal weight regardless of its frequency, these zero-scoring codes substantially reduced the F1-score. Contrastingly, within individual major groups, the macro F1 scores often equaled or even exceeded the corresponding accuracy. This occurred in groups where the most prevalent unit group (i.e., the 4th coding level) within a major group (i.e., the first coding level) exhibited poor classification performance. For example, in major group “Skilled agricultural and fishery workers” (6), code 6110 accounted for 55.0% of all episodes but achieved only 3.9% accuracy. As accuracy is sample-weighted, this majority class heavily influenced the overall major group accuracy, whereas the macro F1 score, being unweighted by sample size, more accurately reflected the typical performance across all occupational codes within the group. These findings demonstrate OPERAG’s independence from population-specific occupational distributions, in contrast to conventional supervised machine learning approaches, thereby reinforcing its potential as a universally applicable AOC framework.

Limitations

While the usage of LLMs enabled the generalizable interpretation of job descriptions and AOC without the need for expert-labeled databases, their highly parameterized architecture precludes full mechanistic explainability due to their reliance on highly nonlinear and distributed computations across millions to billions of parameters. Consequently, it is practically infeasible to attribute a specific output to a clearly defined, human-interpretable rule or input feature based on the LLMs’ internal mechanisms alone. Contrastingly, glass-box AI models (e.g., symbolic AI) inherently enable mechanistic explainability, as they allow for direct traceability between inputs and outputs through explicit, rule-based logic or structured knowledge representations that can be inspected and verified by human experts. Although the currently employed LLMs provide textual reasoning traces, these are generated post-hoc by the model itself and may not reflect the actual internal decision-making process, leading to potential fabricated or hallucinated justifications for the model’s predictions. As such traces could contain plausible-sounding but incorrect reasoning steps, the expert-coder could be misled into choosing an incorrect occupational coding. Especially for less experienced expert-coders, this could lead to misclassifications of occupations and incorrect or biased subsequent exposure assessment. Subsequently, this could lead to severe negative health outcomes or less impactful interventions that promote workers’ health. Consequently, it is crucial to take this into account if reasoning traces are shown to experts to ensure accurate occupational coding.

OPERAG’s retriever performance is largely determined by the segmentation and embedding of the coding index entries. Although we currently employ structure-aware chunking, which typically yields strong retrieval performance, alternative chunking strategies could further enhance retrieval efficiency in practice. For example, we currently include excluded occupations within the chunks, which may introduce semantically confounding information, as these entries frequently contain terminology that has a semantic overlap with closely related occupational groups. Because embedding models are unlikely to distinguish between “included” and “excluded” information, retrieval performance may degrade due to such overlaps. Similarly, while our current embedder was selected due to its state-of-the-art performance across general retrieval benchmarks, these benchmarks do not necessarily reflect the challenges of short-text occupational classification. In settings where input texts are particularly short and ambiguous, embedders trained on corpora that more closely match the linguistic characteristics of occupational data could outperform the currently used general-purpose embedder. Consequently, systematically evaluating alternative chunking strategies and embedders across occupational datasets may improve OPERAG’s retrieval performance.

As cross-encoders are typically optimized for broader retrieval tasks and may not adequately disambiguate between closely related occupational codes, we adopted a reasoning-LLM as reranker. The reasoning-based reranker produced improvements, increasing top-5 retrieval accuracy and thereby improving classification performance. However, the improvement was limited (4.3 percentage points), partly because in 12.2% of cases the gold standard code was absent from the initial top-30 retrieval results. This absence may reflect limitations in semantic similarity search when occupational information lacked semantic overlap with index entries. For example, the ISCO-88 group, “Administrative Associate Professionals not classified elsewhere”, comprising 4.9% of AsiaLymph’s job episodes, was often not retrieved by the RAG-components. This is likely due to the corresponding occupational information often being described more generally rather than being semantically similar (e.g., “Director”). This resulted in the occupational information likely being embedded further away from the coding index entry in the embedding space, disabling effective retrieval. Consequently, alternative embedding strategies, or text augmentation strategies using (e.g., applying thesauruses to find synonyms), could be employed to improve retrieval performance.