Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

How Do Researchers Test the Stability of AI-Assisted Coding or Classification?

AI-assisted coding stability should be tested rather than assumed from a few consistent outputs. Learn how to design repeated-run evaluations, measure classification agreement, examine errors, and determine whether AI-generated codes are sufficiently dependable for research.

613
Testing AI Coding and Classification Stability Guide 613 of 1196
01 · The Question

How Can You Tell Whether AI Assigns Research Codes Consistently?

You use generative AI to classify interview excerpts, analyze open-ended survey responses, or categorize research abstracts. The model assigns labels that appear reasonable, and the resulting dataset is ready for analysis.

But what happens if you repeat the classification task?

Perhaps most observations receive the same labels, while others move between categories. Some responses classified as negative become mixed. A few research abstracts previously classified as qualitative are now labeled mixed methods.

These differences raise questions that cannot be answered by inspecting a handful of plausible outputs. How often does the model disagree with itself? Are disagreements concentrated in particular categories? Does the model agree with independently established coding decisions? Most importantly, could the instability change the study's conclusions?

Researchers need a systematic evaluation that distinguishes stable classification behavior from scientifically valid measurement.

02 · The Short Answer

Test Repeated Agreement, Independent Accuracy, and the Consequences of Disagreement

In Brief

Researchers can test the stability of AI-assisted coding or classification by applying the same documented procedure repeatedly to a representative dataset, comparing the resulting labels, examining category-specific disagreements, and evaluating whether those differences affect the research findings.

Exact agreement, Cohen's kappa, Krippendorff's alpha, confusion matrices, and other measures may be useful depending on the coding design. However, stability is not the same as accuracy or construct validity. Researchers should also compare AI-generated labels against an appropriate independent reference standard and establish acceptance criteria that reflect the study's purpose.

03 · What You Need to Know

How to Evaluate the Reliability of AI-Generated Research Codes

What Does Stability Mean in AI-Assisted Coding?

Stability concerns the extent to which a coding procedure produces consistent results when repeated under sufficiently similar conditions.

For example, suppose a language model classifies 300 student reflections into positive, negative, or mixed experiences. If the model assigns different labels to the same reflections across repeated runs, its classifications exhibit output variability.

Some variability may be concentrated in genuinely ambiguous cases. Other differences may arise because the prompt does not adequately define the categories or because the model applies the definitions inconsistently.

Stability testing seeks to characterize these differences systematically.

It does not automatically determine which classification is correct. A model can consistently assign an incorrect label, just as human coders can consistently apply a poorly designed coding framework.

Distinguish Stability, Agreement, Accuracy, and Validity

These concepts are related but should not be used interchangeably.

Concept What It Examines Central Question
Stability Consistency across repeated executions Does the AI classify the same material consistently?
Agreement Correspondence between two or more sets of labels How frequently do the classifications coincide?
Accuracy Correspondence with an appropriate reference standard How often does the AI produce the reference classification?
Construct validity Whether the coding procedure represents the intended concept Are the categories and their application meaningful for the research question?
Robustness Performance under relevant changes in conditions Do the findings remain dependable when conditions vary?

A model may show high stability but poor accuracy if it repeatedly applies an incorrect rule. Conversely, modest disagreement between repeated runs may have limited practical consequences when the differences concern borderline observations that do not affect the study's conclusions.

Researchers should therefore avoid treating one agreement percentage as a complete assessment of AI coding quality.

Begin With a Clear Coding Framework

Before testing the AI model, researchers need to establish what the categories mean.

A coding framework should define the unit of analysis, permitted labels, inclusion and exclusion criteria, treatment of ambiguous responses, and whether multiple labels can be assigned to one observation.

For example, a study examining students' experiences with online learning might distinguish technical barriers, instructional barriers, social isolation, and positive experiences.

If a response mentions both technical barriers and positive experiences, the coding protocol must explain whether multiple codes are permitted or whether a single dominant category should be selected.

Without this information, disagreement may reflect an underspecified measurement procedure rather than unpredictable model behavior.

When prompts implement the coding framework, the analytical instructions should be preserved and version-controlled so the tested procedure can be identified precisely.

Use a Representative Evaluation Dataset

Stability testing should use observations that reflect the material the AI will encounter in the actual study.

A dataset containing only obvious examples may produce impressive agreement while failing to reveal problems with ambiguous or uncommon cases.

