1C Query Language Skill for Qwen3.8-27B

Vladimir Lomtev•
1C Query Language Skill for Qwen3.8-27B

The open-source Qwen3.8-27B model can write syntactically correct 1C:Enterprise 8 queries without changing the architecture and without heavyweight LoRA adapters — thanks to a compact 4.7 MB skill. In an experiment published on November 25, 2026, scaling FFN neurons with the DTG-MA method in the cortiq engine raised the share of fully correct answers on 195 held-out dialogs from 23.0–33.6% for the base model to 98.0–98.7%, but the measurement was taken with a reference prefix and on training metadata schemas.

Prepared by Vladimir Lomtev’s AI Studio November 25, 2026 for 1C architects, development team leads, ML engineers, and technical managers evaluating local neural networks for 1C tasks. The analysis is based on primary sources: the experiment author’s post on Habr, the model card and artifacts on Hugging Face, the cortiq/CMF project documentation on GitHub and the article on the NERVE method. This article examines query generation for a given metadata schema and the model’s runtime conditions; we did not conduct our own benchmark testing of the model, do not analyze code generation in the built-in BSL language, and are not affiliated with the authors cortiq, the dataset, or 1C Company.

Bottom line in one minute

  • The reason base LLMs fail in 1C is interference from SQL: in training corpora, standard SQL is hundreds of times more common, so the models insert nonexistent LIMIT, JOIN ON, COALESCE and ПО УБЫВАНИЮ into 1C queries.
  • How the DTG-MA method works: each of the 17,408 FFN neurons across 64 layers Qwen3.8-27B receives a trainable multiplier from 0 to 1 (1,114,112 values in total, 4.7 MB), which after training multiplies the corresponding column of the matrix W_down.
  • Experiment results on the held-out set: token-level accuracy increased from 78.0% to 99.2%, reference-answer perplexity dropped from 2.914 to 1.034, and on 161 contrastive pairs the share of the correct answer winning by total log probability rose from 10.6% to 99.4%.
  • Hardware and software requirements: the model is distributed in the open CMF format in 8-bit (27,4 GB for GPUs/RAM of 32 GB or more) and 4-bit (14,3 GB for 16–24 GB graphics cards) versions under Apache 2.0, runs with a required system prompt and the flag --no-think.
  • Main limitation before production: the metrics were measured in teacher forcing mode on training schemas, and in free generation the model may infer parameter types that are not present in the provided schema, so object and attribute names need to be checked against the production configuration.

Contents

Why language models make mistakes in 1C queries

The 1C query language — a declarative data retrieval language for the 1C:Enterprise 8 platform with Russian and English keywords (ВЫБРАТЬ, ИЗ, ГДЕ, УПОРЯДОЧИТЬ ПО), superficially similar to SQL dialects in DBMSs, but different in syntax, data model, and the rules for working with temporary and virtual tables.

This visual similarity is what causes the main class of errors in general-purpose LLMs. When the model sees familiar constructs like ВЫБРАТЬ and ВНУТРЕННЕЕ СОЕДИНЕНИЕ, it activates standard SQL patterns, which are represented orders of magnitude more often in open training corpora than 1C queries are. As described in Oleg Kirichenko’s post on Habr and in the system prompt in the repository Qwen3.8-27B-1C-cmf, the failures repeat in the same places:

  1. Prohibited SQL and BSL constructs. The model inserts LIMIT, OFFSET, TOP, COALESCE, ISNULL, ROW_NUMBER, WITH / CTE, JOIN ON instead of ПО, and also tries to end the query batch with the word КОНЕЦ from the built-in language instead of the delimiter ;.
  2. Errors with virtual tables. In the 1C query language there are virtual tables — computed register tables such as Остатки() or Обороты(), whose parameters are passed in parentheses. Models add a made-up prefix ВиртуальнаяТаблица. or pass a simple value in parentheses &Склад instead of the selection condition Склад = &Склад.
  3. Distorted modifiers and invented fields. Instead of УБЫВ the model writes ПО УБЫВАНИЮ, instead of ПОМЕСТИТЬ in the right place (immediately after the field list ВЫБРАТЬ) it puts it elsewhere, and it also makes up fields that are not in the provided metadata schema.

