In this series: Trí tuệ nhân tạo
  1. 1 What Is a Vector Database? The Foundation of Semantic AI Search
  2. 2 What Is a Recommendation System? How TikTok and Shopee Suggest Products
  3. 3 What is an AI Agent? How Autonomous AI Agents Automate Complex Work
  4. 4 What Is Deepfake? How to Detect and Protect Yourself
  5. 5 What is Prompt Engineering? The Art of Giving AI Effective Instructions
  6. 6 What Is Fine-Tuning? Customizing AI Models for Enterprise Use
  7. 7 What is RAG? Retrieval-Augmented Generation — when AI knows how to look things up
  8. 8 What is Vietnam's AI Law? The Legal Framework for Artificial Intelligence (Updated 2026)
✦ Quick summary
What is fine-tuning? Learn how to customize AI models with your own data to create domain-specific AI that saves costs and improves accuracy.
How was this post?

Fine-tuning is the technique that lets enterprises transform a general-purpose large language model (LLM) into a domain expert tailored to their specific needs. Instead of building a model from scratch — which costs millions of dollars and months of compute time — you take a powerful foundation like LLaMA, Mistral, or Qwen and teach it with your own company's data.

What Is Fine-Tuning?

Fine-tuning is the process of continuing to train a pre-trained language model on a specialized dataset aligned with your domain. The base model has already learned language structure, reasoning patterns, and general world knowledge from billions of tokens of internet text — fine-tuning layers your organization's specific knowledge and style on top of that foundation.

Think of a recent university graduate: they arrive with broad knowledge, strong writing skills, and solid reasoning ability. You do not need to reteach them from scratch — you simply train them on your internal processes, industry terminology, and the way your organization operates. Fine-tuning works on exactly the same principle, applied to AI.

Technically, fine-tuning updates the model's weights by running additional gradient descent epochs on a smaller dataset with a much lower learning rate than the original pre-training phase. The result is a model that retains its general language capabilities while internalizing the new domain knowledge you have provided.

Why Fine-Tune Instead of Using the Base LLM?

There are four primary reasons enterprises choose fine-tuning over using a base model or relying solely on prompt engineering. Each addresses a distinct business problem that prompting or RAG alone cannot fully solve.

Domain knowledge: The base model has no awareness of your proprietary terminology, internal products, or company-specific processes. Fine-tuning embeds this knowledge directly into the model's weights — it answers correctly even without additional context supplied in the prompt every time.

Tone and style: Every brand has a distinct communication style — formal or casual, concise or detailed, with or without emojis. Fine-tuning trains the model to write in your brand voice consistently, achieving an output quality that prompt engineering alone struggles to maintain reliably over thousands of interactions.

Inference cost: A well-fine-tuned 7B model frequently outperforms GPT-4 on narrow domain-specific tasks. More importantly, inference costs for a small self-hosted model are 10–100x lower than GPT-4 API calls — a significant saving when processing millions of requests per month at scale.

Data privacy: When both training and inference run on-premise or within a private cloud, sensitive information never leaves your infrastructure. This is a non-negotiable requirement in finance, healthcare, and legal verticals where data sovereignty is mandated by regulation.

The Basic Fine-Tuning Workflow

A complete fine-tuning project typically follows five steps. Understanding each step helps you plan resources accurately and avoid the most common pitfalls.

Step 1 — Data collection and curation: Identify data sources that accurately reflect the task you want the model to handle. You need between 500 and 10,000 examples depending on task complexity. Quality outweighs quantity — 500 carefully reviewed examples outperform 5,000 raw samples.

Step 2 — Data formatting: Convert raw data into instruction-response pairs in the format the model expects. For example: {"instruction": "Summarize this email in two sentences", "input": "...", "output": "..."}. This step consumes the most time but has the largest influence on final model quality.

Step 3 — Training: Run the training loop with a small learning rate (typically 1e-4 to 1e-5), monitoring training loss and validation loss closely to detect overfitting early. With LoRA, a single A100 GPU is generally sufficient for a 7B-parameter model.

Step 4 — Evaluation: Measure perplexity on your validation set and apply task-specific metrics such as BLEU or ROUGE for summarization, or F1 for classification. Equally important is qualitative evaluation — have domain experts read model outputs and score them against a rubric.

Step 5 — Deployment: Export the fine-tuned model in the appropriate format (GGUF for llama.cpp, safetensors for Hugging Face), deploy to an inference server, and set up monitoring to detect model drift over time as your data distribution evolves.

Fine-Tuning Methods

Not all fine-tuning projects are alike — the right method depends on your GPU budget, model size, and how deeply you need the model to change.

Full fine-tuning updates every single weight in the model. It produces the highest quality results but demands significant GPU resources — a 7B model needs at least 4× A100 80GB GPUs, and a 70B model requires a much larger cluster. This approach is appropriate when deep behavioral change is required and the budget exists to support it.

LoRA (Low-Rank Adaptation) keeps the original weights frozen and trains only two small low-rank matrices inserted in parallel into each attention layer. Trainable parameters drop by 99%, GPU memory requirements fall by 10–100x, and results on most tasks are close to full fine-tuning at a fraction of the cost.

QLoRA combines LoRA with 4-bit quantization — the base model is compressed to 4-bit precision while the LoRA adapters are maintained at full precision. This technique makes it feasible to fine-tune a 7B model on a consumer GPU like an RTX 4090 with 24GB of VRAM, opening the door for small teams without server-grade hardware budgets.

