In Confluence, 1200 pages, fifty authors—nobody remembers where the VPN instruction is. Employees spend an average of 20 minutes searching, and often just ask in chats. Keyword search returns a list of articles without context. RAG changes this: you ask a question and get an answer with citations in 10 seconds. We've been building such systems for over 5 years and deployed 15+ projects. Our proven methodology and guarantee of at least 80% accuracy ensure reliable performance. Average savings were $1,500 per month, with a 4-month payback. For one client, savings reached $15,000 per year by reducing engineer search time. Typical project cost ranges from $5,000 to $15,000, fully recouped within months.
How semantic search works
Our AI document search solution uses LlamaIndex with Qdrant as the vector store (HNSW index for ANN search, cosine similarity metric) and HuggingFace embedding model. Documents are split into chunks, vectorized, and stored in a vector DB. On query, semantically close chunks are retrieved via approximate nearest neighbor (ANN), reranked by a cross-encoder model, and an LLM generates the final answer with citations. For Russian-English bases, we use multilingual-e5-large (1024d)—it outperforms BGE-small by 1.15x in recall. Key code snippet:
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.retrievers import VectorIndexRetriever
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.core.postprocessor import SentenceTransformerRerank
from llama_index.vector_stores.qdrant import QdrantVectorStore
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
import qdrant_client
embed_model = HuggingFaceEmbedding(
model_name="intfloat/multilingual-e5-large",
embed_batch_size=32
)
splitter = SentenceSplitter(
chunk_size=512,
chunk_overlap=64,
paragraph_separator="\n\n"
)
reranker = SentenceTransformerRerank(
model="cross-encoder/ms-marco-MiniLM-L-6-v2",
top_n=5
)
client = qdrant_client.QdrantClient(url="http://localhost:6333")
vector_store = QdrantVectorStore(client=client, collection_name="kb_docs")
index = VectorStoreIndex.from_vector_store(
vector_store=vector_store,
embed_model=embed_model
)
query_engine = RetrieverQueryEngine(
retriever=VectorIndexRetriever(index=index, similarity_top_k=15),
node_postprocessors=[reranker],
)
Why parent-child chunking is necessary
Documentation is hierarchical: section, subsection, paragraph. Naive chunking at 512 tokens cuts logical blocks. Solution—parent-child chunking: small chunks for retrieval, large ones for context. This improves faithfulness by 1.12x and relevance by 1.18x over flat chunking.
| Parameter |
Flat chunking |
Parent-child chunking |
| Faithfulness (RAGAS) |
0.68 |
0.76 |
| Relevance (RAGAS) |
0.72 |
0.85 |
How to set up incremental updates
Key steps to configure a RAG pipeline for intelligent search
- Collect all sources (Confluence, Notion, Google Docs) for knowledge base search.
- Choose an embedding model (multilingual-e5-large for Russian+English) as your AI document search model.
- Set up parent-child chunking with parent=1024 tokens, child=256.
- Deploy a vector DB (Qdrant or pgvector) with HNSW index.
- Implement an automatic indexing pipeline with incremental update through API.
- Connect a reranker (cross-encoder) to improve accuracy.
- Integrate an LLM (GPT-4o or Claude) for answer generation, creating a documentation chatbot.
class DocumentationIndexer:
def __init__(self, confluence_client, vector_store):
self.confluence = confluence_client
self.index = vector_store
self.last_indexed = {}
async def incremental_update(self):
all_pages = self.confluence.get_all_pages(space_key="KB")
for page in all_pages:
page_id = page["id"]
modified = page["version"]["when"]
if self.last_indexed.get(page_id) == modified:
continue
self.index.delete(filter={"page_id": page_id})
content = self.confluence.get_page_body(page_id)
nodes = self._parse_and_chunk(content, page)
self.index.add(nodes)
self.last_indexed[page_id] = modified
return {"updated": len([p for p in all_pages if self.last_indexed.get(p["id"]) != p["version"]["when"]])}
Incremental updates run every hour, ensuring freshness without re-indexing the entire corpus.
Process
| Stage |
Duration |
What we do |
Result |
| Analysis |
1–2 days |
Analyze documentation structure, document types, query frequency |
Technical specification and prototype on 10–20 documents |
| Design |
2–3 days |
Select embedding model, vector database, chunking scheme |
Solution architecture document |
| Implementation |
1–4 weeks |
Develop automatic indexing pipeline, configure retriever and LLM, integrate with Confluence AI and Notion AI via API, add documentation chatbot interface |
Working system on test set |
| Testing |
3–5 days |
Evaluate using RAGAS (faithfulness, relevance, precision), conduct A/B test |
Report with metrics and recommendations |
| Deployment |
2–3 days |
Deploy on client infrastructure, set up CI/CD |
Production environment, admin documentation |
What's included
- Solution architecture document with model and vector database choices.
- Automatic indexing pipeline with parent-child chunking and incremental updates.
- Integration with Confluence, Notion, or Google Docs via API for AI document search.
- Slack bot or web interface for queries with source citations (documentation chatbot).
- Admin panel for monitoring queries and metrics (RAGAS faithfulness, relevance).
- Admin documentation and team training (2 hours).
- Support for 1 month after launch.
- Guaranteed accuracy of at least 80% on internal documentation.
Typical mistakes
- Ignoring document hierarchy. Parent-child chunking is mandatory—otherwise you lose up to 18% relevance.
- Infrequent index updates. Set up an incremental pipeline every hour.
- Choosing a weak embedding model. For Russian-English documentation, multilingual-e5-large (1024d) or BGE-M3 is the minimum. BGE-small loses 15% recall.
- No reranker. Without cross-encoder, top-3 accuracy drops by 10–20%.
- Neglecting security. Set up prompt injection filtering and query auditing.
Case: IT company, 200 employees, 1200 articles. Average response time 1.4 sec, accuracy 82%. Repeated questions in #general dropped by 43% in the first month. Project paid back in 4 months—average savings $12,000 per year.
Contact us to evaluate your project. Get a consultation on deploying RAG search on your data. Request demo access to a ready system on a test document set. Our team guarantees system performance and reliability based on 5+ years of proven experience.
LLM Development: Fine-Tuning, RAG, Agents, and Production Deployment
Using GPT‑4 or Claude 3.5 Sonnet through a public API is not a solution — it's just a tool. When the requirement is to "make it like ChatGPT, but on our data," there is a real engineering challenge behind it: from prompt engineering to training a 70B model on your own infrastructure. End-to-end LLM solution development is a complex stack, and we have been doing it for over 5 years. During this time, we have completed over 20 projects in generative AI: from RAG systems for legal departments to custom support agents. Where exactly your task falls depends on data, latency requirements, budget, and how critical confidentiality is.
A typical situation: the client has already tried ChatGPT, but results are unstable — sometimes accurate, sometimes hallucinating. Or they need integration into a corporate portal while complying with security policies. Let's break down each layer of the stack in detail — from RAG to production deployment.
Why Do RAG Systems Break and How to Fix It?
RAG (Retrieval-Augmented Generation) looks simple: find relevant documents, put them in context, get an answer. In practice, it fails in several places.
Chunking without overlap. Classic mistake: chunk_size=512, overlap=0. If the answer lies across two chunks, retrieval won't find either with sufficient confidence. Solution: overlap 15–25% of chunk_size, or better yet, sentence-aware splitting with spaCy or NLTK instead of naive character splitting.
Poor embedder. text-embedding-ada-002 is good for general use, but on legal or medical texts, specialized models like E5-large-v2, BGE-M3, or fine-tuned sentence-transformers on domain data outperform it. Recall@5 differences can be 15–25%.
No re-ranking. Vector search optimizes for speed, not relevance. A cross-encoder re-ranker (ms-marco-MiniLM-L-6-v2, bge-reranker-large) after initial retrieval improves top-3 accuracy with acceptable latency (+50–150ms). This is often more impactful than improving the embedding model.
Hybrid search. Dense vectors alone work poorly on exact queries: names, SKUs, codes. BM25 (sparse) finds exact matches but misses semantics. Hybrid via RRF (Reciprocal Rank Fusion) is the optimal compromise. Qdrant, Weaviate, and pgvector 0.7+ support hybrid search natively.
Typical production architecture for a corporate knowledge base
- Documents → preprocessing (PyMuPDF, Unstructured)
- Chunking → embedding (BGE-M3)
- Qdrant (hybrid dense+sparse)
- Cross-encoder re-ranking
- Context → LLM (vLLM or OpenAI API)
- Answer with sources (RAGAS for quality evaluation)
When to Fine-Tune Instead of Prompt Engineering?
Prompt engineering solves ~70% of LLM adaptation tasks for a domain. The remaining 30% require fine-tuning. Three indicators: the model ignores a specific output format even with detailed prompting; the task requires deep knowledge of specialized vocabulary (medicine, law); you need to significantly reduce token costs by replacing a large model with a smaller specialized one.
LoRA and QLoRA are the standard for SFT. LoRA adds trainable low-rank matrices to attention layers. A typical configuration for Llama-3 8B: r=64, lora_alpha=128, target_modules=["q_proj","v_proj","k_proj","o_proj"] yields ~0.8% trainable parameters, training on one A100 40GB. QLoRA adds 4-bit quantization (NF4) and allows fine-tuning 70B models on two A100 40GB, though speed drops by half compared to bf16.
DPO instead of RLHF. Direct Preference Optimization requires only (chosen, rejected) pairs, not scalar reward signals. DPOTrainer from the trl library (Hugging Face) implements it in a few dozen lines.
Common mistake. A dataset of 500 examples, 5 epochs, validation loss 0.8 — seems fine. But on test, the model degrades on general instructions. Cause: catastrophic forgetting. Solution: add 10–20% general instruction-following examples (Alpaca, FLAN) to the training set to preserve original capabilities.
How to Choose a Base Model: 8B or 70B?
| Model |
Parameters |
Strengths |
Context |
| Llama-3.1 8B |
8B |
Quality/speed balance |
128k |
| Llama-3.1 70B |
70B |
Complex reasoning |
128k |
| Mistral 7B / Mixtral 8x7B |
7B / 47B |
Efficiency for size |
32k |
| Qwen2.5 72B |
72B |
Code, multilingual |
128k |
| Gemma 2 27B |
27B |
Open license |
8k |
For most tasks, fine-tuning an 8B model is sufficient. 70B is needed when deep reasoning is required or the 8B baseline does not reach the required quality even after fine-tuning. Inference cost for Llama-3 8B via vLLM on A100 is efficient; the exact cost depends on volume.
What Does PagedAttention Bring to Production?
vLLM is the first choice for serving open-source models. PagedAttention is the key technical innovation: KV-cache is managed like virtual memory in an OS, without fragmentation. This yields 2–4x higher throughput compared to naive HuggingFace Transformers inference. The vLLM documentation confirms that continuous batching and PagedAttention are the standard for high-load LLM services.
Typical numbers on A100 80GB for Llama-3 8B (bf16): 400–600 req/s, P50 latency 200–400ms, P99 latency 600–900ms at concurrency 64. For 70B on two A100 with tensor parallelism: 80–120 req/s, P99 latency 1.5–2.5s. AWQ or GPTQ quantization reduces memory consumption by 2x with quality loss within 1–3%.
Multi-Agent Systems
Agents are LLMs with access to tools: search, code execution, API calls, database interaction. Common patterns:
- ReAct (Reason + Act): the model reasons → chooses a tool → observes the result → reasons again. LangChain and LlamaIndex implement it out of the box.
- Multi-agent orchestration: multiple specialized agents with a coordinator on top. Example: coordinator → researcher (search + summarization) → coder (code generation and execution) → critic (verification). Tools: AutoGen (Microsoft), CrewAI, custom implementation on LangGraph.
In production, agent systems are non-deterministic. Essential: guardrails, step limits, logging of each step, human-in-the-loop for critical actions.
How We Work: Stages, Timeline, Deliverables
| Stage |
Duration |
What You Get |
| Audit and data collection |
1–2 weeks |
Eval dataset of 100+ examples, task formalization |
| Baseline (prompt + RAG) |
1–2 weeks |
Working prototype, quality metrics |
| Fine-tuning (if needed) |
2–4 weeks |
Trained model, LoRA weights, model card |
| Deployment and monitoring |
1–2 weeks |
vLLM server, Grafana + Prometheus |
| Documentation and training |
1 week |
API documentation, team training |
What Is Included
We deliver:
- Technical documentation (model card, configs, deployment instructions)
- Access to infrastructure (code repository, trained weights)
- 1 month of post-deployment support (consultations, bug fixes)
- Customer team training (2–3 sessions on system operation)
Timeline: basic RAG prototype — 1–2 weeks. Fine-tuning with customer data — 3–6 weeks (including data preparation). Production system with monitoring and retraining — 2–4 months. Cost is calculated individually based on data volume, model complexity, and infrastructure requirements.
We guarantee the quality of the final model with performance benchmarks and ongoing monitoring. Our engineers have hands‑on experience with dozens of production LLM systems.
Want to evaluate your project? Leave a request — we will prepare a preliminary summary within 1–2 business days. Or get a consultation on choosing the approach: RAG, fine-tuning, or hybrid — we will tell you what works best for you. Contact us to discuss your LLM development needs. Schedule a free consultation today.