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

IF 2 Q2 SOCIAL SCIENCES, MATHEMATICAL METHODS
Journal of Computational Social Science Pub Date : 2025-01-01 Epub Date: 2024-12-18 DOI:10.1007/s42001-024-00345-9
Meysam Alizadeh, Maël Kubli, Zeynab Samei, Shirin Dehghani, Mohammadmasiha Zahedivafa, Juan D Bermeo, Maria Korobeynikova, Fabrizio Gilardi
{"title":"Open-source LLMs for text annotation: a practical guide for model setting and fine-tuning.","authors":"Meysam Alizadeh, Maël Kubli, Zeynab Samei, Shirin Dehghani, Mohammadmasiha Zahedivafa, Juan D Bermeo, Maria Korobeynikova, Fabrizio Gilardi","doi":"10.1007/s42001-024-00345-9","DOIUrl":null,"url":null,"abstract":"<p><p>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 <math><mo>-</mo></math> 3.5 and GPT-4, though still lagging behind fine-tuned GPT <math><mo>-</mo></math> 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.</p><p><strong>Supplementary information: </strong>The online version contains supplementary material available at 10.1007/s42001-024-00345-9.</p>","PeriodicalId":29946,"journal":{"name":"Journal of Computational Social Science","volume":"8 1","pages":"17"},"PeriodicalIF":2.0000,"publicationDate":"2025-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC11655591/pdf/","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Computational Social Science","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1007/s42001-024-00345-9","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2024/12/18 0:00:00","PubModel":"Epub","JCR":"Q2","JCRName":"SOCIAL SCIENCES, MATHEMATICAL METHODS","Score":null,"Total":0}
引用次数: 0

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.

Supplementary information: The online version contains supplementary material available at 10.1007/s42001-024-00345-9.

用于文本注释的开源法学硕士:模型设置和微调的实用指南。
本文研究了开源大型语言模型(LLMs)在政治学研究中典型的文本分类任务中的性能。通过检查立场、主题和相关分类等任务,我们旨在指导学者在使用法学硕士进行文本分析时做出明智的决定,并建立一个基线性能基准,以证明模型的有效性。具体来说,我们使用新闻文章和tweet数据集对一系列文本注释任务中的零射击和微调llm进行评估。我们的分析表明,微调提高了开源llm的性能,使它们能够匹配甚至超过零射击GPT- 3.5和GPT-4,尽管仍然落后于微调后的GPT- 3.5。我们进一步确定微调比使用相对适度数量的注释文本进行少量射击训练更可取。我们的研究结果表明,经过微调的开源法学硕士可以有效地部署在广泛的文本注释应用程序中。我们为其他研究人员提供了一个Python笔记本,方便llm在文本注释中的应用。补充信息:在线版本包含补充资料,网址为10.1007/s42001-024-00345-9。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Journal of Computational Social Science
Journal of Computational Social Science SOCIAL SCIENCES, MATHEMATICAL METHODS-
CiteScore
6.20
自引率
6.20%
发文量
30
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信