IDEAS home Printed from https://ideas.repec.org/a/spr/jcsosc/v8y2025i1d10.1007_s42001-024-00345-9.html
   My bibliography  Save this article

Open-source LLMs for text annotation: a practical guide for model setting and fine-tuning

Author

Listed:
  • Meysam Alizadeh

    (University of Zurich)

  • Maël Kubli

    (University of Zurich)

  • Zeynab Samei

    (Institute for Fundamental Research)

  • Shirin Dehghani

    (Allameh Tabataba’i University)

  • Mohammadmasiha Zahedivafa

    (Iran University of Science and Technology)

  • Juan D. Bermeo

    (University of Zurich)

  • Maria Korobeynikova

    (University of Zurich)

  • Fabrizio Gilardi

    (University of Zurich)

Abstract

This paper studies the performance of open-source Large Language Models (LLMs) in text classification tasks typical for political science research. By examining tasks like stance, topic, and relevance classification, we aim to guide scholars in making informed decisions about their use of LLMs for text analysis and to establish a baseline performance benchmark that demonstrates the models’ effectiveness. Specifically, we conduct an assessment of both zero-shot and fine-tuned LLMs across a range of text annotation tasks using news articles and tweets datasets. Our analysis shows that fine-tuning improves the performance of open-source LLMs, allowing them to match or even surpass zero-shot GPT $$-$$ - 3.5 and GPT-4, though still lagging behind fine-tuned GPT $$-$$ - 3.5. We further establish that fine-tuning is preferable to few-shot training with a relatively modest quantity of annotated text. Our findings show that fine-tuned open-source LLMs can be effectively deployed in a broad spectrum of text annotation applications. We provide a Python notebook facilitating the application of LLMs in text annotation for other researchers.

Suggested Citation

  • Meysam Alizadeh & Maël Kubli & Zeynab Samei & Shirin Dehghani & Mohammadmasiha Zahedivafa & Juan D. Bermeo & Maria Korobeynikova & Fabrizio Gilardi, 2025. "Open-source LLMs for text annotation: a practical guide for model setting and fine-tuning," Journal of Computational Social Science, Springer, vol. 8(1), pages 1-25, February.
  • Handle: RePEc:spr:jcsosc:v:8:y:2025:i:1:d:10.1007_s42001-024-00345-9
    DOI: 10.1007/s42001-024-00345-9
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1007/s42001-024-00345-9
    File Function: Abstract
    Download Restriction: Access to the full text of the articles in this series is restricted.

    File URL: https://libkey.io/10.1007/s42001-024-00345-9?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:spr:jcsosc:v:8:y:2025:i:1:d:10.1007_s42001-024-00345-9. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.