Compute-constrained LLM adaptation to Czech language
Adaptace LLM pro češtinu omezenými výpočetními prostředky
Authors
Supervisors
Reviewers
Editors
Other contributors
Journal Title
Journal ISSN
Volume Title
Publisher
České vysoké učení technické v Praze
Czech Technical University in Prague
Czech Technical University in Prague
Date of defense
2025-06-19
Abstract
Veřejně dostupné, nechráněné LLM představují silný základ pro výzkum zpracování přirozeného jazyka (NLP), ale vykazují horší výkonnost u jazyků, které jsou v trénovacích korpusech nedostatečně zastoupeny, jako je čeština. Tato práce zkoumá úpravu slovníku, pokračující předtrénování a instrukční ladění jako prostředky k překlenutí této mezery, přičemž využívá maximálně jednu GPU NVIDIA A100 80GB, aby byla zachována praktická aplikovatelnost výzkumu. Nejprve mapuji LLM modely vhodné pro adaptaci do češtiny, poté podrobně popisuji adaptační techniky a zkoumám metody QLoRA a další parametrově efektivní přístupy k ladění. Prozkoumávám existující české korpusy a sestavuji kolekci pro instrukční ladění inspirovanou FLAN a dvě obecné kolekce pro instrukční ladění, obsahující dva nově vytvořené české datasety. Modely Llama 3.1 8B (Instruct) byly adaptovány pomocí různých metod a vyhodnoceny pomocí analýzy tokenizéru, perplexity, BenCzechMarkuva benchmarku Czech WildBench, nově vytvořeného v této práci. Mezi klíčové poznatky patří: (1) potvrzení, že inicializace pomocí průměru podslov výrazně urychluje konvergenci při úpravě tokenizéru do češtiny; (2) rozšíření tokenizéru neočekávaně zvyšuje fertilitu pro češtinu, což si zaslouží další zkoumání; a (3) kombinace českých a anglických dat během předtrénování snižuje výskyt katastrofického zapomínání, jak ukazují výsledky perplexity. Žádná kombinace adaptačních metod nepřekonala ostatní konzistentně a žádná nepřekonala výchozí výkon modelu Llama 3.1 8B Instruct. Vliv LoRA na výkon a příčiny omezení adaptace si zasluhují hlubší analýzu. Vytvořené datasety, modely a kód jsou zveřejněny prostřednictvím Hugging Face Hub a GitHubu.
Non-proprietary LLMs offer a strong base for NLP research but underperform for languages underrepresented in the corpora, such as Czech. This thesis explores vocabulary adaptation, continued pretraining, and instruction tuning to address this gap, using at most one NVIDIA A100 80GB GPU to ensure practical research applicability. I first survey the LLMs suitable for Czech adaptation, then detail the adaptation techniques and explore the QLoRA and other parameter-efficient fine-tuning methods. I investigate existing Czech corpora and assemble a FLAN-inspired NLI instruction tuning collection, and two general instruction tuning collections, including two originally scraped Czech datasets. The Llama 3.1 8B (Instruct) models were adapted using multiple methods and evaluated using tokenizer evaluation, perplexity, BenCzechMark, and the Czech WildBench, newly introduced in this thesis. Key findings include: (1) confirmation that average-subword initialisation facilitates faster convergence in vocabulary adaptation in Czech; (2) expanding the tokenizer unexpectedly increases fertility for Czech, necessitating further investigation; and (3) mixing Czech and English data during pretraining mitigates catastrophic forgetting based on perplexity results. No single combination of adaptation methods outperformed others consistently, and none surpassed the baseline performance of the Llama 3.1 8B Instruct. The influence of LoRA on performance and the causes of adaptation limitations merit deeper exploration. Created datasets, models and code are published through Hugging Face Hub and GitHub.
Non-proprietary LLMs offer a strong base for NLP research but underperform for languages underrepresented in the corpora, such as Czech. This thesis explores vocabulary adaptation, continued pretraining, and instruction tuning to address this gap, using at most one NVIDIA A100 80GB GPU to ensure practical research applicability. I first survey the LLMs suitable for Czech adaptation, then detail the adaptation techniques and explore the QLoRA and other parameter-efficient fine-tuning methods. I investigate existing Czech corpora and assemble a FLAN-inspired NLI instruction tuning collection, and two general instruction tuning collections, including two originally scraped Czech datasets. The Llama 3.1 8B (Instruct) models were adapted using multiple methods and evaluated using tokenizer evaluation, perplexity, BenCzechMark, and the Czech WildBench, newly introduced in this thesis. Key findings include: (1) confirmation that average-subword initialisation facilitates faster convergence in vocabulary adaptation in Czech; (2) expanding the tokenizer unexpectedly increases fertility for Czech, necessitating further investigation; and (3) mixing Czech and English data during pretraining mitigates catastrophic forgetting based on perplexity results. No single combination of adaptation methods outperformed others consistently, and none surpassed the baseline performance of the Llama 3.1 8B Instruct. The influence of LoRA on performance and the causes of adaptation limitations merit deeper exploration. Created datasets, models and code are published through Hugging Face Hub and GitHub.
Description
Keywords
Adaptace LLM, Adaptace slovníku, Czech WildBench, Instrukční ladění, Parametrově efektivní doladění, Pokračující předtrénování, Velký jazykový model, Zpracování přirozeného jazyka, Continued pretraining, Czech WildBench, Instruction tuning, LLM adaptation, Large Language Model (LLM), Natural Language Processing (NLP), Parameter-efficient fine-tuning, Vocabulary adaptation
Citation
Underlying research data set URL
Permanent link
Rights/License
Vysokoškolská závěrečná práce je dílo chráněné autorským zákonem. Je možné pořizovat z něj na své náklady a pro svoji osobní potřebu výpisy, opisy a rozmnoženiny. Jeho využití musí být v souladu s autorským zákonem v platném znění.
A university thesis is a work protected by the Copyright Act of the Czech Republic. Extracts, copies and transcripts of the thesis are allowed for personal use only and at one`s own expense. The use of thesis should be in compliance with the Copyright Act.
A university thesis is a work protected by the Copyright Act of the Czech Republic. Extracts, copies and transcripts of the thesis are allowed for personal use only and at one`s own expense. The use of thesis should be in compliance with the Copyright Act.