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.
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.
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.
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.