Saved in:
Bibliographic Details
Main Authors: Fang, Qixiang, Bernardo, Javier Garcia, van Kesteren, Erik-Jan
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2604.09638
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916054854270976
author Fang, Qixiang
Bernardo, Javier Garcia
van Kesteren, Erik-Jan
author_facet Fang, Qixiang
Bernardo, Javier Garcia
van Kesteren, Erik-Jan
contents Large language models (LLMs) are increasingly used by researchers in the social sciences and humanities (SSH) for text analysis, particularly to automate text annotation. However, many researchers still face challenges in adopting LLMs, addressing their limitations, and producing reproducible workflows and results. For example, annotation errors can bias downstream statistical analyses even when apparent accuracy is high. This paper provides a step-by-step methodological guide to using LLMs for text annotation in SSH research, with practical Python and R examples. We explain how LLMs work, how to set up research projects, how to interact with (open-source) LLMs programmatically, how to design and evaluate prompts without overfitting, how to integrate LLM annotations into statistical analyses while accounting for annotation error, and how to manage cost, efficiency, and reproducibility at scale. Throughout, we emphasize intuitive methodological reasoning, concrete examples, and best practices to help researchers incorporate LLM-based annotation into reproducible scientific workflows.
format Preprint
id arxiv_https___arxiv_org_abs_2604_09638
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle A Methodological Guide on Using Large Language Models for Reproducible Text Annotation in the Social Sciences and Humanities with Python and R
Fang, Qixiang
Bernardo, Javier Garcia
van Kesteren, Erik-Jan
Computers and Society
Large language models (LLMs) are increasingly used by researchers in the social sciences and humanities (SSH) for text analysis, particularly to automate text annotation. However, many researchers still face challenges in adopting LLMs, addressing their limitations, and producing reproducible workflows and results. For example, annotation errors can bias downstream statistical analyses even when apparent accuracy is high. This paper provides a step-by-step methodological guide to using LLMs for text annotation in SSH research, with practical Python and R examples. We explain how LLMs work, how to set up research projects, how to interact with (open-source) LLMs programmatically, how to design and evaluate prompts without overfitting, how to integrate LLM annotations into statistical analyses while accounting for annotation error, and how to manage cost, efficiency, and reproducibility at scale. Throughout, we emphasize intuitive methodological reasoning, concrete examples, and best practices to help researchers incorporate LLM-based annotation into reproducible scientific workflows.
title A Methodological Guide on Using Large Language Models for Reproducible Text Annotation in the Social Sciences and Humanities with Python and R
topic Computers and Society
url https://arxiv.org/abs/2604.09638