Large open models already know the basic 1C syntax, but the needed token probabilities are “smoothed out” by more frequent SQL continuations. Classical text fine-tuning (SFT with LoRA) on new query corpora changes behavior only slightly: as the author of the dataset 1c_lang_query Andrey Druzdt said in the article on the NERVE method, additional SFT increased accuracy by less than 1%.

How the DTG-MA skill works and the CMF format

The DTG-MA method (Dynamic Task-Guided Mask Activation, U.S. patent application No. 19/452,464 in the registry PATENTS.md) adapts a language model’s behavior to a narrow task by training one scalar multiplier from 0 to 1 for each neuron in a fully connected FFN block without retraining the core weights.

In the Qwen3.8-27B transformer, each of the 64 layers contains an attention block and a fully connected FFN block (Feed-Forward Network with a SwiGLU setup). The intermediate FFN layer in this model has 17,408 neurons, and its output is passed into the residual stream through matrix W_down. Multiplying the activation of a specific neuron by a scalar multiplier is mathematically equivalent to multiplying the corresponding column of W_down by the same coefficient.

This property is what the skill training is built on:

  • 64 слоя × 17 408 нейронов = 1 114 112 trainable multipliers σ(logit);
  • in the serialized file 1c-query.skill.cmf this vector of numbers takes up 4.7 MB;
  • the base weights Qwen3.8-27B (27.78 billion parameters) are frozen during training;
  • the loss is calculated only on the assistant’s response tokens, without any penalty for the system and user prompts.

After gradient descent is complete, the multipliers are written into matrix W_down by column multiplication. The model keeps its original architecture, memory footprint, and inference speed — with no overhead from adding LoRA weights.

The CMF format (Cortiq Model Format) is an open binary container under the Apache 2.0 license, along with the matching Rust engine cortiq with no Python dependencies, described in the documentation SKILLS.ru.md. One .cmf-file can store a base model and a set of replacement tensors for multiple narrow skills, loading them through mmap, or use an external skill file (1c-query.skill.cmf) linked to the base checkpoint by SHA-256 hash.

Dataset and experiment methodology

For training and evaluation, the task-labeled dataset 1c_lang_query by Andrey Druzdt was used (the corpus itself is not published; the preparation and validation scripts are posted in the directory scripts/ on Hugging Face). Each dialog includes a shared system prompt with rules for 1C query language, a user message with a training metadata schema and task, and a reference answer made up of the sections “Query,” “Parameters,” and “Why this way.”

Experiment parameter Value from the original sources Source and details
Base model Qwen/Qwen3.8-27B (27.78 billion parameters, q8_2f) Qwen/Qwen3.8-27B model card, Apache 2.0 license
Training set 3 068 dialogues train-part 1c_lang_query
Held-out validation (SFT) 195 dialogues (no overlap with train) Sorted by query_fingerprint in prep_1c.py
Contrastive validation (pairs) 161 pair (chosen vs rejected) NERVE metric by difflib in score_pairs.py
Hardware and time 1 × NVIDIA RTX PRO 6000 (Colab), peak 86,8 GB VRAM, 1 ч 47 мин 6 100 steps (2 epochs), ~0.7–0.9 s/step, batch=1, chunk=2048
Selected checkpoint Step 5 000 out of 6 100 Selected for maximum accuracy on 195 held-out dialogues
Dialogue format Qwen template with an empty block <think>\n\n</think> The dataset has no chain-of-thought reasoning, hence the flag --no-think

How to interpret the evaluation method. In the first test (195 held-out dialogues), teacher forcing is used teacher forcing — evaluation with the ground-truth prefix: at each answer position, the model is checked to see whether it ranks the correct token first (argmax). The "full answer" metric means an exact match argmax with the ground truth at all positions in a row. This is a strict check of the probability distribution, but during free autoregressive generation, a single inaccuracy in an early token can affect the rest of the prompt.

