elenanereiss/Limits-of-LLMs-for-German-Text-Classification

This repo is dedicated to an analysis of the LLMs performance as text classifiers on five German datasets from social media covering 13 tasks. We experiment with zero- and few-shot classification approaches as well as with fine-tuning using various LLMs

Python

3

5 commits

updated Feb 13, 2025

See the code

README

Limits of LLMs for German Text Classification

This repo is dedicated to an analysis of the LLMs performance as text classifiers on five German datasets from social media covering 13 tasks. We investigate zero- (ZSC) and few-shot classification (FSC) approaches with various LLMs.

Experiment setup

Approaches

  • zero-shot prompting
  • few-shot prompting
  • peft fine-tuning using qlora

Datasets

DatasetCitationTaskSize
German COVID-19 Twittersubmittedinformativeness, topic, credibility643
German Speech Act DatasetPlakidis and Rehm (2022)coarse and fine classification1959
German HASOC2020Mandl, Modha, Kumar M, and Chakravarthi (2021)coarse and fine classification2899
GermEval 2019 Subtask 2: The Shared Task on Identification of Offensive LanguageStruß, Siegel, Ruppenhofer, Wiegand, and Klenner (2019)coarse and fine classification7026
classification of implicit/explicit offensive language2888
GermEval 2021: The Shared Task on the Identification of Toxic, Engaging, and Fact-Claiming CommentsRisch, Stoll, Wilms, and Wiegand (2021)toxic, engaging, fact claming comment classification4188

For further information please see datasets description.

Models

Instruct LLMs for prompting

Base LLMs for fine-tuning

Results

Results per class can be found here.

datasettaskapproachLlama-3.2-3B precisionLlama-3.2-3B recallLlama-3.2-3B f1-scoreEuroLLM-9B precisionEuroLLM-9B recallEuroLLM-9B f1-scoreTeuken-7B precisionTeuken-7B recallTeuken-7B f1-scoreBübleLM precisionBübleLM recallBübleLM f1-score
covid19informativenesszs0.8385420.6128080.5904350.5190480.3388070.345190.6738930.5333330.491977
covid19fs0.5009780.5652980.5177660.7486050.571210.6280540.6800370.6341540.653288
covid19t0.7024690.7275310.700280.7697490.7922280.7799430.6477410.6779420.6476270.7281360.72370.722761
covid19topiczs0.2333330.2295320.1753090.3059580.1695140.1989140.4609170.371150.294857
covid19fs0.505910.4422070.398720.2399260.2411330.1653480.6208370.3762860.31353
covid19t0.7111560.6561910.6719340.5150.5326770.5022890.5414530.6142970.5605080.6091170.5710110.575528
covid19credibilityzs0.3325150.1725430.09706740.4666670.03525640.06531790.4114250.3888890.381033
covid19fs0.5374150.3579060.4126750.4845380.4941240.369230.5578540.506410.443985
covid19t0.496860.5186970.5037790.5410850.5646370.5418220.468750.483440.4690640.5066230.5176280.51011
speech_acts_coarsecoarse labelszs0.2967950.2219220.1424330.1929140.2249640.1708980.2535610.1849940.115082
speech_acts_coarsefs0.4183970.3218950.2871290.2083460.2051110.1742020.1879650.2378920.191404
speech_acts_coarset0.6423650.67050.6512820.6907190.5625980.5877310.5791380.6021850.5602380.4796870.53560.48655
speech_acts_finefine labelszs0.1341670.111470.1005050.1568910.1263690.1164170.03387560.1060850.0308676
speech_acts_finefs0.2779950.2004240.1719710.09805640.1169420.06883660.1065740.1697940.095387
speech_acts_finet0.3262830.3776710.3385380.339450.3218640.3111570.399550.4253450.3891960.2748770.3125680.282974
hasoc2020coarse labelszs0.6606040.6191750.594670.5985850.3544970.3747180.6288460.5076530.219968
hasoc2020fs0.6991690.4917760.5526920.6333670.6093510.5986560.6306040.5165820.239209
hasoc2020t0.7635780.8099680.7785990.7455360.7911210.7593940.7769410.8054370.7886030.7847050.7847050.784705
hasoc2020fine labelszs0.3784510.377510.2855050.3200710.2641440.167150.2595610.2685190.0682963
hasoc2020fs0.3915960.3035410.2944580.3688660.3042780.230110.2293220.2843920.252714
hasoc2020t0.4917980.5849120.5022870.484360.5584870.5068020.4623430.589180.4841780.4897110.5389760.505654
germeval2019_task12coarse labelszs0.6619320.6214930.5603640.650090.6008110.5448790.1600130.50.242439
germeval2019_task12fs0.6515380.4994290.339630.6736430.6691980.640880.1600130.50.242439
germeval2019_task12t0.7608540.7675160.7639160.7560210.7777620.7632130.7318680.7558380.7380390.7340290.7638710.738084
germeval2019_task12fine labelszs0.3639810.3678970.3568660.3361270.3012350.2162570.292130.3173210.206944
germeval2019_task12fs0.4082010.260140.2783120.3322550.2912560.2261640.4017850.2923940.113368
germeval2019_task12t0.4237380.4530680.4234950.397170.446840.4033670.4361170.4783630.4396230.4048530.4631220.413066
germeval2019_task3offensive labelszs0.5350160.5330760.2603970.5012310.3914350.2626560.4279570.50.461182
germeval2019_task3fs0.5731440.5087940.1449030.5337970.4872030.3571760.5952380.504950.474751
germeval2019_task3t0.6756120.7603690.699060.6830150.7071740.6936090.6714470.7380560.6926730.6538320.7335460.673448
germeval2021toxiczs0.6043570.6002980.6008870.565860.4808080.396250.614990.5316790.364985
germeval2021fs0.5918490.5983890.5863130.5583380.4869890.5169320.620380.5628480.436605
germeval2021t0.6744220.6786870.6761040.6970290.6880710.6914620.7014770.7050120.7030140.6778230.6634540.667712
germeval2021engagingzs0.5474610.5437070.5304940.5581390.4920920.4638120.5568360.5228970.327142
germeval2021fs0.5107220.4120910.4290850.5310760.4239630.4694850.5866910.5490320.352616
germeval2021t0.6612980.6842320.6680.6621490.6785520.6681140.6380460.6595440.6432190.6674170.6798590.672466
germeval2021factClaimingzs0.6255860.6108890.5282850.571380.4799160.343910.6666670.5015820.25611
germeval2021fs0.6059580.619310.5932680.5845660.4990190.5383980.5971590.5475230.389737
germeval2021t0.7713030.7677480.7694520.7523890.7606410.7559940.721040.7224350.7217210.7157760.7136690.714685

