RAG and fine-tuning
LLM Fine-Tuning & RAG Solutions
RAG development services connect a language model to your own documents and data, so answers are current, permission-aware and traceable to a source. TekFrost builds retrieval pipelines, vector search and reranking, adds LoRA or QLoRA fine-tuning where evaluation justifies it, and measures every change.

RAG or fine-tuning: how to decide
The two techniques solve different problems. Retrieval-augmented generation fetches relevant passages at question time and supplies them to the model. It is the right tool when knowledge changes, when answers must cite sources and when users have different access rights. Fine-tuning adjusts model weights using examples. It suits stable behavior: a house style, a structured output format, domain vocabulary or a classification task.
Many teams reach for fine-tuning to teach a model facts, and are disappointed. Facts are better retrieved. Our rule is to build the retrieval baseline first, measure it, and fine-tune only for the gaps the measurements expose.
| Need | Best first choice | Why |
|---|---|---|
| Answers from changing policies and documents | RAG | Update the index, not the model |
| Citations and audit trail | RAG | Every answer links to retrieved passages |
| Consistent tone, format or schema | Fine-tuning | Behavior is learned from examples |
| Cheaper, faster small model for a narrow task | Fine-tuning | A tuned small model can match a larger one on that task |
| Per-user document permissions | RAG | Filter retrieval by access rights |
How a retrieval pipeline is built
Quality in RAG is decided mostly before the model sees anything. We start with ingestion: parsing PDFs, scanned files, tables, slide decks and wiki pages, and keeping the structure that gives text meaning. Chunking then splits content into passages sized to the question types, with overlap and metadata such as title, date, owner and access group.
Retrieval combines vector search with keyword search, since exact terms such as part numbers or clause references are poorly served by embeddings alone. A reranker orders the candidates, and the model receives only the best passages. We also handle query rewriting, multi-document questions and the case where no good answer exists, in which the system should say so.
- Hybrid search over a vector database and a lexical index.
- Cross-encoder reranking and metadata filters for permissions and recency.
- Citations that point to the exact passage and page.
- Incremental re-indexing so new documents appear without full rebuilds.
What you get
- Corpus audit and ingestion plan
- Parsing and chunking pipeline
- Vector database and hybrid search setup
- Reranking and metadata filter configuration
- Retrieval and answer evaluation sets
- Fine-tuning dataset and LoRA or QLoRA adapters, where justified
- Permission-aware access layer
- Index refresh and monitoring jobs
- Technical documentation and handover session
Fine-tuning with LoRA and QLoRA
Parameter-efficient methods such as LoRA and QLoRA train small adapter layers instead of the whole model, which cuts GPU memory and time and lets you keep several task-specific adapters over one base model. We prepare training data from your approved examples, hold out a test set, tune hyperparameters and compare the result with the untuned baseline plus a well-prompted larger model.
Training data is the main cost and risk. It needs consistent labeling, removal of sensitive fields and a record of its origin. Where the work runs on your own hardware, it fits with our AI infrastructure and GPU cluster service.
Evaluation and cost factors
We evaluate retrieval and generation separately. Retrieval is judged on whether the right passages appear in the top results. Generation is judged on faithfulness to those passages, completeness and format. Both use a question set built with your experts, and results are tracked through MLOps and LLMOps pipelines.
Cost drivers are the volume and messiness of source content, the number of source systems and permission models, the language mix, the evaluation effort and, for fine-tuning, labeled data preparation and GPU time. Vector storage and embedding costs are usually modest next to document preparation work.
How to choose a RAG partner
Ask for retrieval metrics, not only demo answers. Ask how permissions are enforced at retrieval time, how stale documents are handled and what happens on questions the corpus cannot answer. A good partner will show their chunking experiments and will hesitate to fine-tune before a baseline exists.
Outcomes you can expect
Answers from current sources
Policy and product changes reach users when the index updates, with no retraining.
Verifiable responses
Citations let reviewers confirm an answer in seconds.
Right-sized models
Evaluation shows where a smaller tuned model can replace a larger and costlier one.
Respected access rights
Users only receive content they are already permitted to read.
Where it applies
Caseworkers query legislation, circulars and internal guidance in a private deployment, with each answer citing the clause.
Field engineers search maintenance manuals and incident histories, with documents filtered by site and equipment type.
An air-gapped retrieval system lets analysts search classified-network documents without any external call.
Compliance staff ask questions across policies and regulator guidance, and receive passages with version and date.
Ways to engage
Fixed-scope RAG build
One corpus and one user group delivered with an evaluation set, a defined quality target and a handover.
Retrieval and tuning squad
Engineers and an evaluation lead work through a backlog of corpora and use cases, including adapter training.
Managed knowledge platform
We run ingestion, refresh, monitoring and quality reviews, and onboard new content sources on request.
Tools, standards and platforms
Process
How we deliver, step by step
- 01
Audit the content
We inventory sources, formats, owners, access rules and freshness, and sample questions users actually ask.
- 02
Build the baseline
A first ingestion and retrieval pipeline goes live in a test environment, with an evaluation set built alongside it.
- 03
Tune retrieval
We vary chunking, embeddings, hybrid weighting and reranking, keeping the changes that improve measured results.
- 04
Decide on fine-tuning
Remaining gaps are reviewed. If format, tone or a narrow task still fails, we prepare data and train adapters.
- 05
Harden and operate
Access controls, refresh jobs, monitoring and drift alerts are added before the system reaches users.
FAQ
Frequently asked questions
What is RAG?
Retrieval-augmented generation finds passages relevant to a question in your documents and supplies them to a language model as context, so the answer is grounded in your content. It keeps responses current, enables citations and lets you control who can see which documents, without retraining the model.
When should we fine-tune instead of using RAG?
Fine-tune when the gap is behavior, not knowledge: a required output schema, a consistent voice, specialist terminology or a narrow classification that a smaller model could do cheaply. If the model lacks facts, retrieval is the better answer. Many systems use both.
Which vector database should we use?
It depends on scale, existing skills and operations model. PostgreSQL with pgvector is often enough for moderate volumes and keeps the stack simple. Milvus, Qdrant or OpenSearch suit larger or higher-throughput needs. We test options against your data and favor what your team can operate.
How do you handle documents with different access rights?
Each chunk is indexed with the access groups of its source, and retrieval filters on the requesting user's identity before anything reaches the model. This avoids a common failure where a shared index exposes restricted content. We test it with scenarios that try to cross permission boundaries.
How much data is needed to fine-tune a model?
For parameter-efficient tuning on a narrow task, quality matters more than volume: hundreds to a few thousand carefully labeled examples can be enough, while broader behavior needs more. We start small, measure against a held-out set and add data only where results show the need.
Can RAG run entirely on-premises?
Yes. The embedding model, vector database, reranker and language model can all run on your own servers, including in air-gapped environments. Capacity planning for GPUs and a plan for offline model and index updates are the main additional considerations.
Keep exploring