kth.sePublications
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
A Comparative Study of ChatGPT-3.5 and Llama 3 in Swedish Sentiment Analysis
KTH, School of Electrical Engineering and Computer Science (EECS).
KTH, School of Electrical Engineering and Computer Science (EECS).
2024 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesis
Abstract [en]

This study investigates the capabilities of computer models that mimic natural human language, commonly known as large language models (LLMs), in classifying Swedish texts with binary labels. Specifically, the study compares the performance of OpenAI’s proprietary ChatGPT-3.5 and Meta AI's open source Llama 3 model, focusing on their ability to classify Swedish consumer reviews as having either positive or negative sentiments. Despite both models being primarily trained on English data, they both achieve accuracies of 97% in classifying Swedish texts. The study was conducted using a dataset consisting of ten thousand reviews from trustpilot.com. The models’ performance are analyzed using the metrics accuracy and F1 score. The discussion explores reliability and ethical concerns as well as nuances and challenges encountered during the classification process, including the handling of mixed sentiments and neutral expressions, which often lead to incorrect classifications. Future studies are suggested to explore the inclusion of a neutral sentiment and comparing performance with and without model fine-tuning. The study concludes that large language models, both proprietary and open source, can achieve high precision in sentiment analysis of Swedish texts.

Abstract [sv]

Denna studie undersöker förmågan hos datormodeller som efterliknar naturligt mänskligt språk, allmänt kända som språkmodeller (LLMs), att annotera svenska texter med en av två klasser. Mer specifikt jämför studien OpenAI:s proprietära ChatGPT-3.5:s och Meta AI:s öppna Llama 3:s förmåga att att klassificera svenska konsumentrecensioner som antingen positivt eller negativt laddade. Trots att båda modellerna är primärt tränade på engelskspråkig data uppnår de båda en precision på 97% för klassificeringarna. Studien genomfördes med ett dataset bestående av tiotusen recensioner från trustpilot.com. Modellernas prestanda analyserades med mätvärdena noggrannhet och F1-poäng. Bekymmer kring pålitlighet och etik diskuteras samt nyanser och utmaningar upptäckta under klassificeringsprocessen, inklusive hanteringen av blandade tonaliteter och neutrala uttryck, som ofta leder till inkorrekta klassificeringar. Framtida studier föreslås utforska inkluderingen av en klass för neutral tonalitet och att jämföra modellers prestanda med och utan finjustering av modellerna. Studien drar slutsatsen att språkmodeller, både proprietära och öppna, kan uppvisa hög precision för både positiva och negativa tonaliteter i svenska texter.

Place, publisher, year, edition, pages
2024. , p. 8
Series
TRITA-EECS-EX ; 2024:221
Keywords [en]
Sentiment analysis, text classification, large language models, ChatGPT, Llama 3
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:kth:diva-349583OAI: oai:DiVA.org:kth-349583DiVA, id: diva2:1880733
Supervisors
Examiners
Available from: 2024-08-08 Created: 2024-07-01 Last updated: 2024-08-08Bibliographically approved

Open Access in DiVA

fulltext(356 kB)359 downloads
File information
File name FULLTEXT01.pdfFile size 356 kBChecksum SHA-512
69216ce72b74734dc1d126d9d3f236991a55382dd446b8198ad99beb8f31ebb1e8a5f5ee601b1be12d3e80204d2f7ea66ca7794d8289c2ec187596b600f359ff
Type fulltextMimetype application/pdf

By organisation
School of Electrical Engineering and Computer Science (EECS)
Computer and Information Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 360 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 1399 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf