{"title":"Human-in-the-loop LLM-assisted thematic analysis: A validated, reproducible tutorial for large-scale qualitative research.","authors":"Mandana Jafarian","doi":"10.3758/s13428-026-03207-6","DOIUrl":null,"url":null,"abstract":"<p><p>Large language models (LLMs) are increasingly used to support qualitative research, yet clear methodological frameworks for integrating them into thematic analysis remain limited. A central challenge is how to scale qualitative coding with LLM assistance while preserving methodological rigor and reproducibility. This tutorial presents a structured, human-in-the-loop workflow for conducting large-scale thematic analysis with LLM support. Grounded in inductive and hybrid approaches to thematic analysis (Braun & Clarke, 2006), the workflow proceeds in three phases. First, researchers conduct manual thematic analysis on a subset of data to establish an initial codebook and assess relevance. Second, the same subset is analyzed using an LLM to iteratively refine prompts and evaluate alignment between human and model outputs. Third, the validated approach is applied to the full corpus using a modular four-step pipeline: key-idea extraction, chunk-level thematic coding, theme consolidation, and clustering, with iterative human verification through random sampling of outputs. We demonstrate the workflow using 2,952 publicly available Reddit posts. Structured prompt design and JSON-formatted outputs enable traceability between themes and source data and support reproducible analysis. Prompt engineering is treated as an iterative analytic process rather than a one-time instruction. Under controlled conditions, human and LLM coding showed high agreement (Cohen's κ = 0.91). All prompts, code, and reproducibility materials are openly available via an Open Science Framework repository. By providing detailed implementation guidance, embedded validation procedures, and safeguards against common failure modes such as hallucination and overgeneralization, this tutorial offers a practical and extensible framework for integrating LLMs into qualitative research across domains.</p>","PeriodicalId":8717,"journal":{"name":"Behavior Research Methods","volume":"58 11","pages":""},"PeriodicalIF":5.0000,"publicationDate":"2026-10-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Behavior Research Methods","FirstCategoryId":"102","ListUrlMain":"https://doi.org/10.3758/s13428-026-03207-6","RegionNum":2,"RegionCategory":"心理学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"PSYCHOLOGY, EXPERIMENTAL","Score":null,"Total":0}
引用次数: 0
Abstract
Large language models (LLMs) are increasingly used to support qualitative research, yet clear methodological frameworks for integrating them into thematic analysis remain limited. A central challenge is how to scale qualitative coding with LLM assistance while preserving methodological rigor and reproducibility. This tutorial presents a structured, human-in-the-loop workflow for conducting large-scale thematic analysis with LLM support. Grounded in inductive and hybrid approaches to thematic analysis (Braun & Clarke, 2006), the workflow proceeds in three phases. First, researchers conduct manual thematic analysis on a subset of data to establish an initial codebook and assess relevance. Second, the same subset is analyzed using an LLM to iteratively refine prompts and evaluate alignment between human and model outputs. Third, the validated approach is applied to the full corpus using a modular four-step pipeline: key-idea extraction, chunk-level thematic coding, theme consolidation, and clustering, with iterative human verification through random sampling of outputs. We demonstrate the workflow using 2,952 publicly available Reddit posts. Structured prompt design and JSON-formatted outputs enable traceability between themes and source data and support reproducible analysis. Prompt engineering is treated as an iterative analytic process rather than a one-time instruction. Under controlled conditions, human and LLM coding showed high agreement (Cohen's κ = 0.91). All prompts, code, and reproducibility materials are openly available via an Open Science Framework repository. By providing detailed implementation guidance, embedded validation procedures, and safeguards against common failure modes such as hallucination and overgeneralization, this tutorial offers a practical and extensible framework for integrating LLMs into qualitative research across domains.
期刊介绍:
Behavior Research Methods publishes articles concerned with the methods, techniques, and instrumentation of research in experimental psychology. The journal focuses particularly on the use of computer technology in psychological research. An annual special issue is devoted to this field.