Researchers should consider variation in response length, category prevalence, linguistic characteristics, ambiguous wording, and other features relevant to the research population.

For instance, if the full dataset includes responses in English and Filipino, evaluating the model exclusively on straightforward English responses may provide an incomplete assessment of its stability.

When possible, the evaluation dataset should be separated from the material used to develop and refine the prompt. Otherwise, repeated adjustments may produce an overly optimistic estimate of performance on the examples already examined.

Researchers may also deliberately include challenging cases, but should distinguish a representative evaluation sample from a stress-test sample that overrepresents difficult observations.

How Many Times Should the Classification Be Repeated?

There is no universal number of AI executions sufficient to establish coding stability.

Two runs permit a basic comparison, but they provide limited information about the range of possible classifications. Additional runs may reveal disagreement patterns that would otherwise remain undetected.

The appropriate number depends on the expected variability, dataset size, available resources, precision required, and consequences of classification errors.

For a consequential measurement task, researchers may need a more extensive repeated-run design than for a preliminary exploratory analysis.

Importantly, repeating the model on only a few convenient examples does not establish stability across the intended research population.

Researchers should justify both the number of observations and the number of repeated executions. These are separate design decisions.

The broader question of when important AI-assisted tasks should be rerun depends on the scientific consequences of output variability.

How Do You Calculate Exact Agreement?

For single-label categorical classification, exact agreement is a straightforward starting point.

It measures the proportion of observations assigned the same label in two executions.

Calculating Exact Agreement
Exact Agreement (%) = (Matching Classifications / Total Observations) × 100

Matching classifications are observations receiving the same category in both runs.

Total observations is the number of observations evaluated in both runs.

Hypothetical calculation: Two AI executions classify the same 200 interview excerpts. They assign matching labels to 176 excerpts.

Exact agreement = (176 / 200) × 100 = 88%.

The result means that the two runs agree on 88% of the evaluated observations and disagree on 12%.

It does not mean the classifications are 88% accurate, nor does it establish that 88% agreement is adequate for the study.

Exact agreement is easy to interpret, but it can be misleading when one category dominates the dataset.

For example, if nearly every response belongs to one category, a procedure that repeatedly assigns that category may achieve high agreement without distinguishing meaningful differences among observations.

When Is Cohen's Kappa Useful?

Cohen's kappa is a chance-corrected agreement statistic commonly used to evaluate two sets of categorical ratings.

It considers the observed agreement and the agreement expected from the marginal distributions of the assigned categories under its chance-agreement model.

For two repeated AI classification runs, the statistic can summarize agreement beyond that expectation. However, researchers should recognize that the two runs are not independent human raters and may share systematic errors.

Calculating Cohen's Kappa
κ = (Pₒ − Pₑ) / (1 − Pₑ)

κ is Cohen's kappa.

Pₒ is the observed proportion of agreement.

Pₑ is the expected agreement calculated from the marginal category proportions.

Hypothetical calculation: Suppose two classification runs have observed agreement Pₒ = 0.88 and expected agreement Pₑ = 0.40.

κ = (0.88 − 0.40) / (1 − 0.40) = 0.80.

This indicates agreement above the value expected under the statistic's marginal-distribution model.

It does not establish 80% accuracy or prove that the coding procedure is scientifically acceptable. Interpretation depends on category prevalence, the research task, and the consequences of disagreement.

Kappa can be sensitive to category prevalence and differences in marginal distributions. Researchers should therefore report observed agreement and category distributions alongside the statistic rather than relying on a single coefficient.

Widely cited interpretation thresholds, such as those proposed by Landis and Koch, are descriptive conventions rather than universal standards of acceptable reliability.

When Should Researchers Use Krippendorff's Alpha?

Krippendorff's alpha is another agreement measure that can accommodate different measurement levels and, in suitable implementations, multiple raters and missing observations.

It may be useful when a researcher conducts more than two classification runs or evaluates multiple sets of coding decisions.

However, the choice of statistic should follow the coding design. Nominal categories, ordered categories, continuous measurements, and multi-label coding may require different agreement definitions.

Researchers should not automatically apply a statistic developed for one measurement structure to a different structure without examining its assumptions.

For example, a multi-label classification task in which each observation can receive several codes may require set-based agreement measures, label-specific statistics, or other methods rather than ordinary single-label exact agreement.

Use Confusion Matrices to Find Where the Model Disagrees