In the second test (161 pair from preference.val), the script prep_1c.py identifies differing fragments between the correct (chosen) and incorrect (rejected) answers and compares their total log probability via cortiq loglik. According to the Habr article, to run 2,569 prompts on a 27B model, the author implemented a GPU scorer for CUDA and Vulkan: the calculation took 15–18 minutes per model, and the CUDA and Vulkan results matched to within 0.0001 per token (unlike the old CPU path with activation quantization in int8).

Results on held-out dialogues and pairs

According to the artifact held_steps.json and the Hugging Face model card (percentages are rounded to tenths in the Habr article), applying the 4.7 MB skill dramatically shifts probabilities toward correct 1C syntax:

Metric on 195 held-out dialogues Baseline (step 0) With the skill (step 5,000) Change
Full answer correct (average across task types, macro) 23,03 % 98,73 % +75.7 pp
Full answer correct (across all dialogues, micro) 33,56 % 97,99 % +64.4 pp
Share of correct answer tokens 77,98 % 99,15 % +21.2 pp
Perplexity of the reference answer (answer_ppl) 2,914 1,034 −1.880

Perplexity measures the model's uncertainty on the reference sequence: a value 1,034 close to the theoretical limit 1,0when the model chooses the target token almost unambiguously. The learning curve from held_steps.json shows that the main gains come in the first 500 steps, while later iterations pick up rare task categories:

Training step Full answer (macro) Full answer (micro) Answer tokens Answer perplexity
0 (baseline) 23.03% 33.56% 77.98% 2.914
500 70.49% 76.51% 94.01% 1.292
1,000 78.82% 80.54% 95.57% 1.202
2,000 86.57% 83.89% 97.08% 1.127
3,000 85.42% 92.62% 98.10% 1.080
4,000 96.76% 97.99% 98.90% 1.041
5,000 (selected) 98.73% 97.99% 99.15% 1,034
6,000 94.44% 97.32% 99.18% 1,031

Across 161 contrastive pairs of "correct / incorrect answer," the results for the 8-bit (q8_2f) and 4-bit (q4tp) builds were recorded in pairs_1c.json, pairs_base.json and the Hugging Face card:

Model and format Differing segments (sum) Entire answer (sum) Average log-prob / token (chosen / rejected) NLL of the correct answer
Base q8_2f 10.56% 20.50% −1.12 / −3.64 1.0813
With the skill q8_2f 99.38% 99.38% −0.02 / −5.22 0.0278
Base q4tp 9.9% 17.4% Not published 1.125
With the skill q4tp 98.8% 99.4% Not published 0.052

The low starting 10,56 % scores for the base model on the sum across differing segments are tied to the different fragment lengths: the correct option in each pair is longer than the incorrect one (median 85 tokens versus 13), and the sum of negative log probabilities over the longer segment is lower. When recalculated per token (acc_diff_mean), the base model was already outperforming the incorrect option in all 161 pairs (1.0). The DTG-MA skill makes the correct tokens almost deterministic (−0.02 per token instead of −1.12) and penalizes incorrect ones more deeply (−5.22 versus −3.64). The q4tp version maintains comparable quality because the skill is first baked into the bf16 weights and the model is quantized once.

Live example before and after applying the skill

To test free-form generation outside the dataset, the author created a training scenario called "Trading" (examples/task.txt): catalog Номенклатура, document РеализацияТоваров , and accumulation register ТоварыНаСкладах with the virtual table Остатки(&Период, Склад = &Склад). The task: output products with stock on hand in warehouse &Склад , as of &Период less than 10, including the name and stock balance, sorted by descending stock balance, excluding items marked for deletion.

Base model answer Qwen3.8-27B (examples/answer_base.md):

ВЫБРАТЬ
	Остатки.Номенклатура КАК Номенклатура,
	Номенклатура.Наименование КАК Наименование,
	Остатки.КоличествоОстаток КАК Остаток
