One email each morning — yesterday's AI, sortedGet it in your inbox

METAL LAB

Natural Language Code Retrieval for 1C:Enterprise: An Open Benchmark and Efficient Bi-Encoder

arXiv:2608.199572026-08-21

A first-of-its-kind search benchmark and AI model let you find 1C business-software code using Russian-language questions

1C:Enterprise is widely used enterprise software in Russian-speaking countries, but until now there was almost no open data or dedicated model for searching its code with natural-language questions. Researchers built a benchmark of 3,413 real question-code pairs plus over 780,000 synthetic training examples, then trained a specialized search model on top of them. The resulting model clearly outperforms general-purpose multilingual embedding models on this task.

What they did

  1. The team collected 3,413 real Russian questions paired with 1C/BSL code from forums and the FastCode site, scrubbed personal information, and released it as the open 1C-Ebench benchmark
  2. Using 784,057 filtered public GitHub code files, they had Google's gemma-4-26B-A4B-it language model auto-generate Russian queries to build 784,057 synthetic training triplets, then fine-tuned the deepvk/USER2-base model on this data
  3. With a technique called Matryoshka Representation Learning, the model's embedding vectors (numeric representations of text) can be truncated to a shorter prefix with almost no quality loss, cutting storage and computation for similarity search by a factor of three
  4. The team audited overlap between training data and the benchmark, and found that removing every flagged overlapping example did not hurt performance, showing the strong results aren't just due to data leakage
  5. The final model reached a balanced macro nDCG@10 score of 0.5992, beating the unmodified base architecture (0.4932) and Google's embeddinggemma-300m (0.5404)
Figure 1: Construction of the public PruhaNLP/1C-Ebench benchmark and the dense-retrieval evaluation pipeline implemented in PruhaNLP/1C-RB.
Figure 1: Construction of the public PruhaNLP/1C-Ebench benchmark and the dense-retrieval evaluation pipeline implemented in PruhaNLP/1C-RB.
Table 1: Public resource stack.
ComponentContentScale
PruhaNLP/1C-EbenchTest pairs: question → code, subsets forum/fastcode3,413 pairs
PruhaNLP/1C-RBEvaluation harness: dense, BM25, metricsCLI/Python
PruhaNLP/1C-Code-TrainTriplets (q,d+,d−) with PII scrubbing784,057 triplets
PruhaNLP/USER2-1C-codeDomain-adapted reference bi-encoder768d, MRL
Figure 2: Construction of PruhaNLP/1C-Code-Train: from filtered public 1C code to synthetic queries, hard-negative triplets, PII scrubbing, and fine-tuning of PruhaNLP/USER2-1C-code.
Figure 2: Construction of PruhaNLP/1C-Code-Train: from filtered public 1C code to synthetic queries, hard-negative triplets, PII scrubbing, and fine-tuning of PruhaNLP/USER2-1C-code.
Table 2: PruhaNLP/1C-Ebench subsets.
SubsetQueriesShareSourceCharacterization
forum2,88384.5%Forum discussionsLong questions, context, errors, inline code
fastcode53015.5%Snippet catalogShort queries, long ready-to-use snippets
Total3,413100%Closed-set, single-gold qrels
Figure 3: nDCG@10 leaderboard on PruhaNLP/1C-Ebench (balanced-subset macro).
Figure 3: nDCG@10 leaderboard on PruhaNLP/1C-Ebench (balanced-subset macro).
Table 3: Train–benchmark overlap audit.
Metricforumfastcodeall
Exact match: code0.10%0.00%0.09%
Exact match: question0.03%8.68%1.38%
Exact match: pair0.00%0.00%0.00%
13-gram overlap: code6.24%16.23%7.79%
13-gram overlap: question0.03%8.68%1.38%
Input-only0.03%6.60%1.05%
Label-only6.24%14.15%7.47%
Input-and-label0.00%2.08%0.32%
Any 13-gram dirty flag6.28%22.83%8.85%
Figure 4: Matryoshka truncation: balanced-subset macro nDCG@10 by embedding dimension.
Figure 4: Matryoshka truncation: balanced-subset macro nDCG@10 by embedding dimension.
Table 4: PruhaNLP/USER2-1C-code configuration.
ParameterValue
Base modeldeepvk/USER2-base
ArchitectureModernBERT/RuModernBERT sentence-transformers encoder
Embedding dimension768
Maximum sequence length8,192
PoolingMean pooling
SimilarityCosine over L2-normalized embeddings
MRL dimensions768, 512, 384, 256, 128, 64, 32
Table 5: LLM-as-a-judge scores for 300 synthetic query–code pairs.
CriterionMeanMedianShare ≥4
Relevance4.33582.0%
Naturalness4.17576.3%
Clarity4.37582.0%
Table 6: Training hyperparameters.
ParameterValue
Training samples784,057 triplets
Batch size / MNRL mini-batch256 / 32
Epochs / steps3 / 9,189
Learning rate2×10−5
LR schedule5% cosine warmup + decay
Max sequence length / precision8,192 / FP16
Seed / hardware / runtime42 / A100 / ≈7.5 h
Table 7: Dense baselines and prompts. Empty means no prompt prefix.
ModelQuery promptDocument prompt
PruhaNLP/USER2-1C-codesearch_querysearch_document
deepvk/USER2-basesearch_querysearch_document
google/embeddinggemma-300mquerydocument
deepvk/USER-bge-m3emptyempty
ibm-granite/granite-embedding-311m-multilingual-r2querydocument
microsoft/harrier-oss-v1-270mweb_search_queryempty
intfloat/multilingual-e5-basequery:passage:
ai-forever/sbert_large_nlu_ruemptyempty
Table 8: nDCG@10 leaderboard on PruhaNLP/1C-Ebench.
RankModelforumfastcodemacromicro
1PruhaNLP/USER2-1C-code0.46170.73660.59920.5044
2google/embeddinggemma-300m0.37200.70800.54040.4242
3deepvk/USER2-base0.36700.61900.49320.4061
4deepvk/USER-bge-m30.34300.63900.49100.3890
5ibm-granite/granite-embedding-311m-multilingual-r20.31900.65100.48460.3706
6microsoft/harrier-oss-v1-270m0.32300.63600.47960.3716
7intfloat/multilingual-e5-base0.30700.55100.42900.3449
8ai-forever/sbert_large_nlu_ru0.09400.07900.08620.0917
BM25Okapi0.28650.33340.30990.2938
RRF(BM25 + PruhaNLP/USER2-1C-code)0.40000.46000.43000.4093
RRF(BM25 + deepvk/USER2-base)0.36200.41950.39080.3709
Table 9: Full @10 metrics for the reference dense model and BM25.
SystemSubsetnDCG@10Recall@10MRR@10
PruhaNLP/USER2-1C-codeforum0.46170.60080.4178
PruhaNLP/USER2-1C-codefastcode0.73660.92080.6774
BM25Okapiforum0.28650.34790.2670
BM25Okapifastcode0.33340.41890.3067
Table 10: Paired-bootstrap nDCG@10 comparisons.
ComparisonΔ95% CI / P
Macro: Ours vs. USER2-base+0.106[0.087, 0.125], P<0.001
Macro: Ours vs. EmbeddingGemma+0.0588[0.042, 0.075], P<0.001
RRF vs. dense (Ours), forum−0.062[−0.075,−0.049], P<0.05
RRF vs. dense (Ours), fastcode−0.277[−0.319,−0.234], P<0.05
RRF vs. dense (Base), forum−0.005[−0.016, 0.006], n.s.
RRF vs. dense (Base), fastcode−0.200[−0.237,−0.164], P<0.05
Table 11: Qualitative wins and failures (original Russian query/code). Gold rank: 1 = best; >10 = outside top-10.
Type / ranksQuery, gold, interpretation
Win (forum) Ours 1; others >10Q: Как обойти ограничения ФО на реквизит в динамическом списке, не трогая константу ФО? Gold: ОтключенныеПоля = Новый Массив; … FO×dynamic-list pattern; little lexical overlap with gold.
Win (fastcode) Ours 1; others >10Q: Описание строки в таблице значений Gold: ст90 = новый ОписаниеТипов("строка",,Новый КвалификаторыСтроки(90)); Colloquial «описание строки» → type API; lexical baselines miss it.
Fail (fastcode) Ours >10; base 1Q: Произношение текста голосом Gold: Voice = Новый COMObject("SAPI.SpVoice"); Voice.Speak("Привет!"); Rare COM API; general models recover Speak/SAPI.
Fail (fastcode) Ours 32; base 1Q: Сжатие длинной Строки Gold: СжатиеДанных = Новый СжатиеДанных(9); …Base64. Short generic title; surface «сжатие»+«строка» wins.
Table 12: MRL truncation on PruhaNLP/1C-Ebench.
Dimension mmacro nDCG@10RetentionRelative index size
7680.599100.0%1.00×
5120.600100.0%0.67×
3840.600100.0%0.50×
2560.59899.9%0.33×
1280.58497.5%0.17×
640.56093.5%0.08×
320.50383.9%0.04×

