Skip to main content

VietQuill: A Toolkit for Quality-Controlled Vietnamese Paraphrase Generation

A Toolkit for Quality-Controlled Vietnamese Paraphrase Generation & Evaluation

VietQuill Documentation

PyPI Python License Language Task Models IEEE Xplore

English | Tiếng Việt | 简体中文 | 日本語 | Français

This is the official source code accompanying our research work, VietQuill: Quality-Controlled Paraphrase Generation for Vietnamese Language, published at MAPR 2026.

We provide a unified framework for controllable Vietnamese paraphrase generation and quality estimation, integrating datasets, generation methods, augmentation techniques, and evaluation metrics into a consistent interface. VietQuill is designed to support reproducible research and practical development of high-quality Vietnamese paraphrase systems.

We are committed to advancing Vietnamese paraphrase generation by making state-of-the-art methods accessible, customizable, and easy to integrate into real-world workflows.


Installation

Create and activate a virtual environment with venv and project manager.

python -m venv .\venv

Install VietQuill in your virtual environment.

pip install vietquill

Quickstart

Paraphrase Generate

Using EnsembleModelForParaphraseGeneration for fine-grained control over lexical, semantic, and syntactic attributes.

from vietquill import EnsembleModelForParaphraseGeneration

model = EnsembleModelForParaphraseGeneration()
result = model.paraphrase("Hôm nay trời đẹp quá, mình muốn đi dạo công viên.")
print(result)
# >>> ['Hôm nay trời đẹp, tôi muốn đi dạo công viên.']

Generate multiple paraphrase candidates using the num_candidates parameter.

from vietquill import EnsembleModelForParaphraseGeneration

model = EnsembleModelForParaphraseGeneration()
result = model.paraphrase("Thủ đô của nước Pháp là thành phố nào?", num_candidates=3)
print(result)
# >>> ['Nước Pháp có thủ đô là thành phố nào?', 'Nước Pháp có thủ đô là thành phố tên gì?', 'Nước Pháp có thủ đô là thành phố tên là gì?']

If you have multiple sentences and want to leverage the power of GPU acceleration, you should use paraphrases for batch generation:

from vietquill import EnsembleModelForParaphraseGeneration

model = EnsembleModelForParaphraseGeneration()
sentences = [
    "Hôm nay trời đẹp quá, mình muốn đi dạo công viên.",
    "Thủ đô của nước Pháp là thành phố nào?",
    # ... many sentences here ...
]

# Generate paraphrases in batch
results = model.paraphrases(sentences)
print(results)
# >>> [['Hôm nay trời đẹp, tôi muốn đi dạo công viên.'], ['Nước Pháp có thủ đô là thành phố nào?']]

Using lexical, syntactic, semantic for tunning paraphrase quality and diversity.

from vietquill import EnsembleModelForParaphraseGeneration

model = EnsembleModelForParaphraseGeneration()
sentence = "Tôi rất thích ăn phở vào buổi sáng và uống một cốc cà phê nóng."

# Generate with specific control levels
paraphrase = model.paraphrase(sentence, lexical=90, syntactic=70, semantic=70, num_candidates=2)
print(paraphrase)
# >>> ['Bữa sáng tôi ăn phở, uống một cốc cà phê nóng.', 'Bữa sáng tôi ăn phở và một cốc cà phê nóng.']

Alternatively, you can use predefined style presets using the ParaphraseStyle enum (or pass the style name as a string):

from vietquill import EnsembleModelForParaphraseGeneration, ParaphraseStyle

model = EnsembleModelForParaphraseGeneration()
sentence = "Mỗi ngày, có bao nhiêu người Việt Nam sử dụng mạng xã hội?"

# Generate with CONSERVATIVE
paraphrase = model.paraphrase(sentence, style=ParaphraseStyle.CONSERVATIVE)
print(paraphrase)
# >>> ['Mỗi ngày có bao nhiêu người Việt Nam sử dụng mạng xã hội?']

# Generate with BALANCED
paraphrase = model.paraphrase(sentence, style=ParaphraseStyle.BALANCED)
print(paraphrase)
# >>> ['Số lượng người Việt Nam sử dụng mạng xã hội mỗi ngày là bao nhiêu?']

# Generate with DIVERSE
paraphrase = model.paraphrase(sentence, style=ParaphraseStyle.DIVERSE)
print(paraphrase)
# >>> ['Có bao nhiêu người Việt Nam sử dụng mạng xã hội mỗi ngày?']

Paraphrase Evaluate

Evaluate the quality of generated paraphrases using various metrics and estimators.