PEFT (Parameter-Efficient Fine-Tuning) is Hugging Face's framework that unifies LoRA, Prefix Tuning, Prompt Tuning, and IA3 under a single Python library. It has become the de facto standard toolkit for implementing parameter-efficient fine-tuning across different model architectures.

Fine-Tuning vs Prompting vs RAG

These three techniques are not mutually exclusive alternatives — each solves a different problem and they are frequently combined in production architectures to maximize both accuracy and flexibility.

Prompting is the fastest approach: no training data required, no compute cost, immediate deployment. It is ideal for experimentation, tasks that do not require deep domain knowledge, or situations with limited budget. The limitation is dependency on the base model's built-in capabilities and the need to supply domain context in every prompt.

RAG (Retrieval-Augmented Generation) is ideal when your knowledge base changes frequently — new documents, updated product pricing, policies that evolve week to week. RAG fetches the relevant context for each query dynamically without retraining the model. The trade-off is dependency on retrieval quality and added latency per request.

Fine-tuning is the right choice when consistent accuracy on a specific domain is required, when output style must be stable, and when you have sufficient high-quality training data. The upfront cost is higher, but inference is significantly cheaper over the long run. The most powerful production architecture often combines both: a fine-tuned model paired with RAG — the model understands your domain while RAG keeps it current with the latest information.

Building a Vietnamese-Language Dataset

Creating a high-quality Vietnamese-language dataset is the single biggest challenge for fine-tuning projects targeting the Vietnamese market. Common data sources include customer service logs, product documentation, internal FAQ databases, contracts, and business email archives.

Cleaning Vietnamese text requires attention to several language-specific issues: deduplication, removal of personally identifiable information (PII) such as customer names and phone numbers, correction of UTF-8 encoding errors common in legacy data systems, and normalization of Vietnamese tone marks (some older systems store tone marks as separate combining characters rather than precomposed forms). Skipping this step teaches the model incorrect patterns that are very difficult to unlearn later.

Annotation is an unavoidable step: every instruction-response pair needs review by a domain expert. For 500 examples, a full-time expert can complete the review in approximately one week. At minimum 500 high-quality examples are needed to observe meaningful improvement; the ideal range for reliable domain adaptation is 2,000–10,000 examples covering a diverse set of scenarios and edge cases.

Costs and Timelines

Fine-tuning has become financially accessible to organizations of all sizes thanks to parameter-efficient methods. The following are realistic estimates for the most common enterprise scenarios.

LoRA on a 7B model with 2,000 examples: Renting an A100 GPU on a cloud provider such as Lambda or RunPod costs approximately $2–3 per hour; training typically completes in about 4 hours, for a total compute cost of roughly $8–12. Including time for data preparation and evaluation, a full project takes approximately 2–4 person-weeks.

GPT-3.5 Turbo fine-tuning via OpenAI API: Approximately $0.008 per 1K training tokens; 2,000 examples averaging 200 tokens per pair costs about $3–8 for the training run itself. The advantage is zero GPU management overhead; the trade-off is that your data leaves your infrastructure and inference still depends on the OpenAI API.

Monthly inference cost comparison: A self-hosted 7B model on a cloud A10G GPU costs roughly $30–50 per month and can serve tens of thousands of requests; GPT-4 API at equivalent traffic volumes costs $500–2,000 per month — a 10–50x cost reduction. The break-even point versus fine-tuning investment typically arrives within 2–3 months of production operation.

Enterprise Use Cases

Fine-tuning delivers clear, measurable business value across a wide range of industry verticals. The following three applications represent well-proven patterns that have been successfully deployed in production environments.

Customer service chatbot: Fine-tuned on 3,000 real conversation logs from a customer support team, the model learns to handle the most common complaint scenarios, return and refund policies, and the brand's friendly communication style. Deployments of this kind typically reduce frontline support workload by 50–60% during peak hours while maintaining a consistent customer experience.

Legal document summarizer: A model fine-tuned on thousands of Vietnamese contracts and regulatory texts can identify and summarize high-risk clauses in seconds. The critical advantage is that the model understands domain-specific Vietnamese legal terminology — force majeure clauses, penalty provisions, warranty obligations — which general-purpose models frequently misinterpret or oversimplify.

Brand voice copywriter: An e-commerce company that fine-tuned a model on 10,000 approved product descriptions written by its marketing team found that the resulting model produces on-brand descriptions that require minimal editing. This translates to a 5–8x productivity increase for the content team compared to using a general-purpose model with prompting alone.

Conclusion

Fine-tuning has moved well beyond the realm of big-tech research labs. Today, a small team with a consumer GPU and a few hundred quality examples can build a domain-specific AI that outperforms GPT-4 on their particular task. The emergence of LoRA, QLoRA, and the broader PEFT ecosystem has dramatically lowered both the technical and financial barriers to entry.

The key is knowing when to fine-tune: if prompting delivers good enough results, do not invest in fine-tuning; if your knowledge base updates constantly, RAG may be a better fit. Fine-tuning truly excels when you need consistent accuracy on a well-defined domain, have sufficient high-quality data, and want to optimize long-term inference costs at scale.

The recommended starting point for enterprises is to start small — gather your best 500 examples from existing data, run a LoRA experiment on a 7B model, and measure results before committing to a larger investment. Your proprietary data is a competitive advantage; fine-tuning is the mechanism that turns that advantage into an AI model that is genuinely your own.

What Is an AI Agent? What Is a Vector Database? What Is GPU Cloud?