An overall agreement statistic does not reveal which categories are responsible for instability.

A confusion matrix cross-tabulates the classifications from two runs or compares AI classifications with reference labels.

For example, it may reveal that positive responses are classified consistently while mixed responses frequently alternate between positive and negative.

This pattern suggests that the coding definitions or model behavior may be less stable for observations expressing multiple sentiments.

Researchers should examine the direction and concentration of disagreement rather than reporting only the total number of matching labels.

When comparing against reference labels, confusion matrices can also support calculations such as precision, recall, and category-specific error rates.

How Do You Test Accuracy Against Human Coding?

Repeated AI agreement cannot establish that the model's classifications are correct. A separate evaluation against independently established reference labels is needed when accuracy is relevant.

For some studies, trained human coders may independently classify a representative set of observations using a documented coding framework.

Disagreements among human coders should be examined and resolved through an appropriate adjudication procedure. The resulting reference set may then be used to evaluate the AI model.

However, human-coded labels are not automatically infallible. Their credibility depends on the quality of the coding framework, coder preparation, evidence, and adjudication process.

In interpretive qualitative research, there may be more than one defensible interpretation of a passage. Researchers should avoid treating agreement with a single coder as an unquestionable measure of truth.

The appropriate evaluation should reflect the study's epistemological assumptions and the purpose of the coding procedure.

Why Category-Specific Performance Matters

A model can achieve high overall accuracy while performing poorly on a relatively uncommon but scientifically important category.

Suppose a classification dataset contains 900 ordinary observations and 100 observations describing a particular accessibility barrier.

A model that classifies the ordinary observations correctly but consistently misses the accessibility category may still achieve a high overall accuracy.

That performance could be unacceptable if identifying accessibility barriers is central to the research question.

Researchers should therefore examine category-specific precision, recall, and error patterns where appropriate.

Overall agreement should be interpreted in relation to category prevalence and the relative consequences of different errors.

Can Stable Category Frequencies Hide Unstable Individual Classifications?

Yes. Two AI executions may produce nearly identical category totals while assigning different labels to individual observations.

For example, both runs might classify 100 responses as positive and 100 as negative. Yet 20 observations could change from positive to negative while another 20 change in the opposite direction.

The aggregate distribution would remain unchanged despite substantial individual-level disagreement.

This matters when the analysis examines associations between classifications and other variables. Individual label changes may alter subgroup comparisons or statistical estimates even when overall category frequencies remain stable.

Researchers should therefore evaluate both individual-level agreement and the stability of the final research findings.

Test Whether Coding Instability Changes the Conclusions

The scientific significance of instability depends partly on what happens when the alternative classifications enter the analysis.

Researchers can conduct sensitivity analyses using the outputs from different runs or alternative defensible adjudication rules.

For example, they might calculate category frequencies separately for each execution and compare the resulting statistical associations.

If the central conclusions remain stable across plausible coding variations, this provides evidence of robustness. If the conclusions change substantially, the instability should be treated as a methodological limitation.

Neither result establishes the correctness of the coding framework itself.

The broader issue is whether the AI-assisted method is sufficiently stable for scientific use given the research question and the consequences of classification errors.

What Should Researchers Preserve From Stability Testing?

Stability testing should generate a research record that allows the evaluation to be examined later.

Relevant artifacts include the evaluation dataset, coding definitions, prompt versions, model identifiers, generation settings, execution dates, all classifications included in the test, reference labels, agreement calculations, and records of adjudication.

Researchers should preserve failed and disagreeing outputs when they form part of the evaluation rather than retaining only successful classifications.

Because model behavior can change, archiving the outputs from each consequential test run may be necessary for later verification.

Where sensitive research material is involved, the archive should be managed under appropriate confidentiality and data protection safeguards.

04 · A Practical Example

Testing the Stability of AI Coding for Student Feedback

Hypothetical Example

Classifying 200 Open-Ended Survey Responses

A researcher uses generative AI to classify 200 student comments about online learning as positive, negative, or mixed.

The researcher has developed a coding framework and uses the same documented prompt and available model configuration across three separate executions.

The study will use the resulting categories to examine whether students' reported experiences differ across instructional arrangements.

Step 1: Repeat the classification

The researcher processes all 200 comments three times, preserving the classifications from each execution. Every observation retains the same identifier across runs.

Step 2: Measure agreement

