Skip to main content

VietQuill: An Open-Source Toolkit for Vietnamese Paraphrasing

Project description

An Open-Source Toolkit for Vietnamese Paraphrasing

An Open-Source Toolkit for Vietnamese Paraphrasing

PyPI Python License

Vietnamese Task Models

English | Tiếng Việt

VietQuill is a unified framework for controllable Vietnamese paraphrase generation and quality estimation, supporting both research and production applications.

It centralizes datasets, generation methods, augmentation techniques, and evaluation metrics into a consistent interface, enabling researchers and practitioners to develop, benchmark, and deploy paraphrase systems with minimal effort. VietQuill aims to serve as a common foundation for the Vietnamese paraphrase generation ecosystem, promoting reproducible research, standardized evaluation, and the development of high-quality paraphrase technologies for education, information retrieval, question answering, conversational AI, and other natural language processing applications.

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 AutoModelForControllableParaphraseGeneration for fine-grained control over lexical, semantic, and syntactic attributes.

from vietquill import AutoModelForControllableParaphraseGeneration

model = AutoModelForControllableParaphraseGeneration()
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 AutoModelForControllableParaphraseGeneration

model = AutoModelForControllableParaphraseGeneration()
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 AutoModelForControllableParaphraseGeneration

model = AutoModelForControllableParaphraseGeneration()
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 AutoModelForControllableParaphraseGeneration

model = AutoModelForControllableParaphraseGeneration()
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 AutoModelForControllableParaphraseGeneration, ParaphraseStyle

model = AutoModelForControllableParaphraseGeneration()
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 AutoModelForParaphraseQualityEstimation

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 = AutoModelForParaphraseQualityEstimation()
result = estimator.estimate(original, paraphrase)
print(result)
# >>> {'lexical_score': 24.48, 'syntactic_score': 78.26, 'semantic_score': 64.2}

Model list

Model Architecture Size
ngwgsang/vietquill-vit5-base-tsubaki T5-base (~440M parameters) 4.19 GB*
ngwgsang/vietquill-velectra-estimator-tsubaki vELECTRA-base (~220M parameters) 1.64 GB*
  • Each Hub repository bundles both sentence and question variants in a single model package.

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.

Citation

Please CITE our paper when VietQuill is used to help produce published results or is incorporated into other software.

@software{sang2026vietquill,
  author = {Sang Quang Nguyen and Kiet Van Nguyen},
  title = {VietQuill: An Open-Source Toolkit for Vietnamese Paraphrasing},
  year = {2026},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/ngwgsang/vietquill}}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vietquill-0.3.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vietquill-0.3.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file vietquill-0.3.0.tar.gz.

File metadata

  • Download URL: vietquill-0.3.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for vietquill-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba958231d536ae859161704dc7ff8bfd1dea0b62f77a89450a42240c8874f9dc
MD5 0fa5865fda8603a28cad5cb9e430a9b7
BLAKE2b-256 719459338e48d863f41d972068b9536c67c5c8573177ac3db2ccf2853048b0a6

See more details on using hashes here.

File details

Details for the file vietquill-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: vietquill-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for vietquill-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca23ee7a383e6a0bc71401356427b6ce8e659f40cafd24563cfa0eb54c5a699c
MD5 485bc7c4de6e03204dca1f784aa9c82d
BLAKE2b-256 b2e5864dd983bd8b4ee68723607efb4ed9da80c4ba85bb952dd99bf77dd9354e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page