Why it matters

Code mixing Russian syntax with specialized business terminology previously had no public benchmark to even measure search quality, which stalled tool development for this domain. Because the benchmark, model, and training data are all released openly, anyone working on non-English or niche-domain code search can build on this work immediately.

Terms in this paper

  • bi-encoder · a search model architecture that encodes queries and documents into vectors independently, then compares them by similarity
  • nDCG@10 · a search quality metric measuring how highly the correct answer ranks among the top 10 results
  • Matryoshka Representation Learning (MRL) · a training method that lets an embedding vector be truncated to a shorter prefix while preserving most of its usefulness
  • BM25 · a classic keyword-matching search algorithm based on term overlap
  • PII scrubbing · automatically detecting and masking personal identifying information like emails or phone numbers

Original abstract (English)

Natural language code retrieval is a rapidly evolving task in computer science. However, the 1C:Enterprise ecosystem combines Russian syntax with highly domain-specific terminology, for which open datasets and specialized models have been virtually non-existent. We present a comprehensive pipeline for 1C code retrieval: an open benchmark of 3,413 real-world, PII-scrubbed query-code pairs, a reproducible evaluation harness, and a specialized bi-encoder. To overcome scarce labeled data, we fine-tune on 784,057 synthetic triplets generated by google/gemma-4-26B-A4B-it from public code repositories, using Matryoshka Representation Learning (MRL) and a privacy-aware tokenizer. Because the benchmark subsets differ in size, we report balanced-subset macro, query-weighted micro, and forum-only results. Our model reaches 0.5992 balanced macro nDCG@10, 0.5044 micro, and 0.4617 on forum, versus 0.4932 macro for the baseline architecture and 0.5404 for google/embeddinggemma-300m. Removing every benchmark example flagged by the conservative exact/13-gram overlap audit leaves 0.6011 balanced macro (0.5010 micro), indicating that detected train-benchmark overlap does not explain the headline result. MRL truncation to 256 dimensions preserves 99.9% of retrieval quality while reducing dense-index storage and exact similarity arithmetic by a factor of three.

Authors · Konstantin Chesnokov, Chingiz Mingazov

Read on arXiv

Latest papers

All papers →

Latest from METAL LAB

Figures: Konstantin Chesnokov et al., arXiv:2608.19957, arxiv-nonexclusive