Optimizing Long-Form Text Generation Using LLaMA Model
摘要
Large language models (LLMs) based on transformer architectures are increasingly being used to generate extended scientific text that reads fluently and remains factually sound. In this paper, we adapt the LLaMA-2-7B model by fine-tuning it on two complementary datasets: mlabonne/guanaco-llama2-1k and a filtered version of wikitext-2-raw-v1 containing science-related content. This training setup is intended to reduce problems such as factual errors and hallucinated information that often appear in automatically generated text. To guide the model more effectively, we combine structured prompts with targeted fine-tuning, which together improve the clarity and reliability of the output. We evaluate the system using several widely accepted metrics, including Perplexity for fluency, ROUGE-L for structure, BERTScore for semantic quality, BLEU for wording accuracy, and measures of factual consistency. Our experiments show that the adapted model can produce scientific writing that is both clearer and more dependable, making it a useful aid for tasks such as drafting research material, producing educational resources, and summarizing academic content.