from vietquill.evaluation import BLEUMetric, LexicalEstimator
original = "Hôm nay trời đẹp quá."
paraphrase = "Hôm nay trời đẹp ghê."
metric = BLEUMetric()
result = metric.score(original, paraphrase)
print(result)
# >>> 0.668740304976422
from vietquill.evaluation import LexicalEstimator
original = "Hôm nay trời đẹp quá."
paraphrase = "Hôm nay trời đẹp ghê."
lex_est = LexicalEstimator()
result = lex_est.estimate(original, paraphrase)
print(result)
# >>> {'lexical_score': 66.67}
from vietquill import EnsembleModelForParaphraseQualityEstimation

original = "Hôm nay trời đẹp quá, mình muốn đi dạo công viên."
paraphrase = "Thời tiết hôm nay thật tuyệt, tôi muốn tản bộ trong công viên."

estimator = EnsembleModelForParaphraseQualityEstimation()
result = estimator.estimate(original, paraphrase)
print(result)
# >>> {'lexical_score': 24.48, 'syntactic_score': 78.26, 'semantic_score': 64.2}

Model list

VietQuill supports two types of model loaders:

  • EnsembleModel: Loads multiple checkpoints with automatic routing between sentence and question models.
  • AutoModel: Loads a single checkpoint directly from the repository root without routing.

Official Checkpoints

The official checkpoints on Hugging Face are categorized into two series based on training data:

Tsubaki Series

Trained on public research datasets (ViSP for sentences, ViQP for questions). Ideal for standard sentence rewriting, research benchmarks, and question variations:

Model Class Size
ngwgsang/vietquill-vit5-base-tsubaki EnsembleModelForParaphraseGeneration 4.19 GB*
ngwgsang/vietquill-velectra-estimator-tsubaki EnsembleModelForParaphraseQualityEstimation 1.64 GB*
ngwgsang/vietquill-vit5-base-sentence-tsubaki AutoModelForParaphraseGeneration 2.09 GB
ngwgsang/vietquill-vit5-base-question-tsubaki AutoModelForParaphraseGeneration 2.09 GB

Ume Series

Trained on 100K synthesized data featuring longer, more structurally complex, and diverse sentences (ngwgsang/vietquill-qcpg-100k-synthesis-sentence for sentences, ngwgsang/vietquill-qcpg-100k-synthesis-question for questions):

Model Class Size
ngwgsang/vietquill-vit5-base-ume EnsembleModelForParaphraseGeneration 4.19 GB*
ngwgsang/vietquill-vit5-base-sentence-ume AutoModelForParaphraseGeneration 2.09 GB
ngwgsang/vietquill-vit5-base-question-ume AutoModelForParaphraseGeneration 2.09 GB

* Each official ensemble Hub repository bundles both sentence and question subfolders in a single package.

Note: For more information about each model, please refer to Models & Checkpoints.

Extensions

Fewshot Paraphrase Generation [LLM]

In addition to pretrained checkpoints, VietQuill provides FewshotModelForControllableParaphraseGeneration using the Mimic paradigm. This allows you to leverage modern LLMs (GPT-4o, Claude, Qwen, Llama, DeepSeek) through OpenAI SDK or OpenRouter and define custom control dimensions (e.g., formality, technicality, conciseness) inferred from few-shot demonstrations:

from openai import OpenAI
from vietquill import (
    FewshotModelForControllableParaphraseGeneration,
    Mimic,
    MimicControl,
    MimicExample,
)

# Initialize client & generator (reads OPENAI_API_KEY from environment)
client = OpenAI()
generator = FewshotModelForControllableParaphraseGeneration(
    client=client, model="gpt-4o-mini"
)

# Define custom control axes and transformation demonstrations
mimic = Mimic(
    intent="Chuyển đổi câu văn giao tiếp sang phong cách học thuật, trang trọng.",
    controls=[
        MimicControl(name="formality", description="Mức độ trang trọng (low, high)"),
        MimicControl(name="conciseness", description="Độ ngắn gọn súc tích (low, high)"),
    ],
    examples=[
        MimicExample(
            input_text="Mô hình này chạy khá tốt.",
            output_text="Mô hình đề xuất đạt hiệu năng tương đối khả quan.",
            controls={"formality": "high", "conciseness": "high"},
        ),
    ],
)

# Generate with target controls
result = generator.paraphrase(
    mimic=mimic,
    input_text="Mấy thuật toán này chạy chậm quá, phải sửa lại code.",
    output_control={"formality": "high", "conciseness": "high"},
)

print(result)
# >>> "Các thuật toán này hoạt động với hiệu suất không tối ưu, cần phải điều chỉnh mã nguồn."

Why should I use VietQuill?

