Skip to main content
QUICK REVIEW

[Paper Review] LLM-in-the-loop: Leveraging Large Language Model for Thematic Analysis

Shih-Chieh Dai, Aiping Xiong|arXiv (Cornell University)|Oct 23, 2023
Computational and Text Analysis MethodsSocial Sciences7 citations
TL;DR

This paper proposes an LLM-in-the-loop framework that integrates large language models (LLMs) like GPT-3.5 with human coders to streamline thematic analysis (TA) in qualitative research. Using in-context learning and iterative discussion prompts, the framework generates high-quality codebooks with human-LLM agreement κ = 0.87 (Music Shuffle) and κ = 0.81 (Password Manager), matching or exceeding human-only performance while reducing labor and time demands.

ABSTRACT

Thematic analysis (TA) has been widely used for analyzing qualitative data in many disciplines and fields. To ensure reliable analysis, the same piece of data is typically assigned to at least two human coders. Moreover, to produce meaningful and useful analysis, human coders develop and deepen their data interpretation and coding over multiple iterations, making TA labor-intensive and time-consuming. Recently the emerging field of large language models (LLMs) research has shown that LLMs have the potential replicate human-like behavior in various tasks: in particular, LLMs outperform crowd workers on text-annotation tasks, suggesting an opportunity to leverage LLMs on TA. We propose a human-LLM collaboration framework (i.e., LLM-in-the-loop) to conduct TA with in-context learning (ICL). This framework provides the prompt to frame discussions with a LLM (e.g., GPT-3.5) to generate the final codebook for TA. We demonstrate the utility of this framework using survey datasets on the aspects of the music listening experience and the usage of a password manager. Results of the two case studies show that the proposed framework yields similar coding quality to that of human coders but reduces TA's labor and time demands.

Motivation & Objective

  • To address the labor-intensive and time-consuming nature of traditional thematic analysis (TA) requiring multiple human coders.
  • To explore whether large language models (LLMs) can effectively support or replace human coders in TA while maintaining high-quality coding.
  • To design a human–LLM collaboration framework that enables iterative refinement of codebooks through structured discussion prompts.
  • To address LLM input length limitations by using partial data for codebook development without sacrificing quality.
  • To validate the framework on real-world survey datasets, demonstrating feasibility and performance comparable to human-only TA.

Proposed method

  • The framework uses in-context learning (ICL) to guide the LLM through each step of thematic analysis, from initial code extraction to codebook refinement.
  • A human coder and LLM engage in a looped discussion using predefined prompts to iteratively refine and agree on representative codes and themes.
  • The LLM generates initial codes from free-text responses based on the research question, then groups similar codes into thematic categories.
  • The framework applies a two-stage process: codebook generation using a subset of data (to manage input length), followed by final coding and inner-annotator agreement (IAA) calculation on sampled responses.
  • Prompts are specifically designed for each phase of Braun and Clarke’s (2006) TA procedure, including familiarization, initial coding, theme development, and review.
  • The method leverages GPT-3.5 as a machine coder (MC), with human coders (HCs) validating and refining outputs to ensure alignment with research goals and data semantics.
Figure 1: Workflow of the LLM-in-the-Loop Framework.
Figure 1: Workflow of the LLM-in-the-Loop Framework.

Experimental results

Research questions

  • RQ1Can a large language model (LLM) effectively support thematic analysis in place of or alongside human coders?
  • RQ2How can a human–LLM collaboration framework be structured to ensure high-quality, reliable codebook generation in thematic analysis?
  • RQ3What impact does LLM integration have on inter-annotator agreement (IAA) compared to traditional human-only coding?
  • RQ4How can input length limitations of LLMs be addressed when processing long qualitative datasets?
  • RQ5Does the use of in-context learning and iterative discussion prompts improve codebook quality and consistency in thematic analysis?

Key findings

  • The LLM-in-the-loop framework achieved a weighted Cohen’s kappa of 0.87 in the Music Shuffle case study, surpassing the original human-only agreement (κ = 0.66).
  • In the Password Manager case study, the framework achieved a kappa of 0.81, exceeding the original human-only agreement (κ = 0.77).
  • The codebooks generated by the human–LLM collaboration showed high semantic similarity (cosine similarity 0.8864 and 0.8895) to the original human-generated codebooks.
  • The framework significantly reduced the time and labor required for thematic analysis by automating initial coding and enabling efficient discussion between human and LLM.
  • The use of partial data for codebook development was found to be a feasible solution to LLM input length constraints, with no significant drop in codebook quality.
  • Despite inherent subjectivity in thematic analysis, the iterative discussion process helped reduce bias and improve consistency between human and LLM coders.
Figure 2: An exemplar for initial code extraction. Green depicts the quoted sentence, blue indicates the definition of a code, and red represents the code.
Figure 2: An exemplar for initial code extraction. Green depicts the quoted sentence, blue indicates the definition of a code, and red represents the code.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.