ИЗ
	ВиртуальнаяТаблица.РегистрНакопления.ТоварыНаСкладах.Остатки(&Период, &Склад) КАК Остатки
		ВНУТРЕННЕЕ СОЕДИНЕНИЕ Справочник.Номенклатура КАК Номенклатура
			ПО Остатки.Номенклатура = Номенклатура.Ссылка
ГДЕ
	Остатки.КоличествоОстаток < 10
		И Номенклатура.ПометкаУдаления = ЛОЖЬ
УПОРЯДОЧИТЬ ПО
	Остатки.КоличествоОстаток ПО УБЫВАНИЮ

The query contains three syntax errors: a made-up prefix ВиртуальнаяТаблица., passing &Склад instead of the condition Склад = &Склад in the second parameter of Остатки(), and sorting by ПО УБЫВАНИЮ instead of УБЫВ.

Answer Qwen3.8-27B-1C with the skill (examples/answer_1c.md):

ВЫБРАТЬ
    Номенклатура.Ссылка,
    Номенклатура.Наименование,
    Остатки.КоличествоОстаток
ИЗ
    РегистрНакопления.ТоварыНаСкладах.Остатки(&Период, Склад = &Склад) КАК Остатки
        ВНУТРЕННЕЕ СОЕДИНЕНИЕ Справочник.Номенклатура КАК Номенклатура
        ПО Остатки.Номенклатура = Номенклатура.Ссылка
ГДЕ
    Остатки.КоличествоОстаток < 10
    И НЕ Номенклатура.ПометкаУдаления
УПОРЯДОЧИТЬ ПО
    Остатки.КоличествоОстаток УБЫВ

The model with the skill fixed all three errors, added a JSON parameter block (Период, Склад), explained why it chose the field КоличествоОстаток instead of Количество , and specified the scope and limits of the answer. At the same time, the model inferred the parameter type "Склад": "СправочникСсылка.Склады" on its own, since the warehouse directory was not included in the description of the training scenario.

Comparing approaches to 1C query generation

The choice of architecture depends on whether the team is solving only the problem of 1C query syntax in a closed environment or building a universal assistant for the entire configuration and BSL code. We covered the general logic of comparing vendor and custom solutions in the article on choosing between 1C:Partner and a custom AI assistant for 1C.

Approach Artifact size on top of the base What it changes in the model Inference Requirements When to Choose It
System Prompt + Schema in Context 0 bytes Nothing Any API or Local Engine Quick prototype; with complex requests, 1C often breaks into SQL
RAG Over the Configuration + LLM Metadata and Code Index Nothing Hybrid Search (FTS + Vector) and LLM When you need to find objects across thousands of configuration tables and BSL modules
SFT / LoRA Adapter Tens to hundreds of MB Low-rank matrices or updated weights Merge or adapter computation costs When you need to train the model on new entities and BSL code patterns
NERVE Editing Modified checkpoint (GGUF) Targeted scaling W_down by pairs Zero overhead; the model is tied to a single task When you have contrastive pairs and need to run in a standard GGUF runtime
DTG-MA Skill in CMF (cortiq) 4.7 MB (1.11 million numbers) Multipliers on FFN neurons in W_down Same size and speed as the base; fast skill switching Local server with 16–32+ GB VRAM, strict 1C syntax, and multiple specializations on one database

Practical rule of thumb: if your team works in 1С:EDT and can use the vendor's cloud, it's faster to start with the built-in assistant or a RAG wrapper. A local Qwen3.8-27B with the DTG-MA skill in CMF format makes sense where code and schemas can't leave the perimeter and where you want to switch compact skills for different narrow dialects on a single GPU server.

How to Run Qwen3.8-27B-1C Locally

All ready-made files are published in the repository infosave/Qwen3.8-27B-1C-cmf (commands verified against model card README):

File Purpose Size Memory Requirements
qwen38-27b-1c-q4tp.cmf 4-bit model with embedded skill 14,3 GB Graphics card with 16–24 GB VRAM
qwen38-27b-1c-q8_2f.cmf 8-bit model with embedded skill 27,4 GB GPU or RAM of 32 GB or more
1c-query.skill.cmf Separate skill file for qwen38-27b-q8_2f.cmf 4,7 MB Applied with the command cortiq skill apply
system_prompt.txt System prompt used to train the skill 2,6 KB Required at startup

