PhoGPT: Generative Pre-training for Vietnamese

Dat Quoc Nguyen, Linh The Nguyen, Chi Tran, Dung Ngoc Nguyen, Nhung Nguyen, Thien Huu Nguyen, Dinh Q. Phung, Hung Hai Bui · OpenReview

TL;DR

This paper introduces PhoGPT, a series of state-of-the-art 4-billion parameter generative language models specifically for Vietnamese. By pre-training on a massive Vietnamese corpus and fine-tuning for conversational tasks, PhoGPT-4B-Chat achieves competitive performance against larger models, addressing a significant gap in high-quality LLMs for the Vietnamese language.

What Problem Does This Paper Address?

The field of large language models (LLMs) has seen tremendous progress, with powerful models like GPT-4, LLaMA, and Mistral dominating research and applications. However, this progress has largely been concentrated in English. High-quality, open-source LLMs for other languages, particularly Vietnamese, have been scarce. This lack of resources hinders research and the development of practical applications for Vietnamese speakers. PhoGPT aims to bridge this gap by providing robust, pre-trained generative models for Vietnamese.

Methods

The authors developed two main models: PhoGPT-4B (the base pre-trained model) and PhoGPT-4B-Chat (the fine-tuned conversational model).

  • PhoGPT-4B: This is a 3.7B parameter decoder-only transformer model. It was pre-trained from scratch on a substantial Vietnamese corpus. Key architectural choices include using FlashAttention for efficient attention computation and ALiBi for extending the context length to 8192 tokens. A custom Vietnamese-specific byte-level BPE tokenizer with a vocabulary of 20480 tokens was employed.
  • PhoGPT-4B-Chat: This model is derived from PhoGPT-4B by fine-tuning it on a curated dataset designed for instruction following and conversational abilities. This dataset comprises instructional prompts and responses, as well as general conversations.

The training process leveraged the llm-foundry library for pre-training and standard practices for fine-tuning.

Datasets

  • Pre-training Dataset (PhoGPT-4B): A large, deduplicated, and cleaned Vietnamese corpus totaling 482GB (approximately 102 billion tokens). This corpus was assembled from various sources:
  • Vietnamese Wikipedia
    • Medical-related texts from public websites and journals
    • Publicly available books
    • Legal data from Vietnamese legal websites
    • The "binhvq" news corpus
    • Vietnamese subsets of OSCAR-2301 and mC4
  • Fine-tuning Dataset (PhoGPT-4B-Chat): A combination of approximately 70K instructional prompts/responses and 290K conversations. This includes:
  • Specific prompt-response pairs for tasks like poem writing, essay writing, spelling correction, summarization, and question answering.
  • Instructional prompt-response pairs from the Vietnamese subset of Bactrian-X.
  • Translated versions of ChatAlpaca, ShareGPT (excluding code/math), and UltraChat conversations.
  • Evaluation Dataset: The paper uses the ViTruthfulQA dataset, a Vietnamese truthful question-answering benchmark comprising 199 questions.

Key Insights and Ideas

  • The Power of Language-Specific Pre-training: By training a model from scratch on a massive Vietnamese corpus, PhoGPT-4B captures nuances and linguistic patterns specific to the language, which is crucial for high performance.
  • Bridging the LLM Divide: The release of PhoGPT directly addresses the underrepresentation of Vietnamese in the LLM landscape, democratizing access to advanced generative AI capabilities for Vietnamese speakers and researchers.
  • Effective Fine-tuning for Chat: The combination of instructional data and conversational data proves effective in transforming a base pre-trained model into a capable chatbot, demonstrating the importance of diverse fine-tuning strategies.
  • Competitive Performance with Smaller Models: PhoGPT-4B-Chat, at 4B parameters, shows strong performance, often outperforming larger open-source models and even competing with closed-source giants on specific Vietnamese-centric tasks.

Key Results

PhoGPT-4B-Chat demonstrates strong performance across various evaluations. Notably:

  • On the ViTruthfulQA dataset, PhoGPT-4B-Chat achieved an accuracy of 41.7% on all questions and 43.5% on Vietnam-specific questions.
  • It outperformed GPT-3.5-turbo and Gemini Pro 1.0 in accuracy on the ViTruthfulQA benchmark.
  • PhoGPT-4B-Chat achieved the highest accuracy among evaluated models for questions specifically related to Vietnam (147 out of 199 questions).
  • The models are available for use with popular libraries like transformers, vllm, and llama.cpp.

Limitations and Future Work

The authors acknowledge several limitations of PhoGPT:

  • Reasoning, Coding, and Mathematics: PhoGPT is not adept at tasks requiring complex reasoning, coding, or mathematical abilities.
  • Potential for Harmful Outputs: Like many LLMs, PhoGPT may generate harmful, hate speech, or biased responses, or answer unsafe questions. Users are advised to exercise caution.
  • Factual Inaccuracies: The model can produce factually incorrect output.

Future work would likely involve expanding the model size, incorporating more diverse training data, and improving its capabilities in areas like reasoning and coding. The authors hope that PhoGPT will foster further research and applications in Vietnamese NLP.

Summary updated

Abstract

We open-source a state-of-the-art 4B-parameter generative model series for Vietnamese, which includes the base pre-trained monolingual model PhoGPT-4B and its chat variant, PhoGPT-4B-Chat. The base model, PhoGPT-4B, with exactly 3.7B parameters, is pre-trained from scratch on a Vietnamese corpus of 102B tokens, with an 8192 context length, employing a vocabulary of 20480 token types. The chat variant, PhoGPT-4B-Chat, is the modeling output obtained by fine-tuning PhoGPT-4B on a dataset of 70K instructional prompts and their responses, along with an additional 290K conversations. We demonstrate its strong performance compared to previous closed-source and open-source 7B-parameter models. Our PhoGPT models are available at: https://github.com/VinAIResearch/PhoGPT
BibTeX
@misc{nguyen2023phogpt,
  author = {Dat Quoc Nguyen and Linh The Nguyen and Chi Tran and Dung Ngoc Nguyen and Nhung Nguyen and Thien Huu Nguyen and Dinh Q. Phung and Hung Hai Bui},
  title = {{PhoGPT: Generative Pre-training for Vietnamese}},
  year = {2023},
  eprint = {2311.02945},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.02945},
}
Figure