In this hypothetical evaluation, 170 comments receive the same category in all three runs. The remaining 30 receive at least two different categories. The proportion with unanimous agreement is 85%.

Step 3: Examine the unstable cases

The researcher discovers that most disagreements involve comments containing both positive and negative statements. The coding framework's rule for mixed responses requires clarification.

Step 4: Compare with independent reference coding

Trained human coders independently classify the evaluation responses using the documented framework. After appropriate review and adjudication, the resulting reference labels are used to assess the AI classifications and identify category-specific errors.

Step 5: Evaluate the effect on the findings

The researcher repeats the planned statistical comparisons using classifications from each run and examines whether differences in coding alter the direction or practical magnitude of the findings.

Step 6: Document the final procedure

Any revised coding definitions are evaluated on separate material where feasible. The researcher records the final prompt, model configuration, stability results, validation evidence, and adjudication procedure before using the method for the final analysis.

The hypothetical 85% unanimous agreement is not equivalent to 85% accuracy. It means that 170 of the 200 observations received the same label across all three executions.

Furthermore, unanimous agreement across three runs is a different measure from pairwise agreement between two runs. Researchers should identify the exact statistic they report rather than use the term agreement without qualification.

The practical value of the evaluation is not merely the percentage. It reveals where the coding procedure is unstable, provides evidence for improving the method, and helps determine whether the instability affects the scientific conclusions.

05 · What Researchers Often Get Wrong

Common Mistakes When Evaluating AI Coding Stability

Misconception

High Agreement Means the AI Classifications Are Accurate

Repeated agreement measures consistency, not correctness. A model can consistently apply an incorrect coding rule. Accuracy and validity require appropriate independent evidence.

Misconception

Two Matching Runs Prove the Model Is Stable

Two matching executions provide limited evidence under those particular conditions. They do not establish consistency across the intended dataset, future executions, or changed model environments.

Misconception

Cohen's Kappa Has One Universally Acceptable Threshold

Common interpretation bands are conventions rather than universal scientific standards. Acceptability depends on the measurement task, category prevalence, consequences of error, and study objectives.

Misconception

Stable Category Totals Mean Individual Classifications Are Stable

Different observations can exchange categories while aggregate frequencies remain unchanged. Individual-level disagreement may still affect subgroup analyses or relationships with other variables.

Misconception

Majority Voting Automatically Produces the Correct Classification

Repeated AI outputs may share systematic errors. Selecting the most frequent label can provide a consistent decision rule, but it does not establish that the selected label is valid.

Misconception

Human Coding Is Automatically a Perfect Reference Standard

Human coders can disagree or apply flawed category definitions. Reference coding requires a defensible protocol, suitable training, and transparent adjudication where appropriate.

Misconception

One Overall Agreement Statistic Is Enough

A single coefficient can conceal poor performance in important categories or instability affecting particular groups. Category-specific analysis and sensitivity testing may be necessary.

06 · What This Means for You

How to Decide Whether AI-Assisted Coding Is Stable Enough for Your Study

There is no single agreement threshold that makes AI-assisted coding scientifically acceptable across all research designs.

The appropriate standard depends on the construct being measured, the consequences of classification errors, the distribution of categories, and how directly the labels influence the findings.

A practical decision framework

If AI coding is used for preliminary exploration
Use stability testing to identify ambiguous categories and guide further methodological development. Avoid presenting exploratory outputs as validated measurements.
If AI labels become variables in statistical analysis
Evaluate repeated-run agreement, accuracy against suitable reference data, category-specific errors, and sensitivity of the reported results.
If some categories are uncommon but important
Examine category-specific precision, recall, and disagreement patterns rather than relying only on overall accuracy or agreement.
If repeated classifications disagree substantially
Investigate ambiguous definitions, prompt behavior, model limitations, and whether a revised or alternative coding procedure is warranted.
If classification differences change the study's conclusions
Treat the instability as a consequential methodological limitation and reconsider whether the AI-assisted measurement procedure is suitable for the intended claim.

Establish Acceptance Criteria Before Inspecting the Final Findings

Researchers should determine what level and type of disagreement would be consequential before selecting the final coding procedure.

For example, a study might require particularly strong recall for an important but uncommon category, or it might require that plausible coding variations do not materially change a primary statistical estimate.

Such criteria should be justified by the research purpose rather than selected because the observed results happen to satisfy them.