4-bit quantization caveat: the separate file 1c-query.skill.cmf is designed for an 8-bit base only qwen38-27b-q8_2f.cmf. For 16–24 GB cards, download the ready-made qwen38-27b-1c-q4tp.cmf: applying the skill on top of an already quantized 4-bit model will trigger re-quantization of down_proj and quality loss.

Step 1. Install cortiq-cli and download the artifacts

For NVIDIA GPUs, build the version with the --features cuda flag (the engine also supports CPU, Vulkan, and Apple Metal; ready-made builds are posted in GitHub releases infosave2007/cmf). After downloading, verify the checksum .sha256.

cargo install cortiq-cli --features cuda

hf download infosave/Qwen3.8-27B-1C-cmf \
  qwen38-27b-1c-q4tp.cmf qwen38-27b-1c-q4tp.cmf.sha256 \
  system_prompt.txt examples/task.txt --local-dir .

sha256sum -c qwen38-27b-1c-q4tp.cmf.sha256

Step 2. CLI launch and OpenAI-compatible server

When calling the model, be sure to pass the contents of system_prompt.txt and disable the reasoning block (--no-think in the CLI or "enable_thinking": false in JSON). According to the author's measurements on an RTX PRO 6000, decoding the 8-bit build runs at 44 tokens/sec, and the 4-bit model's response in server mode takes 4 seconds. To restrict access to localhost only, specify --host 127.0.0.1.

# Разовый запуск в командной строке
CMF_GPU=cuda cortiq run qwen38-27b-1c-q4tp.cmf \
  --system "$(cat system_prompt.txt)" \
  --prompt "$(cat examples/task.txt)" \
  --no-think --greedy

# Сервер с эндпоинтами /v1/chat/completions, /v1/completions, /v1/models
CMF_GPU=cuda cortiq serve qwen38-27b-1c-q4tp.cmf --host 127.0.0.1 --port 8080

Before deploying a dedicated GPU server, estimate the load, downtime, and total cost of ownership using our criteria for choosing between your own inference and an external API. The base Qwen/Qwen3.8-27B and artifacts Qwen3.8-27B-1C-cmf are distributed under Apache 2.0, but before commercial deployment you should verify attribution rules and derivative weights according to the guide on checking open LLM licenses for business.

Limitations and a checklist before using 1C in production

Before embedding the model into the 1C team’s workflow, it’s important to account for four limitations from the source materials and the platform architecture:

  1. The model relies only on the schema provided in the prompt. It was trained on sample schemas; if you forget to describe a catalog or attribute in the user message (as in the warehouses example), the model will infer the parameter type or field name on its own.
  2. Metrics 98–99 % were measured with a reference prefix. On long composite queries with many temporary tables, free-form generation has a higher error rate, so the result should always be run through syntax validation in 1С:EDT or Configurator.
  3. Dependence on the system prompt and --no-think mode. Without system_prompt.txt and with reasoning mode enabled, the model shifts back toward the behavior of the base Qwen3.8-27B. Also, this skill is not intended for generating procedures and forms in the built-in BSL language.
  4. Isolation of access to the production database. The LLM-generated query text cannot be executed directly on a live database without role-based restrictions and validation. The principles of the secure perimeter are described in the guide on securely connecting AI agents to 1C via OData and a tool gateway.

Checklist for a pilot test on your own tasks:

  • Export a compact metadata description for only the target area of the database (catalogs, documents, registers, available fields).
  • Gather 20–30 real tasks from the team backlog with reference queries (virtual tables, joins, temporary tables, totals).
  • Run them through cortiq serve with temperature: 0, enable_thinking: false and system_prompt.txt.
  • Record the share of queries that run without manual correction of syntax and attribute names, as well as response time on the target GPU.

Frequently asked questions

How is the DTG-MA skill different from a LoRA adapter?