Use

Prompting

Depending on the model run:

python prompting_llama.py

python prompting_eurollm.py

python prompting_teuken.py

Fine-tuning

First get access to LLama 3.2 and EuroLLM on HuggingFace and log in with command huggingface-cli login. Then, to fine-tune a LLM run, e.g.:

python finetuning.py meta-llama/Llama-3.2-3B
german
llama3
llm
peft-fine-tuning-llm
prompting
qlora
text-classification

elenanereiss/Limits-of-LLMs-for-German-Text-Classification

This repo is dedicated to an analysis of the LLMs performance as text classifiers on five German datasets from social media covering 13 tasks. We experiment with zero- and few-shot classification approaches as well as with fine-tuning using various LLMs

Python

3

5 commits

updated Feb 13, 2025

See the code

README

Limits of LLMs for German Text Classification

This repo is dedicated to an analysis of the LLMs performance as text classifiers on five German datasets from social media covering 13 tasks. We investigate zero- (ZSC) and few-shot classification (FSC) approaches with various LLMs.

Experiment setup

Approaches

  • zero-shot prompting
  • few-shot prompting
  • peft fine-tuning using qlora

Datasets

DatasetCitationTaskSize
German COVID-19 Twittersubmittedinformativeness, topic, credibility643
German Speech Act DatasetPlakidis and Rehm (2022)coarse and fine classification1959
German HASOC2020Mandl, Modha, Kumar M, and Chakravarthi (2021)coarse and fine classification2899
GermEval 2019 Subtask 2: The Shared Task on Identification of Offensive LanguageStruß, Siegel, Ruppenhofer, Wiegand, and Klenner (2019)coarse and fine classification7026
classification of implicit/explicit offensive language2888
GermEval 2021: The Shared Task on the Identification of Toxic, Engaging, and Fact-Claiming CommentsRisch, Stoll, Wilms, and Wiegand (2021)toxic, engaging, fact claming comment classification4188

For further information please see datasets description.

Models

Instruct LLMs for prompting

Base LLMs for fine-tuning

Results

Results per class can be found here.