VietQuill is designed to be the most comprehensive and effective toolkit for Vietnamese paraphrase generation and evaluation. Here is why you should choose it:

  • Seamless Integration: Designed with a clean and intuitive API, allowing VietQuill to be easily integrated into existing NLP workflows, research pipelines, and production systems.
  • State-of-the-Art Paraphrase Generation: Built upon strong Vietnamese language models and quality-controlled generation techniques to deliver high-quality, diverse, and semantically faithful paraphrases.

Star History

Star History Chart

Acknowledgements

We sincerely thank the Vietnamese NLP community for their continuous support and valuable contributions. We also gratefully acknowledge the support of the University of Information Technology (UIT), Vietnam National University Ho Chi Minh City (VNU-HCM), which has made the development of VietQuill possible.

This research is funded by University of Information Technology - Vietnam National University Ho Chi Minh City under grant number D4-2025-05.

Citation

VietQuill builds upon our previous research projects, ViQP and ViSP, extending them into a unified toolkit for Vietnamese paraphrase generation and quality estimation. If VietQuill contributes to your research or software, please cite it using the following reference.

@inproceedings{nguyen2023viqp,
  title={Viqp: Dataset for vietnamese question paraphrasing},
  author={Nguyen, Sang Quang and Vo, Thuc Dinh and Nguyen, Duc PA and Tran, Dang T and Van Nguyen, Kiet},
  booktitle={2023 International Conference on Multimedia Analysis and Pattern Recognition (MAPR)},
  pages={1--6},
  year={2023},
  organization={IEEE}
}

@inproceedings{nguyen2025visp,
    title = "A Large-Scale Benchmark for {V}ietnamese Sentence Paraphrases",
    author = "Nguyen, Sang Quang  and
      Nguyen, Kiet Van",
    editor = "Chiruzzo, Luis  and
      Ritter, Alan  and
      Wang, Lu",
    booktitle = "Findings of the Association for Computational Linguistics: NAACL 2025",
    month = apr,
    year = "2025",
    address = "Albuquerque, New Mexico",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.findings-naacl.59/",
    doi = "10.18653/v1/2025.findings-naacl.59",
    pages = "1045--1060",
    ISBN = "979-8-89176-195-7",
    abstract = "This paper presents ViSP, a high-quality Vietnamese dataset for sentence paraphrasing, consisting of 1.2M original{--}paraphrase pairs collected from various domains. The dataset was constructed using a hybrid approach that combines automatic paraphrase generation with manual evaluation to ensure high quality. We conducted experiments using methods such as back-translation, EDA, and baseline models like BART and T5, as well as large language models (LLMs), including GPT-4o, Gemini-1.5, Aya, Qwen-2.5, and Meta-Llama-3.1 variants. To the best of our knowledge, this is the first large-scale study on Vietnamese paraphrasing. We hope that our dataset and findings will serve as a valuable foundation for future research and applications in Vietnamese paraphrase tasks. The dataset is available for research purposes at \url{https://github.com/ngwgsang/ViSP}."
}

@inproceedings{nguyen2026vietquill,
  author={Nguyen, Sang Quang and Van Nguyen, Kiet},
  booktitle={2026 International Conference on Multimedia Analysis and Pattern Recognition (MAPR)}, 
  title={VietQuill: Quality-Controlled Paraphrase Generation for Vietnamese Language}, 
  year={2026},
  volume={},
  number={},
  pages={61-66},
  keywords={Modeling;Computational linguistics;Syntactics;Conferences;Manuals;Printing;Training;Estimation;Measurement;Equations;Paraphrase Generation;Controllable Generation;Quality-Aware Modeling;Vietnamese NLP;Low-Resource NLP},
  doi={10.1109/MAPR72750.2026.11685721}
}

Metadata

Release files for vietquill 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vietquill 2.0.1
File Size Uploaded
vietquill-2.0.1.tar.gz 34.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vietquill 2.0.1
File Interpreter ABI Platform
vietquill-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 69.3 kB

Release files / vietquill-2.0.1.tar.gz

Download URL vietquill-2.0.1.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
257ea10e411879403bb11cf7bf801536eebf90262ea027801ea868cb1094167e
BLAKE2b-256 checksum
How to use checksums
d0fee788aa4cf8324769fc32964a6c538150c11d7c74342d0b55f989a8f52373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / vietquill-2.0.1-py3-none-any.whl

Download URL vietquill-2.0.1-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79c6b34474074c28a89aae8676b72283b717383a989197189c31ba290c91b17f
BLAKE2b-256 checksum
How to use checksums
33d9523114674dfe98dfcd0bb2cf65bac191919eb89b55b89b02d920f9b8b281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.2

2 release files

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page