Semantic text splitting method development for rag systems with controlled threshold and sliding window size

The object of this study is Retrieval-Augmented Generation (RAG) systems used to improve the quality of responses by large language models (LLMs). The task addressed is to improve the efficiency of the semantic text segmentation stage in such systems, which directly affects the accuracy of extractin...

Full description

Saved in:
Bibliographic Details
Published inEastern-European journal of enterprise technologies Vol. 2; no. 2 (134); pp. 47 - 57
Main Authors Galchonkov, Oleg, Horchynskyi, Oleksii, Antoshchuk, Svetlana, Nareznoy, Volodymyr
Format Journal Article
LanguageEnglish
Published 22.04.2025
Online AccessGet full text
ISSN1729-3774
1729-4061
1729-4061
DOI10.15587/1729-4061.2025.326177

Cover

More Information
Summary:The object of this study is Retrieval-Augmented Generation (RAG) systems used to improve the quality of responses by large language models (LLMs). The task addressed is to improve the efficiency of the semantic text segmentation stage in such systems, which directly affects the accuracy of extracting relevant fragments. The work reports a method of semantic text segmentation for RAG systems, based on the sliding window technique with a dynamically changing size. The method devised uses embedding models and makes it possible to take into account the semantic context of the text. The adjustable value of the cosine similarity threshold used in semantic splitting makes it possible to additionally increase the relevance of query formation to LLM. The developed algorithm for setting this threshold value makes it possible to more fully take into account the specificity of the query subject. Compared to advanced methods of semantic text segmentation, the method devised provides the following gains depending on the maximum document size parameter: IoU from 0.2 % to 2.8 %, precision from 0.4 % to 3.1 %, omega precision from 1.4 % to 14.8 %. The gains are primarily associated with text processing at the level of semantically complete units in the form of sentences, rather than tokens. In addition, the dynamic sliding window technique allowed for better adaptation to the text structure. The results are valid within the framework of the used evaluation, which covers heterogeneous text datasets, and could be applied in practice when building RAG systems in industries with high requirements for preserving the semantic integrity of the text, for example, in law, science, or technology. The algorithms that implement the proposed method are posted on GitHub as Python libraries Об’єктом дослідження є системи Retrieval-Augmented Generation (RAG), що використовуються для покращення якості відповідей великих мовних моделей (LLM). Проблема, що вирішується в роботі, полягає у підвищенні ефективності етапу семантичного поділу тексту в таких системах, що безпосередньо впливає на точність витягування релевантних фрагментів. У роботі представлений метод семантичного поділу тексту для RAG-систем, заснований на техніці ковзного вікна з розміром, що динамічно змінюється. Розроблений метод використовує embedding-моделі та дозволяє враховувати семантичний контекст тексту. Додатково збільшити релевантність формування запитів до LLM дозволяє настроюване значення порога косинусної подібності, що використовується при семантичному розподілі. Розроблений алгоритм налаштування цього порогового значення дозволяє більш повно врахувати специфіку тематики запиту. У порівнянні з передовими методами семантичного поділу тексту розроблений метод дає наступний приріст залежно від параметра максимального розміру документа: IoU від 0.2 % до 2.8 %, точність від 0.4 % до 3.1 %, точність омега від 1.4 % до 14.8 %. Приріст передусім пов’зано з обробкою тексту на рівні семантично повних одиниць у вигляді речень, а не токенів. Крім того, техніка динамічного ковзного вікна дозволила ліпше адаптуватися до структури тексту. Отримані результати є валідними в межах використаного фреймворку оцінки, що охоплює різнорідні текстові датасети, і можуть бути застосовані на практиці при побудові RAG-систем у галузях з високими вимогами до збереження семантичної цілісності тексту, наприклад, у праві, науці чи техніці. Алгоритми, що реализуют запропонований метод, розміщені у GitHub як бібліотеки на Python
ISSN:1729-3774
1729-4061
1729-4061
DOI:10.15587/1729-4061.2025.326177