datasettaskapproachLlama-3.2-3B precisionLlama-3.2-3B recallLlama-3.2-3B f1-scoreEuroLLM-9B precisionEuroLLM-9B recallEuroLLM-9B f1-scoreTeuken-7B precisionTeuken-7B recallTeuken-7B f1-scoreBübleLM precisionBübleLM recallBübleLM f1-score
covid19informativenesszs0.8385420.6128080.5904350.5190480.3388070.345190.6738930.5333330.491977
covid19fs0.5009780.5652980.5177660.7486050.571210.6280540.6800370.6341540.653288
covid19t0.7024690.7275310.700280.7697490.7922280.7799430.6477410.6779420.6476270.7281360.72370.722761
covid19topiczs0.2333330.2295320.1753090.3059580.1695140.1989140.4609170.371150.294857
covid19fs0.505910.4422070.398720.2399260.2411330.1653480.6208370.3762860.31353
covid19t0.7111560.6561910.6719340.5150.5326770.5022890.5414530.6142970.5605080.6091170.5710110.575528
covid19credibilityzs0.3325150.1725430.09706740.4666670.03525640.06531790.4114250.3888890.381033
covid19fs0.5374150.3579060.4126750.4845380.4941240.369230.5578540.506410.443985
covid19t0.496860.5186970.5037790.5410850.5646370.5418220.468750.483440.4690640.5066230.5176280.51011
speech_acts_coarsecoarse labelszs0.2967950.2219220.1424330.1929140.2249640.1708980.2535610.1849940.115082
speech_acts_coarsefs0.4183970.3218950.2871290.2083460.2051110.1742020.1879650.2378920.191404
speech_acts_coarset0.6423650.67050.6512820.6907190.5625980.5877310.5791380.6021850.5602380.4796870.53560.48655
speech_acts_finefine labelszs0.1341670.111470.1005050.1568910.1263690.1164170.03387560.1060850.0308676
speech_acts_finefs0.2779950.2004240.1719710.09805640.1169420.06883660.1065740.1697940.095387
speech_acts_finet0.3262830.3776710.3385380.339450.3218640.3111570.399550.4253450.3891960.2748770.3125680.282974
hasoc2020coarse labelszs0.6606040.6191750.594670.5985850.3544970.3747180.6288460.5076530.219968
hasoc2020fs0.6991690.4917760.5526920.6333670.6093510.5986560.6306040.5165820.239209
hasoc2020t0.7635780.8099680.7785990.7455360.7911210.7593940.7769410.8054370.7886030.7847050.7847050.784705
hasoc2020fine labelszs0.3784510.377510.2855050.3200710.2641440.167150.2595610.2685190.0682963
hasoc2020fs0.3915960.3035410.2944580.3688660.3042780.230110.2293220.2843920.252714
hasoc2020t0.4917980.5849120.5022870.484360.5584870.5068020.4623430.589180.4841780.4897110.5389760.505654
germeval2019_task12coarse labelszs0.6619320.6214930.5603640.650090.6008110.5448790.1600130.50.242439
germeval2019_task12fs0.6515380.4994290.339630.6736430.6691980.640880.1600130.50.242439
germeval2019_task12t0.7608540.7675160.7639160.7560210.7777620.7632130.7318680.7558380.7380390.7340290.7638710.738084
germeval2019_task12fine labelszs0.3639810.3678970.3568660.3361270.3012350.2162570.292130.3173210.206944
germeval2019_task12fs0.4082010.260140.2783120.3322550.2912560.2261640.4017850.2923940.113368
germeval2019_task12t0.4237380.4530680.4234950.397170.446840.4033670.4361170.4783630.4396230.4048530.4631220.413066
germeval2019_task3offensive labelszs0.5350160.5330760.2603970.5012310.3914350.2626560.4279570.50.461182
germeval2019_task3fs0.5731440.5087940.1449030.5337970.4872030.3571760.5952380.504950.474751
germeval2019_task3t0.6756120.7603690.699060.6830150.7071740.6936090.6714470.7380560.6926730.6538320.7335460.673448
germeval2021toxiczs0.6043570.6002980.6008870.565860.4808080.396250.614990.5316790.364985
germeval2021fs0.5918490.5983890.5863130.5583380.4869890.5169320.620380.5628480.436605
germeval2021t0.6744220.6786870.6761040.6970290.6880710.6914620.7014770.7050120.7030140.6778230.6634540.667712
germeval2021engagingzs0.5474610.5437070.5304940.5581390.4920920.4638120.5568360.5228970.327142
germeval2021fs0.5107220.4120910.4290850.5310760.4239630.4694850.5866910.5490320.352616
germeval2021t0.6612980.6842320.6680.6621490.6785520.6681140.6380460.6595440.6432190.6674170.6798590.672466
germeval2021factClaimingzs0.6255860.6108890.5282850.571380.4799160.343910.6666670.5015820.25611
germeval2021fs0.6059580.619310.5932680.5845660.4990190.5383980.5971590.5475230.389737
germeval2021t0.7713030.7677480.7694520.7523890.7606410.7559940.721040.7224350.7217210.7157760.7136690.714685

Use

Prompting

Depending on the model run:

python prompting_llama.py

python prompting_eurollm.py

python prompting_teuken.py

Fine-tuning

First get access to LLama 3.2 and EuroLLM on HuggingFace and log in with command huggingface-cli login. Then, to fine-tune a LLM run, e.g.:

python finetuning.py meta-llama/Llama-3.2-3B
german
llama3
llm
peft-fine-tuning-llm
prompting
qlora
text-classification