CN-121996618-A - RAG retrieval method and system oriented to software V-shaped development flow
Abstract
The invention provides a RAG retrieval method and a system for a software V-shaped development flow, wherein the method comprises the steps of receiving a technical document, and segmenting and identifying the document to obtain a document fragment set; the method comprises the steps of extracting engineering entities, identifications and attributes from documents, constructing binding relations between document fragments and the entities, constructing a knowledge graph containing nodes and node association relations in a graph database or triplets, constructing multidimensional vector representations of the document fragments, writing the vectors into a vector database, searching matched candidate document fragments based on user query semantics, carrying out neighborhood expansion on target entities in the knowledge graph to obtain candidate graphs, aligning the candidate document fragments with the candidate graphs, selecting a preset number of fragments ranked at the front to aggregate into evidence packages, inputting the evidence packages and a task generating instruction into a large language model, and generating search results based on a preset constraint decoding strategy. Through the scheme, the consistency of each stage in RAG retrieval can be ensured, and the content retrieval precision is improved.
Inventors
- ZHU DUNYAO
- QIN LINGYUN
- LU KAIXUAN
- LUO YUEJUN
- ZHANG LONG
Assignees
- 武汉光庭信息技术股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260313
Claims (10)
- 1. A RAG retrieval method for a software V-shaped development process is characterized by comprising the following steps: receiving a technical document related to software requirements, design and test, carrying out structural segmentation and layout semantic recognition on the technical document, and generating a document fragment set; Extracting a software engineering entity, an entity identifier and an attribute from a technical document based on a rule-guided joint embedded learning model, and constructing a binding relation between a document fragment and the entity; based on the binding relation, each stage of software requirement, design and verification is taken as a node in a graph database or a triplet respectively, and a knowledge graph comprising the node and the node association relation is constructed; constructing a multidimensional vector representation of the document fragment, and writing the vector into a vector database; After receiving a query request of a user, analyzing the query request semantics of the user, retrieving matched candidate document fragments in a vector database based on the query request semantics, and carrying out neighborhood expansion on a target entity in a knowledge graph according to the target entity in the query request semantics to obtain a candidate graph set; the candidate document fragments are aligned with the candidate atlas, the target entity associated fragments are weighted and ordered, a predetermined number of fragments with top rank are selected, and the fragments are aggregated into evidence packages according to the relation between the target entity and the fragments; inputting the evidence package and the generation task instruction into a large language model, and generating a search result based on the industrialized prompt template and a preset constraint decoding strategy.
- 2. The method of claim 1, wherein the node association relationships include at least design implementation requirement relationships, verification coverage requirement relationships, and design/verification derived dependencies; each node at least comprises a document version, a baseline label and a change record, and supports incremental update and historical traceability of node information.
- 3. The method of claim 1, wherein constructing a multidimensional vector representation of a document snippet and writing the vector into a vector database comprises: and respectively constructing a paragraph semantic vector, a fragment structure vector and an entity vector, and writing the vectors into a vector database, wherein each vector entry contains filterable metadata.
- 4. The method of claim 1, wherein parsing the query request semantics of the user after receiving the query request of the user comprises: when the query request does not contain the target entity ID, a candidate entity set is generated through enumeration matching and map fuzzy searching.
- 5. The method of claim 1, wherein the weighted ranking of target entity-associated segments by aligning candidate document segments with candidate atlases comprises: Through entity alignment, reserving fragments which can be mapped to a target entity or directly related to the target entity, and performing weight reduction or rejection on fragments which cannot locate entity IDs; Through link alignment, checking whether paths meeting the constraint of the V-shaped development flow exist in the map, and if so, scoring the map paths according to the path length, the relationship type and the coverage; And through consistency alignment, the fragments of different versions and different sources of the same entity are subjected to duplication removal and merging, and are checked according to the consistency principle of version priority and content hash, so that the confidence of conflict fragments is reduced.
- 6. The method of claim 1, wherein the evidence package at least comprises an entity ID, a relationship link, an original snippet, a source document location, a document version, and a content hash, and wherein the evidence package is stored in JSON format or in a table format.
- 7. The method of claim 1, wherein generating the search result based on the industrialised hint template and a predetermined constraint decoding policy further comprises: and reversely extracting the entity and the association relation from the search result text, comparing the entity and the association relation in the text with the evidence package in consistency, and triggering secondary search and rearrangement regeneration if missing or unauthorized references exist.
- 8. A RAG retrieval system oriented to a software V-shaped development flow is characterized by comprising: the document analysis module is used for receiving technical documents related to software requirements, design and test, carrying out structural segmentation and format semantic recognition on the technical documents, and generating a document fragment set; The entity extraction module is used for extracting the software engineering entity, the entity identifier and the attribute from the technical document based on the rule-guided joint embedded learning model, and constructing the binding relation between the document fragment and the entity; The map construction module is used for respectively taking each stage of software requirement, design and verification as a node in a graph database or a triplet based on the binding relation to construct a knowledge map comprising the node and the node association relation; the vector construction module is used for constructing multidimensional vector representation of the document fragment and writing the vector into the vector database; The semantic retrieval module is used for analyzing the query request semantics of the user after receiving the query request of the user, retrieving the matched candidate document fragments in the vector database based on the query request semantics, and carrying out neighborhood expansion on the target entity in the knowledge graph according to the target entity in the query request semantics to obtain a candidate graph set; The alignment and sequencing module is used for carrying out weighted sequencing on the target entity associated fragments by aligning the candidate document fragments with the candidate atlas; The evidence construction module is used for selecting a predetermined number of segments ranked at the front and aggregating the segments into an evidence packet according to the relation between the target entity and the segments; The result generation module is used for inputting the evidence package and the generation task instruction into the large language model, and generating a search result based on the industrialized prompt template and a preset constraint decoding strategy.
- 9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of a RAG retrieval method for a software V-word development process according to any one of claims 1 to 7 when the computer program is executed by the processor.
- 10. A computer-readable storage medium storing a computer program, wherein the computer program when executed implements the steps of a RAG retrieval method for a software V-word development process according to any one of claims 1 to 7.
Description
RAG retrieval method and system oriented to software V-shaped development flow Technical Field The invention belongs to the technical field of software engineering, and particularly relates to a RAG retrieval method and system for a software V-shaped development flow. Background The development of Electronic Control Units (ECU) for automobiles generally adopts a V-shaped model, which requires traceability and consistency to be maintained at various stages of demand, system/software design, implementation, verification, and validation. The relevant industry standards also put clear requirements on the occurrence life cycle, verification activities and traceability chains among workpieces, for example, ISO 26262 brings functional safety activities of safety related E/E systems of road vehicles into a set of frames, ASPICE provides process reference and evaluation models, and emphasizes process capability and measurement oriented to V models. With the search enhancement generation (RAG) becoming the main flow path to alleviate the limitations and illusion risk of Large Language Models (LLM) "closed-rolls", it has become more common to employ RAG to search for relevant development requirements in the V-word model. However, because the illusion of LLM has systematic causes, simple vector similarity search and concatenation context may still generate problems such as fact disagreement, evidence mismatch and semantic drift, especially in long document, cross-file, multi-stage scenes. Currently, various representative methods are proposed around the improvement of RAG, for example, in a search method based on Self-RAG, whether search and how to utilize search fragments are adaptively determined through a Self-checking search-Self-checking-Self-correcting strategy, so as to improve the facts and the reference accuracy of long texts, in a search method based on CRAG (Corrective RAG), the robustness of 'error search' can be improved by adding a search quality estimator and an error correction strategy after search, in a search method based on GraphRAG, a knowledge graph is constructed by utilizing private corpus, the prompt is enhanced by combining the graph and graph learning during search, and the method is obviously improved in narrative type/complex problems compared with the pure text RAG. The method can improve the retrieval reliability to a certain extent, but the retrieval content accuracy and the consistency of each link in the V-shaped development flow are still poor. Disclosure of Invention In view of the above, the embodiment of the invention provides a RAG retrieval method and a system for a software V-shaped development flow, which are used for solving the problems of poor accuracy and poor consistency of the current RAG retrieval. In a first aspect of the embodiment of the present invention, a RAG retrieval method for a software V-word development process is provided, including: receiving a technical document related to software requirements, design and test, carrying out structural segmentation and layout semantic recognition on the technical document, and generating a document fragment set; Extracting a software engineering entity, an entity identifier and an attribute from a technical document based on a rule-guided joint embedded learning model, and constructing a binding relation between a document fragment and the entity; based on the binding relation, each stage of software requirement, design and verification is taken as a node in a graph database or a triplet respectively, and a knowledge graph comprising the node and the node association relation is constructed; constructing a multidimensional vector representation of the document fragment, and writing the vector into a vector database; After receiving a query request of a user, analyzing the query request semantics of the user, retrieving matched candidate document fragments in a vector database based on the query request semantics, and carrying out neighborhood expansion on a target entity in a knowledge graph according to the target entity in the query request semantics to obtain a candidate graph set; the candidate document fragments are aligned with the candidate atlas, the target entity associated fragments are weighted and ordered, a predetermined number of fragments with top rank are selected, and the fragments are aggregated into evidence packages according to the relation between the target entity and the fragments; inputting the evidence package and the generation task instruction into a large language model, and generating a search result based on the industrialized prompt template and a preset constraint decoding strategy. In a second aspect of the embodiment of the present invention, a RAG retrieval system for a software V-word development process is provided, including: the document analysis module is used for receiving technical documents related to software requirements, design and test, carrying out structural segmentation an