Prompt revisions should ideally be developed using separate material and evaluated on data not used to optimize the instructions.

This helps reduce the risk of overfitting the coding procedure to a particular set of examples.

Report the Evaluation Design, Not Just the Agreement Score

A useful methods report should explain how the evaluation observations were selected, how many repeated executions were performed, which model and prompt versions were used, and how agreement was calculated.

It should also describe the reference coding procedure, category distributions, important disagreements, and any sensitivity analyses used to assess the consequences for the findings.

Researchers should preserve the tested outputs and relevant settings so the evaluation can be examined independently.

Watch Out

Do not repeatedly modify the prompt and test it on the same evaluation data until the agreement score appears satisfactory, then report that score as independent validation. The evaluation material has effectively become part of prompt development. A separate test set or appropriately designed validation procedure is needed to assess performance without that source of optimism.

Stability testing is part of the broader effort to establish reproducibility in AI-assisted research. It helps researchers determine whether generated codes can support defensible measurements rather than simply produce plausible-looking datasets.

07 · A Quick Checklist

AI-Assisted Coding Stability Testing Checklist

Before accepting AI-generated classifications as research data, check:
Define the coding categories, unit of analysis, ambiguous-case rules, and whether multiple labels are permitted.
Select a representative evaluation dataset that includes relevant category and linguistic variation.
Separate prompt-development material from independent evaluation data where feasible.
Repeat the classification procedure using documented prompts, model identifiers, and available settings.
Calculate an agreement measure appropriate to the number of runs and the coding structure.
Inspect confusion matrices, category-specific disagreements, and the distribution of errors.
Evaluate accuracy or validity against independently established reference evidence when appropriate.
Test whether plausible coding variations materially change the primary findings.
Archive all consequential test outputs, calculations, adjudications, and prompt revisions.
08 · Frequently Asked Questions

Frequently Asked Questions About AI Coding Reliability

How do I measure the consistency of AI-generated classifications?

Repeat the documented classification procedure on the same evaluation dataset and compare the resulting labels. Exact agreement, suitable chance-corrected statistics, and category-specific disagreement analysis can help characterize stability.

Can Cohen's kappa be used to compare two AI classification runs?

Yes, when the task involves appropriate categorical labels and the statistic's assumptions are considered. However, two executions of one model are not independent human raters, and kappa should be interpreted alongside observed agreement and category prevalence.

Is 80% agreement acceptable for AI-assisted qualitative coding?

There is no universal threshold. Acceptability depends on the coding framework, category distribution, research purpose, consequences of disagreement, and the specific agreement statistic used. A percentage alone cannot establish validity.

How many times should I run an AI coding prompt to test stability?

No fixed number applies to every study. The number of runs should reflect expected variability, the required precision, available resources, and the consequences of classification errors. The evaluation dataset's size and representativeness also matter.

Does high agreement between AI and human coders prove the AI is reliable?

It provides useful evidence when the human reference coding is defensible and the evaluation sample is appropriate. However, agreement with human labels does not automatically establish construct validity or performance on other datasets.

Should I use majority voting across repeated AI classifications?

Majority voting may be considered as a predefined aggregation procedure, but it should be validated. Repeated outputs from the same model can share systematic errors, so the most frequent classification is not necessarily the correct one.

Can I test stability if the AI model has already been updated?

You can test the currently available model, but the results may not represent the original version. If earlier outputs were archived, comparisons may help assess changes. The model-version difference should be documented explicitly.

What if AI coding is stable but the research conclusions change after human corrections?

This suggests that the original AI classifications may contain consequential measurement errors despite their consistency. Researchers should evaluate the corrections, report their effect on the findings, and reconsider whether the uncorrected AI procedure is sufficiently valid.

09 · The Bottom Line

Stable AI Coding Must Be Demonstrated, Not Assumed

The Bottom Line

Researchers should test AI-assisted coding stability through repeated classification of representative data, appropriate agreement statistics, examination of disagreements, and assessment of whether classification variability affects the research findings.

Stability is only one requirement of a defensible coding procedure. Independent validation, sound category definitions, and transparent reporting remain necessary because a model can produce highly consistent but incorrect classifications. The appropriate standard is determined by the scientific purpose of the coding, not by an arbitrary agreement percentage.

10 · Sources and Further Reading

Authoritative Sources on Coding Agreement and Classification Evaluation

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes