For technical and corporate documentation, RAG, LoRA, and compact DTG-MA skills in the cortiq engine solve different classes of problems and do not replace one another. RAG is needed when the model must answer according to changing policies, versions, and exact facts with a source citation; LoRA is for when you need to train the model on complex new behavior or tool formats on top of a large dataset; a DTG-MA skill sized at 0.38–4.7 MB makes sense when you need to lock in style, terminology, and domain distribution on top of a single frozen local model without extra weight copies or speed loss.
Prepared by Vladimir Lomtev’s AI Studio November 25, 2026 for CIOs, AI system architects, development team leads, and knowledge base owners. The comparison is based on the project’s primary technical materials cortiq/CMF (skill documentation SKILLS.ru.md, experiment card infosave/dtgma-skills and a Habr post from November 24, 2026), as well as basic principles of separating knowledge from behavior. We did not conduct our own model bench testing; this analysis does not include OCR preprocessing of paper archives or legal auditing of personal data under Federal Law 152.
Key takeaways in one minute
- No amount of fine-tuning replaces search over an up-to-date knowledge base: neither LoRA nor DTG-MA provide links to a specific document version or protect against stale numbers. For facts, versions, and access rights, RAG remains the foundational layer.
- DTG-MA solves the problem of the “cost of specialization”: instead of a 43.3 MB LoRA adapter for
Qwen3.5-0.8Bor a full copy of the model for every task, the skill stores 399,936 scalar multipliers in a file of1,7MB (or0,38MB for a narrow task) and runs at base-model speed. - Verified effect on Russian technical documentation: in published measurements
cortiq skill bakereduced perplexity on a held-out Russian technical document forQwen2.5-0.5B-Instructby12,0–21,2 %, and forQwen3.5-0.8Bwith--defrag— by14,7 %(plus it reduced the file from733MB to705MB and sped up generation from86,0to89,7tok/s). - Hard limit on applicability: a drop in perplexity (
PPL) reflects learning domain style and vocabulary, but does not guarantee factual accuracy. Where the base model is already strong (for example, on code withPPL 8,7), baking inskill bakecan make results worse. - A strong combination for a closed loop: RAG handles retrieval of approved documentation fragments, while switchable skills in one
.cmf-container switch the model between “documentation language,” “SQL/1C,” and a strict report format without an external router.
Contents
- What your documentation actually needs: facts, format, or style
- Architectural matrix: RAG, LoRA, and DTG-MA skill
- How LoRA mechanics differ from DTG-MA skills and the CMF format
- What cortiq measurements showed on Russian technical documentation
- DTG-MA vs. LoRA comparison by accuracy, size, and time
- Why fine-tuning does not replace RAG in a knowledge base
- When to choose which option: scenarios for the architect
- A swarm of skills: documentation, code, and 1C on a single model
- Resource requirements and method limitations
- Frequently asked questions
- How Vladimir Lomtev’s AI Studio designs documentation workflows
- Conclusion
What your documentation actually needs: facts, format, or style
Before comparing technologies, an architect should separate two different tasks that business requests often call the same thing — “train the model on documentation.” Architecture mistakes most often happen because these levels get mixed up, which is explained in detail in the general comparison of RAG, fine-tuning, and prompt engineering.
- Answers about the content of documentation (factual retrieval). The user asks about the return limit in version 2.4 of a policy, API parameters, or the order of contract approval. Here, timeliness, a quote from the exact section, and verification of the employee’s access rights to the document are critical.
- Learning the style, terminology, and document template (domain adaptation). The model needs to write or rephrase technical specifications, release notes, operator instructions, or Tier 1 responses in the company’s strict terminology, without filler and without violating the corporate template (for example, JSON, Markdown tables, or standard policy sections).
RAG (Retrieval-Augmented Generation) is a retrieval architecture in which the system first finds relevant fragments in an external knowledge base and inserts them into the query context before generating an answer. Fine-tuning (through LoRA or DTG-MA) changes the model itself or its effective weights on a training set, stabilizing behavior and token distribution, but it does not turn an LLM into a reliable source of current facts.
Architectural matrix: RAG, LoRA, and DTG-MA skill
At the operational level, the three approaches differ in where knowledge is stored, how it is updated, and how much memory is needed to run multiple specializations on one server.
| Selection criterion | RAG (search + LLM) | LoRA / QLoRA | DTG-MA skill (cortiq / CMF) |
|---|---|---|---|
| What changes in the system | External index (FTS + vectors) and prompt | Trainable low-rank matrices A and B |
Multipliers on projection rows / FFN neurons (σ(m)), embedded into the weights |
| Task artifact size | Document index | Dozens of MB per adapter (43,3 MB for r=16 on 0.8B) or a full model copy when merged |
0,38–1,7 MB for 0.8B, 4,7 MB for 27B |
| Update when a document is edited | Reindexing in seconds/minutes | Retraining and revalidating the adapter | Rebaking (skill bake) on a new corpus |
| Generation speed | Latency only for the retrieval step + context length | Either extra matrix multiplications in the layers, or a separate model copy | Equal to the base model speed; with --defrag it can become faster thanks to pruning |
| Source citations and access rights | Yes: citations and ACL at the chunk level | No built-in mechanism | No built-in mechanism |
| Multiple roles on one GPU | One model + different indexes/prompts | Multi-LoRA runtime or multiple weight copies | Overlay in a single .cmf-file + built-in routing without a separate model |
| Main strength | Freshness, verifiability, rights isolation | Training on complex new tasks and long-form reasoning | Minimal artifact weight, domain style, and narrow syntaxes without losing speed |
How LoRA differs from DTG-MA skills and the CMF format
The DTG-MA skill differs from LoRA in that it does not add new trainable matrices; instead, it trains one scalar multiplier per projection row or FFN neuron and then bakes them into the frozen weights, preserving the speed and format of the base model.
To understand the limitations of each option, it is important to look at the level of linear layers. In the classic approach, LoRA (Low-Rank Adaptation, covered in detail in the fine-tuning guide for LoRA, QLoRA, and SFT) the base weights remain frozen, while two narrow matrices A and B of a specified rank r. The adapter adds new transformation directions, so it handles deep changes in model behavior well, but pays for that with dozens of megabytes per task and extra compute during inference (if the adapter is not merged with the base model).
The DTG-MA method (Dynamic Task-Guided Mask Activation, U.S. patent application No. 19/452,464, described in infosave/dtgma-skills) works differently:
- one scalar gate
σ(m)is trained on the output row of each projection (--mask-scope linear) or on each neuron in the FFN block (--mask-scope ffn); - the skill file stores only this coefficient vector (
399 936numbers or1,7MB forQwen3.5-0.8B,1 114 112numbers or4,7MB forQwen3.8-27B); - when applied (
cortiq skill apply), the rows of the base weight matrix are multiplied by the coefficients and recoded into the base model format (q8_2f) or another codec).
As a result, a specialist with an overlaid skill has no adapter matrices at generation time—the size and math of the forward pass match the original model. This approach has two creation methods, described in SKILLS.ru.md:
cortiq skill bake(from raw texts or dialogues without a donor). In phase one (phase A), an L1-regularized mask is trained to filter out neurons that interfere with the domain (“denoising floor”); in phase two (phase B), the final layers are polished with the FCD method (polishing against an exact teacher), and with hard pruning the flag--defragphysically removes the disabled neurons from the file.cortiq skill add(extracting a skill from a ready-made donor). If an outside team has already done SFT or merged LoRA into the same base model,cortiqcompares the donor weights with the base, discards untouched tensors below the threshold--min-delta(for example,0,02above the measured quantization noise0,92 %) and transfers only the changed tensors as a record inside.cmf.
What cortiq measurements showed on Russian technical documentation
On Russian-language technical documentation, cortiq skill bake reduced held-out text perplexity by 12.0–21.2% for Qwen2.5-0.5B-Instruct and by 14.7% for Qwen3.5-0.8B (with a smaller model size and faster decoding after --defrag), but this increase in predictability does not equal actual answer accuracy.
Evaluation methodology (R05). In the published logs SKILLS.ru.md and dtgma-skills the training corpus consisted of the repository’s own Russian markdown documents (docs/CMF_V2_SPEC.ru.md, README.ru.md, docs/COMPARISON.ru.md). The actual run Qwen2.5-0.5B-Instruct (q8) on an Apple M4 CPU took 8.8 minutes (70 calibration and 12 held-out chunks of 256 tokens each, Phase A was checked every 30 steps through step 180, then 120 Phase B FCD steps on the last 4 layers). Perplexity was measured ( perplexity (PPL) — a measure of the model’s confidence on the next token of the reference text; generalization was also measured on an unseen Russian document PERFORMANCE_ROADMAP.ru.md.
| Model and evaluation stage | Baseline (PPL) |
Skill (PPL) |
Change | Size / speed |
|---|---|---|---|---|
Qwen2.5-0.5B-Instruct (q8), held-out corpus chunk (f32 replica) |
24,157 |
17,423 (mask 2 % + FCD) |
−27,9 % |
Bake time 8,8 min on Apple M4 |
Qwen2.5-0.5B-Instruct (q8), real quantized engine (runtime gate) |
24,173 |
19,039 |
−21,2 % |
479 MB → 472 MB |
Qwen2.5-0.5B-Instruct (q8), unseen document PERFORMANCE_ROADMAP.ru.md |
25,62 |
22,56 |
−12,0 % |
Style and terminology transfer outside train |
Qwen3.5-0.8B (q8_2f), held-out Russian technical document (--defrag) |
13,97 |
11,92 |
−14,7 % |
705 MB instead of 733 MB; 89,7 tok/s instead of 86,0 tok/s |
Qwen3.5-0.8B, weak Russian technical domain (internal held-out recipe) |
70,5 |
54,2 (mask 11 %) / FCD −38,7 % |
−38,7 % |
On an independent technical corpus −19,4 % |
Two important engineering findings from the measurements:
- The “denoising floor” effect is narrow. When training on
Qwen2.5-0.5Bby step60(2 %pruning)hard-PPLdropped from24,157to21,110, but when continued to step180(16 %pruning) it rose to49,659. OnQwen3.5-0.8Bthe minimum was reached at11 %(67,9 → 54,2), and with18 %it worsened to77,1. Therefore, the system should automatically roll back to the checkpoint with the minimum held-out error, rather than chasing compression. - Bake-in helps where the baseline is weak. On Russian technical vocabulary that is rare for the base model (
PPL 70), pruning noisy neurons gave a strong improvement (−38,7 %after FCD). When the same recipe was run on code, where the baseline was already strong (PPL 8,7), the mask hurt quality.
Comparison of DTG-MA and LoRA by accuracy, size, and time
For tasks where not only text style matters, but also classification, strict JSON, or rule compliance, the author compared DTG-MA and LoRA (r=16) on Qwen3.5-0.8B and a single GPU RTX 3060 (12 ГБ) with the same data, example order, number of steps, and loss function (Habr post #1111938 and dtgma-skills).
| Comparison metric | DTG-MA skill (cortiq) |
LoRA r=16 (PyTorch) |
Observation |
|---|---|---|---|
Trainable parameters (Qwen3.5-0.8B) |
399 936 (all projections) |
10,8 million parameters |
About 27x fewer parameters |
| Specialized model file size | 1,7 MB (0,38 MB per task) |
43,3 MB |
25–115 times smaller |
Accuracy on dair-ai/emotion (1 word, 2,000 tests) |
92,6 % (balanced 91,5 %) |
92,5 % (balanced 85,4 %) |
The base model produced 53,3 % (42,0 % balanced) |
Accuracy on dair-ai/emotion (JSON format) |
92,5 % (100 % valid JSON) |
93,3 % (100 % valid JSON) |
The base model produced 46,9 % (91 % valid JSON) |
ODE tasks (100 new coefficients) |
96 % (0,38 MB) |
100 % |
The base model with a template produced 44 % (without it — 0 %) |
Training time on RTX 3060 |
12 and 16 min (with validation checks) |
18 and 21,5 min |
Faster by 25–33 % |
For LoRA retains an advantage where the task cannot be solved by reweighting existing neurons. If the model needs to learn new factual relationships or complex reasoning that was absent in pretraining, LoRA's low-rank matrices or full SFT (sometimes combined with subsequent cortiq skill add) provide greater expressiveness.
Why fine-tuning does not replace RAG in a knowledge base
Even if cortiq skill bake reduced perplexity on your technical documents by 15–21 %, this does not make the model a reliable reference source. The developer cortiq specifically warns about this in SKILLS.ru.md: on the Qwen3.5-4B runs for code 1500 masking steps reduced PPL from 1,461 to 1,436, but answer accuracy on a different test dropped from 69,8 % to 68,5 %. Perplexity measures only token predictability, not whether the answer is true.
Why RAG remains a required layer for an enterprise knowledge base:
- Changing policies and pricing. Return policy, prices, and release numbers change constantly; retraining weights after every update in Confluence or Git is not practical.
- Access control checks (ACL). Different departments should not receive data from other departments' policies. In RAG, filtering happens at the search-index level before context is passed to the LLM; model weights cannot enforce user-level access rights.
- Hallucination audit and control. In RAG, the answer is built on specific retrieved chunks, and each citation can be verified against the rules in our RAG accuracy evaluation and hallucination control methodology.
When to choose each option: scenarios for the architect
For practical selection in documentation-heavy projects, it’s helpful to rely on the following decision matrix (C08):
| Task scenario | Recommended architecture | Why this approach |
|---|---|---|
| Enterprise knowledge base / tech support / HR policies | RAG + system prompt | You need up-to-date facts, links to source documents, and document-level access control |
| Generating and validating technical documentation against a strict standard (GOST, internal style, JSON/YAML) | RAG + DTG-MA skill (cortiq) |
RAG provides accurate facts from tickets and diagrams, while 1,7the MA skill locks in style, terminology, and format without bloating the prompt |
| Launching a compact offline assistant on low-power PCs/laptops (0.5B–4B) | cortiq skill bake + --defrag |
File compression, reduced PPL Russian technical text, and a small increase in decode speed without an external server |
| Deep training on a new complex domain or a new API dialect | SFT / LoRA (optionally with export to CMF via skill add) |
You need to create new connections in the weights that the base model does not have |
| Narrow syntax on top of a strong base model (for example, 1C query language on top of 27B) | DTG-MA skill (--mask-scope ffn) on dialog data |
Reduces interference with similar SQL, as shown in the breakdown of the 1C query language skill for Qwen3.8-27B |
Decision rule: start with plain RAG, if the documentation changes every week, contains lots of tables and numbers, and the base model already writes confidently in the required language. Add the DTG-MA skill on top of RAG when, even with correct retrieval, the model slips on terminology, breaks the corporate response template, or when you need to combine multiple narrow roles on one server. Choose LoRA / SFT if the model runs in a standard PyTorch/vLLM stack or needs to learn fundamentally new reasoning patterns.
Skill swarm: documentation, code, and 1C in one model
One of the main advantages of the CMF container is the ability to store the base model and several skills in one file (--overlay) with automatic routing, without a separate classifier model.
As described in SKILLS.ru.md, when a skill is added using 8 or more prompt examples, the header records a routing descriptor of around 4 KB (mean and rank-2 PCA basis from the hidden state at two-thirds of the network depth). During a request, the engine estimates the reconstruction error E and selects the specialist on its own:
- In a test with three skills on one base (
sql,ru,thinker) the router correctly chose the needed skill in 6 out of 6 unseen prompts with a margin on metricEof 3–5x (0,0016forsqlversus0,0073and0,0112). - The
--route-dynamicflag lets you switch skills right in the middle of generation of a single answer—for example, when moving from generating an SQL/1C query to a Russian-language explanation based on the documentation. - How much the overlay weighs on disk: for
Qwen3.5-0.8B(796MB) the full overlay of all projections takes about ~490MB on disk; for0.5Bthree FFN skills take314MB each (or257MB in 6-bitvbit), and when transferred as separate deltas, the files weigh1,7–4,7MB.
Resource requirements and method limitations
Before planning a DTG-MA rollout on a documentation corpus, check four limitations from the source materials:
- Memory for training (
skill bake) grows proportionally with the size of the base. In CPU baking mode, the engine keepsf32a replica and an optimizer for polished layers: for a table ofSKILLS.ru.mdfor0.5Brequires ~3GB of RAM (8,8min on M4), for1–2B—6–10GB (20–40min), for4B— ~18GB (1,5h), for7–8B— ~35GB (3h), and for27B— about115GB of RAM or running on GPU (CMF_GPU=cuda). For a domain corpus, though,100–200KB of text is enough (~82chunks of 256 tokens in the test). - Incompatibility of “foreign” donors during
cortiq skill add. Weight grafting works only with checkpoints fine-tuned from *the same* base model (SFT or merged-LoRA). An attempt to transfer an FFN skill from a model after continued pretraining (Qwen2.5-Coder-0.5B-InstructintoQwen2.5-0.5B-Instruct) in the author’s measurements destroyed quality (PPL 238vs.2,6for the base) because of desynchronization of norms and embeddings. - Vulnerability
q4during aggressive overlay compression. When compressing theru-skill to6bits (--skill-quant vbit --mean-bits 6) quality is almost preserved (PPL 11,19vs.11,03forq8and11,88for the base), but at4bits (vbit 4,25orq4) the skill degrades below the base (PPL 12,17–12,20). - Binding the file to the base hash (
base_dir_hash). A separate.skill.cmf-file cannot be silently applied to another version of the weights or a requantized model — the engine blocks the operation so you don’t end up with a broken “chimera.”
Verification order for the documentation team:
- Collect 30–50 real questions for the knowledge base (facts, links, response format).
- Run the baseline RAG and separately measure retrieval recall (
recall) and context-grounding accuracy (faithfulness). - If retrieval finds the right passages but the model falls apart in terminology, structure, or language, prepare
100–200KB of reference documents/dialogs and check whetherskill bake(or LoRA) reduces the share of formatting and terminology errors on a holdout set.
Frequently asked questions
Can DTG-MA skill “learn” our documentation so we can drop RAG?
No. Both LoRA and DTG-MA change the probability distribution and the style/format of the answer, but they do not guarantee exact reproduction of changing numbers, policy items, or access-control rules. For up-to-date facts and source citations, RAG is required.
How much documentation is needed to bake in a domain skill in cortiq?
According to SKILLS.ru.md, to shift a model toward the domain’s vocabulary and style, as little as 100–200 KB of clean text is enough (the published experiment on Russian documents used 70 calibration chunks and 12 holdout chunks of 256 tokens each). If you need to train a strict answer format of “question — structure — answer,” prepare chat logs and a separate holdout set.
When is it better to choose classic LoRA instead of the DTG-MA skill?
Choose LoRA if the model runs in a standard PyTorch/vLLM setup, you do not plan to port it into cortiq , or you need to train the model on complex new knowledge and multi-step reasoning where reweighting existing neurons is not enough. If you need a local model with low memory overhead, fast switching between multiple specializations, and speed without adapter overhead, DTG-MA in CMF wins.
Why did perplexity drop by 14–21% in one test, but code performance got worse?
DTG-MA works by pruning or dampening neurons that add noise in a domain the model is weak in (for example, narrow Russian technical documentation with PPL 24–70). In a domain where the base model is already well tuned (code with PPL 8,7), removing neurons takes away useful capacity and increases error.
Can you combine a 1C skill and a documentation skill in one model?
Yes. In CMF, both skills live alongside one base via --overlay, as long as both were derived from the same base checkpoint (base_dir_hash). The built-in reconstruction-error router E sends the request to the right specialist or switches dynamically (--route-dynamic).
Do you need to change the inference engine for DTG-MA?
Skills in the format .cmf and routing work in an open-source Rust engine cortiq (CPU, CUDA, Vulkan, Apple Metal) with an OpenAI-compatible HTTP API. Third-party runtimes like Ollama do not directly support the format .cmf .
How Vladimir Lomtev’s AI Studio designs frameworks for working with documentation
The choice between RAG, LoRA, and compact skills depends on the structure of the knowledge base, information security requirements, and available GPUs. Vladimir Lomtev’s AI Studio helps teams build an enterprise documentation workflow without unnecessary infrastructure costs:
- Document audit and architecture split: an analysis of common employee requests, identifying fact-finding tasks (RAG with access control) and tasks that require a consistent response format and terminology.
- Deployment and configuration of local LLMs (on-premise): selecting an open model and engine for the company’s servers, setting up knowledge base indexing, and fine-tuning the model for corporate style and templates.
- MVP assembly and testing: creating a benchmark question set with source citation verification (
faithfulness) and launching a corporate workspace with team training.
A smart first step is to choose one specific documentation set (for example, technical support instructions or product procedures), define how often it is updated, set access restrictions, and establish the quality criterion for an answer with a source citation. Discuss the project
Conclusion
The choice between RAG, LoRA, and DTG-MA skills for documentation depends on the type of gap, not on how new the tool is. RAG remains essential for finding current facts, enforcing access rights, and citing sources. LoRA is justified in a standard PyTorch/vLLM stack when you need to deeply retrain a model’s behavior on a large dataset. Compact DTG-MA skills (0,38–4,7 MB) in cortiq/CMF cover the niche of local adaptation for style, terminology, and narrow formats on top of a single frozen model — especially when you need to combine documentation, code, and other specializations on one server without duplicating weights.