DTG-MA does not add low-rank matrices A and B and does not change attention weights: it trains one multiplier from 0 to 1 for each FFN neuron (1,11 million numbers, 4,7 MB), and then multiplies the columns W_down. The model runs without slowing inference and lets you store multiple skills in one CMF file.

Can the file 1c-query.skill.cmf be applied to a 4-bit model or run in Ollama?

A separate file 1c-query.skill.cmf is intended only for the 8-bit checkpoint qwen38-27b-q8_2f.cmf. For 16–24 GB GPUs, use the ready-made file qwen38-27b-1c-q4tp.cmf, where the skill is baked into the bf16 weights before one-time quantization. The Ollama format does not support .cmf directly — use cortiq serve with an OpenAI-compatible API.

How much video memory is needed to run Qwen3.8-27B-1C?

For the 4-bit version of qwen38-27b-1c-q4tp.cmf (14,3 GB), GPUs with 16–24 GB of VRAM are suitable at a moderate context length. For the 8-bit version of qwen38-27b-1c-q8_2f.cmf (27,4 GB), you need at least 32 GB of VRAM or RAM when running on CPU.

Why is the base model’s result only 10.6% on contrastive pairs?

In the pairs, the correct answers are longer than the incorrect ones (median 85 tokens versus 13), so the sum of negative log probabilities over the longer fragment turns out lower even when individual tokens are chosen correctly. When recalculated per token, the base model won in all 161 pairs, and the skill increased confidence in the correct tokens (−0.02 versus −1.12 per token).

Can the model understand a nonstandard 1C configuration on its own?

No. The model is not connected to your information database and operates only on the objects and attributes passed in the prompt. A catalog omitted from the schema or a typo in a field name will cause an error when the query is executed.

Is commercial use allowed for Qwen3.8-27B-1C?

The base model Qwen/Qwen3.8-27B, the published weights infosave/Qwen3.8-27B-1C-cmf and the engine cortiq are distributed under the Apache 2.0 license, which allows commercial use subject to attribution requirements. The authors have not publicly released the full training dataset 1c_lang_query .

How Vladimir Lomtsev’s AI Studio helps implement AI for 1C tasks

If the team needs more than a one-off experiment with queries and wants a reliable assistant tailored to its own 1C configuration, with access control checks and internal policies, Vladimir Lomtsev’s AI Studio helps build that solution inside the company’s environment:

  • On-premise LLM deployment and setup: selecting an open model for the customer’s servers and GPUs and running inference without sending schemas or data to external clouds.
  • RAG for 1C configuration and an integration gateway: indexing metadata, extensions, and policies, as well as controlled connection of AI agents to 1C with read permissions and validation.
  • Process audit and building a verifiable MVP: creating a benchmark set of team tasks, setting up automatic validation of generated queries, and launching a pilot with employee training.

The best first step is to choose one repeatable 1C workflow, describe the required slice of the metadata schema, the environment constraints, and the acceptance criteria for the finished result. Discuss the project

Conclusion

The experiment Qwen3.8-27B-1C shows a workable way to suppress SQL interference in the 1C query language without fully retraining a 27-billion-parameter model: a 4.7 MB DTG-MA mask on FFN neurons eliminates errors with virtual tables and sort syntax, preserves the speed of the original model, and fits in 4-bit form on a 16–24 GB GPU. For practical implementation, environment discipline is critical: provide an exact metadata export, make mandatory use of system_prompt.txt and --no-think, and validate the generated query syntactically in 1C before running it on the production database.

Request an audit

Share your contact details and we will follow up.

← All articles

Comments (0)

Loading comments…

Leave a comment
No registration required

Book a strategy call
for agentic operations

Tell us which workflow you want to improve. We will map feasibility, risks, and the fastest MVP path.

By submitting, you agree to our privacy policy

Contacts

Global Operations

Serving U.S. clients remotely
with private cloud and on-prem options

Strategy calls by request

We respond after reviewing your workflow context.

info@agentsunrise.pro

For partnership inquiries

Have a proposal?

Write to us in messengers

© 2026 AgentSunrise