Software quality report compliance detection method based on transformer and graph rag

By constructing a high-dimensional vector retrieval library and knowledge graph based on Transformer and Graph RAG, and combining it with a large model for software quality inspection, the inefficiency and inaccuracy of existing technologies are solved, enabling efficient and interpretable regulatory compliance review and improving the efficiency and accuracy of software quality inspection.

CN122195832APending Publication Date: 2026-06-12KAIYUAN HUACHUANG TECH (GRP) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
KAIYUAN HUACHUANG TECH (GRP) CO LTD
Filing Date
2026-03-10
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing software quality testing methods are inefficient, susceptible to human subjectivity, and fail to meet the requirements of efficient and accurate regulatory compliance review. Furthermore, they lack a unified way of expressing legal and standard clauses, and existing regulatory review systems struggle to maintain the incremental update capability of their knowledge bases and graphs.

Method used

We employ a Transformer and Graph RAG-based approach, constructing a high-dimensional vector retrieval library and knowledge graph, and combining it with a large model for compliance detection. This enables multi-channel fusion of semantic vectors and graph paths for clause matching and compliance review. We also introduce contrastive learning and Dempster–Shafer evidence theory for evidence fusion, ensuring the interpretability and traceability of the detection results.

Benefits of technology

It significantly improves the efficiency and accuracy of software quality report compliance review, can identify implicit conditions and conflicting clauses, generate interpretable compliance review reports, and achieve high recall and high precision detection with a response time of seconds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122195832A_ABST
    Figure CN122195832A_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of software quality detection, and provides a software quality report compliance detection method based on a Transformer and a Graph RAG, which comprises the following steps: collecting a plurality of reference documents; converting each reference document into a corresponding high-dimensional vector to construct a high-dimensional vector retrieval library; constructing a knowledge graph according to each reference document; converting a software quality report to be examined into a corresponding query vector, and determining the comparison result between the query vector and each high-dimensional vector; determining the comparison result between the entity of the software quality report to be examined and the knowledge graph; then retrieving a relevant reference document from the high-dimensional vector retrieval library according to the two comparison results; generating a compliance examination report according to the software quality report to be examined and the relevant reference document; and generating corresponding annotation information in the software quality report to be examined. The application can significantly improve the efficiency, accuracy and interpretability of software quality report compliance examination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software quality inspection technology, specifically to a software quality report compliance inspection method based on Transformer and GraphRAG. Background Technology

[0002] With the continuous expansion of software system scale and the deepening development of information technology, software quality testing and compliance review play an increasingly crucial role in industry supervision, security review, project acceptance, and legal liability allocation. Especially in high-level regulated industries such as finance, telecommunications, energy, healthcare, and government, software systems, from requirements analysis, design and development, testing and verification to operation and delivery, must comply with the stringent requirements of national laws and regulations, technical standards, and industry norms. Due to the vast, complex, and frequently updated normative systems in different fields, traditional review methods relying on manual reading and understanding are increasingly unable to meet the dual challenges of review efficiency and accuracy.

[0003] In the current field of software quality testing, testing personnel typically need to extract key clauses from multiple national standards (such as GB and GB / T), industry standards (such as CNAS and information security level protection standards), laws and regulations (such as the Cybersecurity Law, Data Security Law, and the National Monitoring Scheme for Software Product Quality), and internal organizational documents, and then compare and review each item against the content of the documents being tested. The areas of focus include functional compliance, data consistency, security control points, technical processes, document standardization, and the accuracy of the citations used in the testing. However, existing methods rely heavily on manual review and comparison, which is extremely inefficient and easily affected by human subjectivity, experience differences, and misunderstandings, leading to omissions, misjudgments, and even inconsistencies in the review process.

[0004] The fundamental reasons behind this inefficient model mainly include the following aspects: First, the regulatory standards are vast and complex, making it difficult for individuals to establish a robust knowledge system. The regulatory system related to software testing encompasses laws, administrative regulations, departmental rules, national standards, industry standards, and various technical guidelines. Examples include legal documents such as the *Cybersecurity Law*, *Data Security Law*, and *Personal Information Protection Law*; national standards such as the GB / T 25000 series and GB / T 22239; industry standards related to information system construction and service qualifications; and technical guidelines such as security hardening guidelines and testing method guidelines. These documents are typically lengthy, hierarchically complex, semantically rich, and highly normative. Furthermore, the clauses contain numerous relationships, constraints, dependencies, cross-references, and implicit scopes of application, making it difficult for testing personnel to construct a complete and searchable rule system.

[0005] Manual review lacks unified standards, and the judgment process is neither interpretable nor traceable. Manual clause searching and comparison typically fails to achieve full clause coverage, a structured and interpretable judgment process, traceable record of results, and consistency across multiple rounds of testing. In testing projects, review consistency and process traceability are critical requirements; therefore, manual methods are insufficient to meet actual project and regulatory needs. Existing retrieval methods cannot accurately support semantic-level clause matching. Traditional text retrieval methods, such as keyword retrieval, rule-based fuzzy matching, inverted index-based full-text retrieval, and BM25, all have serious limitations. They struggle to handle the numerous differences in technical terminology within technical standards, cannot identify implicit constraints and semantic meanings within the same clause, and cannot identify applicable scenarios, preconditions, and dependent clauses, thus failing to find truly relevant clauses to meet actual testing needs. There is a lack of unified methods for expressing legal and standard clause knowledge, resulting in insufficient structuring. Even with advanced NLP technology, without structured expression of regulatory clauses, accuracy in subsequent reasoning and analysis remains difficult.

[0006] Current industry knowledge graphs are mostly limited to the entity relationship level and lack deep semantic modeling. Some studies have attempted to construct regulatory knowledge graphs, but they still face significant problems, such as entity extraction being limited to noun-level recognition, insufficient relationship extraction coverage, lack of cross-document and cross-version rule alignment, limited graph embedding capabilities unable to support complex knowledge reasoning, insufficient modeling of entity synonym merging and clause dependency chains, and difficulty in modeling the logical structure of conflicting and binding clauses. Therefore, it is necessary to combine technologies such as structured semantic units, triple extraction, and RGCN relationship modeling to construct high-quality legal and standard knowledge graphs. The industry lacks a mature RAG-based regulatory clause compliance review system. While the large-scale RAG (Retrieval Enhanced Generation) framework has achieved significant results in the general question-answering domain, its application to regulatory review presents new challenges. For example, the retrieval library needs high-quality vectorized clause expressions; regulatory clause retrieval needs to combine semantic retrieval, graph retrieval, and keyword retrieval simultaneously; the generation model needs to be based on regulatory logic rather than just semantically relevant answers; compliance determination needs to be based on explicit clauses rather than speculation; it needs regulatory conflict detection and multi-evidence fusion capabilities; and the final output must not only provide a judgment but also offer traceable annotations and citations. Currently, the industry generally lacks intelligent regulatory compliance review systems capable of supporting the aforementioned needs. Existing regulatory review systems lack sustainable update capabilities. Because regulations and standards are constantly updated or replaced—for example, new and old versions of standards coexist, standard upgrades are often accompanied by structural adjustments, and externally referenced clauses may change at any time—traditional systems struggle to maintain the incremental update capabilities of their knowledge bases and graphs, leading to the continuous degradation of the rule system. Summary of the Invention

[0007] To address the shortcomings of existing technologies, the present invention aims to provide a software quality report compliance detection method based on Transformer and GraphRAG, which can significantly improve the efficiency, accuracy, and interpretability of software quality report compliance review.

[0008] This invention is implemented as follows: a software quality report compliance detection method based on Transformer and Graph RAG, comprising the following steps:

[0009] Step S1: Collect multiple original documents related to software inspection and detection to construct an original document set; and preprocess the multiple original documents in the original document set to obtain a reference document set; wherein, the reference document set includes multiple ordered reference documents;

[0010] Step S2: On the one hand, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector; on the other hand, entity extraction and relation extraction are performed on each reference document in the reference document set to construct a knowledge graph corresponding to the reference document set.

[0011] Step S3: Receive the software quality report to be reviewed input by the user; on the one hand, convert the software quality report to be reviewed into a corresponding query vector, and compare the similarity of the query vector with the high-dimensional vector in the high-dimensional vector retrieval library to obtain the vector similarity comparison result; on the other hand, extract entities from the software quality report to be reviewed, and compare the similarity of the entity extraction result of the software quality report to the knowledge graph to obtain the path similarity comparison result; then, based on the vector similarity comparison result and the path similarity comparison result, retrieve relevant reference documents from the high-dimensional vector retrieval library;

[0012] Step S4: Using the large model, output the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed based on the software quality report to be reviewed and its related reference documents. Generate a compliance review report of the software quality report to be reviewed based on the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed. And locate the compliance status, issue type, cited basis, risk level, and rectification suggestions of the software quality report to be reviewed in the original paragraphs or tables of the software quality report to be reviewed to generate annotation information.

[0013] As a further aspect of the present invention: the preprocessing of multiple original documents in the original document set to obtain a reference document set includes:

[0014] Multiple original documents in the original document set are preprocessed to obtain multiple reference documents; wherein, the preprocessing includes deduplication, format standardization and metadata annotation;

[0015] Multiple reference documents are encoded to obtain multiple ordered reference documents, and the reference document set is constructed based on the multiple ordered reference documents.

[0016] As a further aspect of the present invention: in step S2, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector, including:

[0017] Each reference document in the reference document set is divided into multiple semantically complete text segments, and the output is a collection of text segments. :

[0018] ;

[0019] in, Indicates the number of text segments in a reference document;

[0020] Collection of text fragments Each text fragment The data is input into the BERT-base-chinese pre-trained language model to extract its deep semantic features, thus obtaining each text segment. high-dimensional vectors :

[0021] ;

[0022] Among them, LMEncoder is a BERT-base-chinese pre-trained language model;

[0023] For all high-dimensional vectors corresponding to each reference document L2 normalization is performed to obtain a normalized high-dimensional vector. :

[0024] ;

[0025] Based on all text fragments from all reference documents and their corresponding normalized high-dimensional vectors A high-dimensional vector retrieval library corresponding to the reference document set was constructed.

[0026] As a further aspect of the present invention: in step S2, entity extraction and relation extraction are performed on each reference document in the reference document set to construct a knowledge graph corresponding to the reference document set, including:

[0027] (1) Entity extraction is performed on each reference document in the reference document set using the BERT-BiLSTM-CRF model:

[0028] First, each text fragment is obtained through the BERT encoding layer. The set of context vectors of the original entities in :

[0029] ;

[0030] in, For each text fragment The first in A primitive entity; B represents each text fragment. The number of original entities in the data; For the first Original entity Context vector;

[0031] Secondly, each original entity is captured by the BiLSTM layer. context vector Dependency characteristics to obtain each original entity Encoding context vector :

[0032] ;

[0033] Finally, each text fragment Each original entity in Encoding context vector Input to a CRF layer to output each text fragment. Optimal entity sequence Its matching score The calculation is as follows:

[0034] ;

[0035] in, For each text fragment and optimal entity sequence Match score, For the first The optimal entity The launch score, To obtain the optimal entity Transfer to the optimal entity The transition score; D represents the optimal entity sequence. The optimal number of entities in;

[0036] Construct the entity set corresponding to the reference document set based on the optimal entity sequence of all text fragments in the reference document set;

[0037] (2) Use a relation classification model to determine the relation category to which each entity pair in the entity set belongs:

[0038] Entity pairs are enumerated based on the entity set, and an input sequence corresponding to each entity pair is constructed based on each entity pair and its corresponding text fragment. The position vector of the input sequence is then extracted. Mapped to the relation category space through a fully connected layer:

[0039] ;

[0040] in, This is a score vector for the relation categories. and These are weights and biases, respectively.

[0041] The probability distribution of each entity pair belonging to each relation category is calculated using the Softmax function:

[0042] ;

[0043] in, Indicates in a given text fragment Head entity Tail entity Under the condition of relation category For the first The probability of a class; For the first A vector of scores for each relation category. Let be the score vector for the k-th relation category. The number of pre-designed domain relationship categories;

[0044] Based on the probability distribution of each entity pair belonging to each relation category, relation categories whose probabilities meet the threshold are selected to obtain the relation category to which each entity pair belongs. The final output is a structured triplet. :

[0045] ;

[0046] Structured triples are learned through embedding learning algorithms. Map the vector space to satisfy the following relational constraints:

[0047] ;

[0048] in, Representing the head entity respectively Vectors and relation categories vectors, tail entities ;

[0049] (3) Construct the knowledge graph corresponding to the reference document set based on the entity set corresponding to the reference document set and the relation category to which each entity pair in the entity set belongs.

[0050] As a further aspect of the present invention, it also includes:

[0051] For an entity v in the knowledge graph, generate its semantic fingerprint vector. Its formula is:

[0052] ;

[0053] Where Embedding represents the embedding model; This indicates vector concatenation; For an entity v, the ontology description; The document context content for a certain entity v; Let v be the adjacency category and adjacent entities of a given entity v;

[0054] Similarly, the semantic fingerprint vector of another entity u in the knowledge graph is generated as follows: Then the cosine similarity between entity v and entity u for:

[0055] ;

[0056] For entity pairs in the knowledge graph with a cosine similarity higher than 0.9, the nodes of the entity pair are merged, the alias list is retained, the structured triples of the entity pair are aggregated and deduplicated, so as to update the knowledge graph; for entity pairs in the knowledge graph with a cosine similarity not higher than 0.9, no processing is performed.

[0057] As a further aspect of the present invention, it also includes:

[0058] Define knowledge graph ,in, For a set of entity nodes, For the set of edges of relation categories;

[0059] The knowledge graph is iteratively updated using a relational graph convolutional network. Adjacency categories of entity nodes:

[0060] ;

[0061] in, Represents entity nodes In relation categories The set of adjacent entity nodes below, It is a set of relation categories; The normalization coefficient is... It is a non-linear activation function. For a relation-specific weight matrix, This indicates the number of layers in a graph convolutional network. and The first The original entity node of the layer and ; Original entity node In the +1 layer updated node representation; For self-loop weights.

[0062] As a further aspect of the present invention: step S3 includes:

[0063] The first step is to parse the software quality report to be reviewed to generate a set of paragraphs from the software quality report to be reviewed. and table collection ;in, For paragraph collection The number of paragraphs in the text For a set of tables The number of tables in the table;

[0064] Paragraph segmentation is based on the similarity calculation of adjacent semantic vectors:

[0065] ;

[0066] in, This refers to the i-th paragraph of the software quality report to be reviewed. This refers to the (i+1)th paragraph of the software quality report to be reviewed. For the i-th paragraph semantic vector; For the (i+1)th paragraph The semantic vector; when Segmentation is performed at specific times;

[0067] Similarity threshold Adopt a dynamic adjustment strategy:

[0068] ;

[0069] in, Based on the threshold, To adjust the coefficient, This represents the variance of the similarity between adjacent paragraphs. This refers to the j-th paragraph of the software quality report to be reviewed. This refers to the (j+1)th paragraph of the software quality report to be reviewed.

[0070] Use structured recognition algorithms to analyze the table set Each table in the table is split into multiple cells;

[0071] The second step involves performing semantic segmentation on the paragraphs and cells in the software quality report to be reviewed, generating multiple text slices d; and using a Transformer-based pre-trained language model to construct a dense vector for each text slice d. Simultaneously, TF-IDF and BM25 methods are used to construct sparse vectors for each text slice d. Then, a linear weighting strategy is used to generate the query vector for each text slice d. :

[0072] ;

[0073] in, For fusion weighting coefficients;

[0074] The third step is to obtain the query vector for each text slice d. With each normalized high-dimensional vector in the high-dimensional vector retrieval library Perform a similarity comparison to obtain the text slice d and each text fragment. Vector similarity between :

[0075] ;

[0076] The fourth step is to compare the similarity of the query entities of each text slice d in the software quality report to be reviewed with the knowledge graph to obtain the path similarity between the text slice d and the knowledge graph. ;

[0077] ;

[0078] Where Q is a query entity extracted from the software quality report to be reviewed. In knowledge graph All candidate paths originating from the query entity Q. for Any candidate path in the list, This is the path length penalty factor. For a single candidate path Length, For a single candidate path Any edge in, The edge weight;

[0079] The fifth step is to calculate the relationship between the text slice d and each text fragment. Final similarity between :

[0080] ;

[0081] in, These are the weighting coefficients;

[0082] Step 6: Based on the final similarity Multiple text segments in the high-dimensional vector retrieval library are sorted to select multiple relevant text segments from the high-dimensional vector retrieval library to form a set of relevant text segments for the text slice d.

[0083] As a further aspect of the present invention, it also includes:

[0084] Each text slice is generated using the Transformer encoder. The original semantic vector is obtained, and the original position of each text slice d in the software quality report to be reviewed is recorded; wherein, the Transformer encoder is based on a pre-trained legal domain language model and captures long-distance dependencies through a multi-head self-attention mechanism:

[0085] ;

[0086] Where Q is the query vector, K is the key vector, and V is the value vector; It is the vector dimension;

[0087] To enhance location awareness, relative location coding is introduced:

[0088] ;

[0089] in, It is the j-th text slice in the software quality report to be reviewed. The original semantic vector, PositionEncoding(·) is the position encoding function. It is the j-th text slice The original text location; It is the j-th text slice The final semantic vector.

[0090] As a further aspect of the present invention: step S4 includes:

[0091] First, the loss function based on contrastive learning. Optimize the semantic similarity between the query text slice and its related text fragments in the software quality report to be reviewed:

[0092]

[0093] in, The original semantic vector of the query text slice; These are positive examples, i.e., normalized high-dimensional vectors of relevant text fragments in the query text slice. ; For temperature parameters; This is the set of negative examples, i.e., text fragments that are irrelevant to the text slice in the query. This is a sample traversal variable used to iterate through the set of positive samples. } and negative sample set All samples in;

[0094] By temperature parameters Adjust the matching strictness to generate an initial semantic match score between the query text slice and its related text fragments. ;

[0095] Second, based on the initial semantic matching score The initial semantic matching score is selected from the set of relevant text fragments of the query text slice. Highly relevant text fragments exceeding a preset threshold are used to form a set of highly relevant text fragments. For the set of highly relevant text fragments Perform multi-rule conflict detection:

[0096] ;

[0097] in, This represents the set of highly relevant text fragments. Multi-rule conflict detection results; Each represents a set of highly relevant text fragments. Two highly relevant text fragments in the text, This indicates two highly correlated text fragments. Conflict detection results between them This represents the set of highly relevant text fragments. ; This indicates two highly correlated text fragments. Semantic similarity between them;

[0098] Third, the initial semantic matching scores between the fused query text slices and their highly relevant text fragments. and the set of highly relevant text fragments Multi-rule conflict detection results The overall compliance score of the query text slice is calculated. :

[0099] ;

[0100] in, Indicates the first One source of evidence for compliance events Support For the corresponding weights, For the complete collection, The total number of evidence sources involved in the fusion. Take 3; Initial semantic matching score For compliance events Support For multi-rule conflict detection results For compliance events Support Expert knowledge evidence for compliance events in industry rule bases Support level;

[0101] Fourth, fuzzy logic reasoning is used to calculate the risk level of the query text slice. :

[0102] ;

[0103] in: The overall compliance score for this query text slice. Assess the confidence level for this query text slice. The degree of impact of the violation on the query text slice;

[0104] Fifth, calculate the rectification suggestions for the query text slice. :

[0105] ;

[0106] in, The severity of the query text slice. Given the urgency of rectifying this query text slice, Evaluate the resources required for this query text slice;

[0107] Sixth, using a large model, the compliance status, issue type, and citation basis of the query text slice are generated based on the query text slice and its highly relevant text fragment set;

[0108] Seventh, based on the compliance status, problem type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed, generate a compliance review report for the software quality report to be reviewed;

[0109] Eighth, locate the compliance status, problem type, reference basis, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed to the original paragraph or table of the software quality report to be reviewed to generate annotation information.

[0110] As a further aspect of the present invention, it also includes:

[0111] The set of highly relevant text fragments was calculated based on first-order logical reasoning. Two highly relevant text fragments Conflict detection results between :

[0112] ;

[0113] in, This is suitable for highly relevant text fragments. Indicates highly relevant text fragments In applicable objects The following was established. Indicates highly relevant text fragments In applicable objects The following is not true; {⋅} is an indicator function.

[0114] Compared with existing technologies, the beneficial effects of this invention are: it can structure the vast and complex laws, regulations, and technical standards into a searchable and reasonable knowledge system, significantly improving the accuracy of clause matching and compliance review; through multi-channel fusion of semantic vectors and graph paths, it achieves recall and precision far exceeding traditional retrieval; relying on graph reasoning, rule conflict detection, and evidence fusion mechanisms, it can identify implicit conditions, dependencies, and conflicting clauses, making review conclusions more comprehensive and reliable; by introducing comparative learning, structured evidence chains, and regulatory constraint generation mechanisms, it effectively eliminates the illusion of large models, ensuring that all conclusions have clear basis, are explainable, and verifiable; and through hierarchical indexing and parallel computing, it achieves second-level response and has strong engineering usability. Attached Figure Description

[0115] Figure 1 The flowchart illustrates a software quality report compliance detection method based on Transformer and Graph RAG, provided by this invention.

[0116] Figure 2The flowchart illustrates a specific implementation method for a software quality report compliance detection method based on Transformer and Graph RAG provided by this invention.

[0117] Figure 3 The flowchart illustrates the construction process of the high-dimensional vector retrieval library for text fragments provided by this invention.

[0118] Figure 4 The retrieval flowchart of the multi-channel RAG retrieval module provided by this invention.

[0119] Figure 5 This is a structural diagram of the comparative learning module provided by the present invention. Detailed Implementation

[0120] The present invention will be further described in detail below with reference to embodiments, but the implementation of the present invention is not limited thereto.

[0121] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to represent selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0122] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0123] Definitions:

[0124] RAG (Retrieval-Augmented Generation) refers to a technical framework that incorporates external knowledge retrieval modules into the generation process of large models. By retrieving documents or terms relevant to the current question before or during generation, the retrieval results are provided to the generative model along with the original input to improve the accuracy, timeliness, and interpretability of the answers.

[0125] Legal and National Standards Knowledge Base: refers to a structured and semi-structured collection of documents such as laws, administrative regulations, departmental rules, national standards, industry standards, and technical guidelines. It may include clause texts, clause numbers, issuing authorities, scope of application, version information, and mutual reference relationships.

[0126] Knowledge graph: A graph-structured data model that organizes domain knowledge in the form of "entity-relationship-entity" triples. In this invention, it is mainly used to represent structured information such as constraints, dependencies, references, applicable objects, and applicable stages between legal provisions.

[0127] RGCN (Relational Graph Convolutional Network): A graph neural network model for graph data with multiple relation types. It achieves semantically distinguishable message passing and node representation updates by setting different transformation matrices for different relations.

[0128] ANN (Approximate Nearest Neighbor Search) refers to a method that uses an approximation algorithm to quickly find several vectors that are closest to the query vector in a high-dimensional vector space. It often uses hierarchical indexes, quantization, or graph structure indexes to significantly improve retrieval efficiency while ensuring recall quality.

[0129] TF-IDF and BM25: TF-IDF is a statistical method for measuring the importance of words in a document collection, while BM25 is an improved retrieval scoring function based on word frequency and document length normalization. Both are widely used in traditional text retrieval.

[0130] Dempster–Shafer evidence theory: a mathematical theory for dealing with uncertainty and incomplete information. It obtains the confidence and likelihood of a proposition by combining and conflict-measuring multiple sources of evidence. In this invention, it is used to integrate semantic retrieval evidence, graph reasoning evidence, and rule base evidence.

[0131] Contrastive Learning: A training paradigm that learns the representation space by "bringing positive samples closer and pushing negative samples further away." It often uses InfoNCE-type loss functions and is used in this invention to optimize the alignment between document fragments and applicable clauses, and between text vectors and graph vectors.

[0132] Semantic fingerprint: A high-dimensional vector representation generated by comprehensively considering entity text descriptions, context, and adjacency relationships, used to measure the semantic similarity between entities. In this invention, it is mainly used for cross-document and cross-version clause alignment and synonym entity merging.

[0133] OCR (Optical Character Recognition): A technology that converts text content in the form of scanned documents, images, etc., into editable text, which is used in this invention for parsing scanned regulations and standards documents.

[0134] This invention is based on the following theoretical foundation:

[0135] The software quality report compliance detection method based on Transformer and Graph RAG combines the generative capabilities of a large model with a verifiable regulatory knowledge injection mechanism, ensuring that the judgment process always relies on explicit clause evidence rather than statistical biases within the model. By incorporating external knowledge retrieval during the generation process, the large model can obtain stable knowledge constraints in regulatory reasoning tasks, significantly reducing the occurrence of unfounded generation and semantic illusions.

[0136] However, semantic similarity alone is insufficient to accurately express the structural logic of legal texts. Therefore, this invention further constructs a legal knowledge graph, reconstructing the constraint chains, dependency chains, and reference chains within the regulations in an entity-relationship format, thus explicitly representing the logical structure between clauses. The knowledge graph expresses a chain structure of "detection basis—control point—technical requirements—judgment criteria" through multi-level relationships, enabling the model to transcend the semantic surface and obtain the inherent logical topology of the regulations during reasoning. To overcome the structural gaps caused by modeling regulatory content solely with text vectors, this invention employs a relational graph convolutional network (RGCN) for embedding learning of the graph, simultaneously encoding clause semantics and structural constraints into a high-dimensional space, allowing semantic retrieval and logical retrieval to work collaboratively within a unified representation domain.

[0137] Regulatory retrieval also requires the integration of dense semantic vectors and sparse keyword features. This invention draws on the concept of multimodal fusion, simultaneously employing vector semantic retrieval and knowledge graph path retrieval during the retrieval phase. This enables the system to capture deep semantic information while also recognizing keyword constraints such as mandatory terms, numbers, and scope of application. The two types of retrieval signals are fused through a ranking model, achieving a balance between semantic relevance, regulatory logic, and terminological constraints in the recall results, thereby improving the comprehensiveness and accuracy of clause recall.

[0138] Since compliance judgment is essentially a reasoning and decision-making process based on multi-source information, relying solely on a single piece of evidence is insufficient to guarantee the stability of the judgment. This invention introduces a contrastive learning mechanism to ensure consistency between "document fragments—applicable clauses" and "clause text—graph structure" within a shared space, thereby guaranteeing a unified representational basis for cross-modal information during retrieval and reasoning stages. Simultaneously, it employs Dempster–Shafer evidence theory to fuse semantic, logical, and rule-based multi-source evidence, enabling the system to form mathematically reliable confidence judgments even when faced with conflicting evidence. This fusion approach ensures that the final conclusion is not only interpretable but also possesses quantifiable reliability.

[0139] To achieve engineering traceability during the review process, this invention constructs spatial structural identifiers for regulatory texts and testing documents during the document parsing stage, enabling review conclusions to be accurately traced back to the original paragraphs, table units, and clause source locations. Through the overall synergy of "knowledge retrieval—logical reasoning—evidence location," this invention transforms the regulatory system from linear documents into a knowledge structure that can be understood and reasoned about by machines, giving the large model stable logical constraints and a clear chain of evidence in complex review scenarios.

[0140] Example 1:

[0141] This invention provides a software quality report compliance detection method based on Transformer and Graph RAG, such as... Figure 1 As shown, please also refer to Figure 2 By deeply integrating the structured semantic units of the regulatory knowledge base, the logical links embedded in the knowledge graph, vector semantic retrieval, and the generative reasoning capabilities of the large model, the system can establish an interpretable, verifiable, and traceable mapping relationship between complex software testing documents and the vast regulatory system, thereby significantly improving the efficiency and accuracy of regulatory compliance review in software quality testing. The entire review process in this embodiment begins with regulatory document parsing, progressing through vector generation, knowledge graph construction, multi-channel retrieval, compliance reasoning, and finally report generation. Each step works collaboratively to form a complete closed loop; specifically, it includes the following steps:

[0142] Step S1: Collect multiple original documents related to software inspection and detection to construct an original document set; and preprocess the multiple original documents in the original document set to obtain a reference document set; wherein, the reference document set includes multiple ordered reference documents;

[0143] Step S2: On the one hand, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector; on the other hand, entity extraction and relation extraction are performed on each reference document in the reference document set to construct a knowledge graph corresponding to the reference document set.

[0144] It should be noted that by performing format normalization, semantic segmentation, extraction of the smallest semantic units, entity recognition, relation extraction, triple construction, clause number hierarchy restoration, and restoration of the inter-regulatory reference chain structure on original legal documents, administrative regulations, national standards, industry standards, and technical guidelines, a machine-processable structured regulatory knowledge system is achieved. The goal of this embodiment is to transform the original regulations from linear document form into a structured semantic set of clauses that supports retrieval, matching, reasoning, and tracing, enabling regulatory knowledge to serve as the foundation for subsequent multi-channel RAG retrieval and compliance reasoning.

[0145] Step S3: Receive the software quality report to be reviewed input by the user; on the one hand, convert the software quality report to be reviewed into a corresponding query vector, and compare the similarity of the query vector with the high-dimensional vector in the high-dimensional vector retrieval library to obtain the vector similarity comparison result; on the other hand, extract entities from the software quality report to be reviewed, and compare the similarity of the entity extraction result of the software quality report to the knowledge graph to obtain the path similarity comparison result; then, based on the vector similarity comparison result and the path similarity comparison result, retrieve relevant reference documents from the high-dimensional vector retrieval library;

[0146] Step S4: Using the large model, output the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed based on the software quality report to be reviewed and its related reference documents. Generate a compliance review report of the software quality report to be reviewed based on the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed. And locate the compliance status, issue type, cited basis, risk level, and rectification suggestions of the software quality report to be reviewed in the original paragraphs or tables of the software quality report to be reviewed to generate annotation information.

[0147] Example 2:

[0148] This embodiment is a further optimization based on the above embodiments. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, the preprocessing of multiple original documents in the original document set to obtain a reference document set includes:

[0149] Multiple original documents in the original document set are preprocessed to obtain multiple reference documents; wherein, the preprocessing includes deduplication, format standardization and metadata annotation to ensure the uniqueness and consistency of the reference documents;

[0150] Specifically, an approximate deduplication algorithm based on SimHash is used to generate and compare fingerprints of the original document content, identify and remove original documents with duplicate or highly similar content, and avoid redundant information from interfering with subsequent modeling. At the same time, the source, publication time, and version number in the metadata of the original document are retained for traceability. Since the original documents come from various sources such as PDF, Word, HTML, and scanned OCR text, they need to be uniformly converted into a structured plain text format.

[0151] Multiple reference documents are encoded to obtain multiple ordered reference documents, and the reference document set is constructed based on the multiple ordered reference documents.

[0152] Specifically, in order to achieve traceability and cross-border differentiation of reference documents, the reference documents are coded using the ISO3166-1 two-letter country code to identify different countries or regions. At the same time, a hierarchical classification coding structure is designed to correspond to laws and regulations, national standards and industry specifications, providing scalability for subsequent knowledge graph construction and vector retrieval.

[0153] Example 3:

[0154] This embodiment is a further optimization based on the above embodiments. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, as follows... Figure 3 As shown, in step S2, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector, including:

[0155] In the parsing phase of the reference documents, a combination of pre-trained language models and natural language processing techniques is used to convert unstructured text into structured semantics. Since legal regulations and standards reference documents are typically lengthy and complex, they need to be broken down into text fragments. BERT-based-chinese is used to encode these text fragments. Combining text structure features and semantic coherence, a sliding window + inter-sentence similarity judgment strategy is employed to divide each reference document in the reference document set into multiple semantically complete text fragments, outputting a set of text fragments. :

[0156] ;

[0157] in, This indicates the number of text fragments in a given reference document; each text fragment... A text fragment with independent legal or technical meaning;

[0158] Collection of text fragments Each text fragment The data is input into the BERT-base-chinese pre-trained language model to extract its deep semantic features, thus obtaining each text segment. high-dimensional vectors :

[0159] ;

[0160] Among them, LMEncoder is a BERT-base-chinese pre-trained language model;

[0161] To eliminate vector scale differences across different reference documents and contexts, and to improve consistency in cross-document retrieval, it is necessary to process all high-dimensional vectors corresponding to each reference document. L2 normalization is performed to obtain a normalized high-dimensional vector. :

[0162] ;

[0163] Based on all text fragments from all reference documents and their corresponding normalized high-dimensional vectors A high-dimensional vector retrieval library corresponding to the reference document set was constructed.

[0164] In this embodiment, legal regulations, national standards, and industry specifications related to software quality testing are first acquired. These documents come in various formats, including PDF, scanned versions, Word, HTML, and online API text. During the import phase, the system uses layout parsing and an OCR engine to uniformly parse the documents. For scanned or image documents, this embodiment uses an OCR model based on CTC (Connectionist Temporal Classification) to recover the text and correct issues such as paragraph breaks, table boundaries, and misaligned numbering, ensuring that the document content maintains structural integrity when entering the semantic processing stage. For documents containing tables, appendices, and illustrations, this embodiment labels each structural region with its type, enabling subsequent semantic segmentation to be performed according to structural boundaries.

[0165] Example 4:

[0166] This embodiment is a further optimization based on the above embodiments. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, step S2 involves entity extraction and relation extraction for each reference document in the reference document set to construct the knowledge graph corresponding to the reference document set, including:

[0167] To achieve the transformation from text fragments to knowledge, a triplet extraction model combining rule-driven and sequence labeling is adopted to extract knowledge from each text fragment. The system identifies entities and their relationships. Specifically, it uses an entity recognition model to extract key elements from text fragments that constitute the meaning of regulatory clauses. These elements include principal entities (such as "software system," "data processing entity," and "testing organization"), behavioral entities ("should provide," "must meet," and "must not appear"), restrictive conditions ("after successful user authentication," and "during system initialization"), technical parameters, and rule requirements. The identification of these entities relies on a sequence labeling model based on BERT-BiLSTM-CRF.

[0168] (1) Entity extraction is performed on each reference document in the reference document set using the BERT-BiLSTM-CRF model:

[0169] First, each text fragment is obtained through the BERT encoding layer. The set of context vectors of the original entities in :

[0170] ;

[0171] in, For each text fragment The first in A primitive entity; B represents each text fragment. The number of original entities in the data; For the first Original entity Context vector;

[0172] Secondly, each original entity is captured by the BiLSTM layer. context vector Dependency characteristics to obtain each original entity Encoding context vector :

[0173] ;

[0174] Finally, each text fragment Each original entity in Encoding context vector Input to a CRF layer to output each text fragment. Optimal entity sequence Its matching score The calculation is as follows:

[0175] ;

[0176] in, For each text fragment and optimal entity sequence Match score, For the first The optimal entity emission score (representing the optimal entity at each location) (Degree of matching with the corresponding text fragment) To obtain the optimal entity Transfer to the optimal entity The transition score; D represents the optimal entity sequence. The optimal number of entities in;

[0177] Construct the entity set corresponding to the reference document set based on the optimal entity sequence of all text fragments in the reference document set;

[0178] (2) In the relation classification stage, based on the pre-designed set of domain relation categories, the relation classification model BERT+Softmax is used to determine the relation category to which each entity pair in the entity set belongs:

[0179] Entity pairs are enumerated based on the entity set, and an input sequence corresponding to each entity pair is constructed based on each entity pair and its corresponding text fragment. The position vector of the input sequence is then extracted. Mapped to the relation category space through a fully connected layer:

[0180] ;

[0181] in, This is a score vector for the relation categories. and These are the weights and biases of the fully connected layer, respectively.

[0182] To convert the score vectors into probabilities, the Softmax function is used to calculate the probability distribution of each entity pair belonging to each relation category:

[0183] ;

[0184] in, Indicates in a given text fragment Head entity Tail entity Under the condition of relation category For the first The probability of a class; For the first A vector of scores for each relation category. Let be the score vector for the k-th relation category. The number of pre-designed domain relationship categories;

[0185] Based on the probability distribution of each entity pair belonging to each relation category, relation categories whose probabilities meet the threshold are selected to obtain the relation category to which each entity pair belongs. By using regular expressions and dependency parsing templates to assist extraction, the accuracy is improved, and the final output is a structured triple. :

[0186] ;

[0187] Structured triples are learned through embedding learning algorithms. Map the vector space to satisfy the following relational constraints:

[0188] ;

[0189] in, Representing the head entity respectively Vectors and relation categories vectors, tail entities ;

[0190] (3) Construct the knowledge graph corresponding to the reference document set based on the entity set corresponding to the reference document set and the relation category to which each entity pair in the entity set belongs.

[0191] To further enhance the semantic extraction of regulations, this invention constructs a deep entity relationship network, incorporating dependencies within the same clause, between clauses, and across documents into a unified system for expression. For example, for clauses containing multi-layered conditional structures, this invention extracts subjects, behaviors, constraints, and technical requirements through an entity recognition model, and then establishes the dependencies between them through the aforementioned relationship classification model, transforming the structural information in the text into vector constraints in geometric space. These vector space relational constraints enable the knowledge graph to support cross-clause, multi-hop logical reasoning, providing a deep structural foundation for complex regulatory judgments.

[0192] After entity recognition is completed, this embodiment performs relationship extraction on the text fragment, identifying the dependencies, constraints, references, and applicable conditions between entities, as well as structured logic such as "subject-behavior," "behavior-condition," and "clause-reference clause." For example, when the text fragment contains "the system should support automatically recording login events after successful user authentication," this embodiment identifies the entities as "system" (subject), "should support" (behavior), "after successful user authentication" (condition), and "record login events" (action requirement), and extracts the relationships "subject-behavior," "behavior-condition," and "behavior-action requirement."

[0193] Example 5:

[0194] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, it also includes:

[0195] To achieve synonym resolution between different entities, knowledge fusion is achieved using a word embedding model. This model learns word vector representations from a large-scale corpus, capturing both semantic and contextual information. Semantically similar words are also close in distance within the vector space. However, relying solely on entities has limited semantic depth; therefore, it is necessary to fully utilize the ontology descriptions, contextual content, adjacency categories, and neighboring entities of each entity to obtain a more comprehensive and integrated representation. For a given entity v in the knowledge graph, its semantic fingerprint vector is generated. Its formula is:

[0196] ;

[0197] Where Embedding represents the embedding model; This indicates vector concatenation; For an entity v, the ontology description; The document context content for a certain entity v; Let v be the adjacency category and adjacent entities of a given entity v;

[0198] Similarly, the semantic fingerprint vector of another entity u in the knowledge graph is generated as follows: Then the cosine similarity between entity v and entity u for:

[0199] ;

[0200] Cosine similarity based on semantic fingerprint vectors can be used to measure the similarity between complex entities. For entity pairs in the knowledge graph with a cosine similarity higher than 0.9, the nodes of the entity pair are merged, the alias list is retained, the structured triples of the entity pair are aggregated and deduplicated, so as to update the knowledge graph and make the knowledge graph more compact and consistent. Entity pairs in the knowledge graph with a cosine similarity not higher than 0.9 are not processed.

[0201] The final output includes text fragments, normalized high-dimensional vectors, structured triples and their semantic fingerprint vectors, providing basic data support for subsequent knowledge graph updates and RAG retrieval modules.

[0202] Example 6:

[0203] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, it also includes:

[0204] To fully explore the structural information and relational patterns in knowledge graphs, this embodiment defines a knowledge graph. ,in, For a set of entity nodes, For the set of edges of relation categories; Initially possessing feature vectors This vector can come from the encoded output of a pre-trained language model or be randomly initialized;

[0205] The knowledge graph is iteratively updated using a relational graph convolutional network (RGCN). The adjacency categories of entity nodes are considered, where the relational graph convolutional network aggregates neighbor information by considering the specificity of relation types and iteratively updates the node representation. At each layer... arrive During the propagation of +1, entity nodes The update formula is as follows:

[0206] ;

[0207] in, Represents entity nodes In relation categories The set of adjacent entity nodes below, It is a set of relation categories; These are the normalization coefficients; It is a nonlinear activation function, which introduces nonlinear transformation capability; For a relation-specific weight matrix, This indicates the number of layers in a graph convolutional network. and The first The original entity node of the layer and ; Original entity node In the +1 layer updated node representation; The self-loop weights preserve the historical characteristics of the nodes themselves; the double-layer summation corresponds to the aggregation logic of "relationship + neighbor".

[0208] It should be noted that transformation parameters are learned independently for each relation category r∈R, enabling the model to distinguish the transmission patterns of different semantic relations such as "requirement", "prohibition", "reference", and "inheritance".

[0209] Therefore, by iteratively updating and deeply encoding the node representations of the knowledge graph through Relational Graph Convolutional Network (RGCN), complex logical dependencies such as "detection method---compliance criterion---re-inspection process---responsible entity" are explicitly modeled, providing structured and interpretable evidence support for compliance reasoning.

[0210] Through multi-layered RGCN stacking (typically 3-5 layers), knowledge graphs can express complex logical dependencies such as "detection method—qualification criteria—re-inspection process—responsible entity," providing structured evidence support for subsequent RAG retrieval and compliance reasoning. For example, for the topic of "software security detection," the first layer of the network aggregates directly related "detection method" nodes; the second layer further propagates to "qualification criteria" and "test case design rules"; and the third layer extends to "non-compliance re-inspection process" and "responsible entity identification." This hierarchical information propagation mechanism ensures that node embeddings not only include the semantic features of the entity itself but also integrate its topological position and functional role in the knowledge network, forming a high-dimensional graph embedding capable of describing complex business logic.

[0211] Specifically, addressing the unique needs of the software quality inspection field, this embodiment designs a domain-specific relationship type system, including but not limited to: "applicable scenarios" (correspondence between clauses and inspection stages), "logical dependencies" (preconditional relationships between clauses), "mutual exclusion relationships" (marking of contradictory clauses), "reference relationships" (pointing associations between clauses), and "attribution of responsibility" (connection between violations and the penalizing entity). By introducing these structured constraints during RGCN training, the node embeddings learned by the model naturally possess the logical consistency required for compliance reasoning.

[0212] During the training phase, this embodiment employs a multi-task learning framework combining link prediction and entity classification. The link prediction task enhances the structural integrity of the embedding by calculating scoring functions for head entities, relations, and tail embeddings (such as h+r≈t in TransE or the bilinear model in DistMult) to predict missing edges in the graph. The entity classification task, on the other hand, utilizes node embeddings to predict entity types (such as "mandatory clauses," "recommended guidelines," and "technical parameters"), introducing semantic supervision signals. The joint optimization of these two tasks ensures that the graph embedding maintains both structural integrity and semantic discriminability.

[0213] Ultimately, the graph embedding encoded by RGCN provides crucial structured evidence for RAG retrieval. When the retrieval module processes document fragments under review, it can not only find relevant clauses through vector similarity but also use graph embedding to calculate the strength of logical connections between clauses, identifying potential preconditions, subsequent processes, or conflicting clauses, significantly improving the depth and accuracy of compliance review.

[0214] Example 7:

[0215] This embodiment is a further optimization based on the above embodiments. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, as follows... Figure 4 As shown, step S3 includes:

[0216] The first step is to perform OCR parsing on the software quality report to be reviewed, extracting paragraphs, tables, and layout information to generate a set of paragraphs for the software quality report to be reviewed. and table collection ;in, For paragraph collection The number of paragraphs in the text For a set of tables The number of tables in the table;

[0217] Combining text structure features and semantic coherence, a sliding window + inter-sentence similarity judgment strategy is adopted. Paragraph segmentation is based on the similarity calculation of adjacent semantic vectors:

[0218] ;

[0219] in, This refers to the i-th paragraph of the software quality report to be reviewed. This refers to the (i+1)th paragraph of the software quality report to be reviewed. For the i-th paragraph The semantic vectors are obtained through a pre-trained language model; For the (i+1)th paragraph The semantic vectors are obtained through a pre-trained language model; when Paragraphs should be split in a timely manner to ensure the integrity of semantic boundaries; this method can avoid over-splitting and prevent multiple legal provisions from being inappropriately merged.

[0220] Similarity threshold Adopt a dynamic adjustment strategy:

[0221] ;

[0222] in, Based on the threshold, To adjust the coefficient, This represents the variance of the similarity between adjacent paragraphs. This refers to the j-th paragraph of the software quality report to be reviewed. This refers to the (j+1)th paragraph of the software quality report to be reviewed.

[0223] Using structured recognition algorithms to analyze the table set Each table in the document is divided into multiple cells. For table-type software detection records, this embodiment uses a table structure recognition model to recover the cell matrix structure and extract the text and coordinates of each cell. For cells that span multiple rows or columns, this embodiment divides them into multiple virtual units and records the mapping relationship to ensure it does not affect subsequent vectorization processing. Each cell generates a text slice, which is bound to its coordinate information for locating the original text of the compliance review results.

[0224] The second step involves performing semantic segmentation on the paragraphs and cells in the software quality report to be reviewed, generating multiple text slices d; and using a Transformer-based pre-trained language model to construct a dense vector for each text slice d. Simultaneously, TF-IDF and BM25 methods are used to construct sparse vectors for each text slice d. Then, a linear weighting strategy is used to generate the query vector for each text slice d. :

[0225] ;

[0226] in, To integrate weighting coefficients, dynamic adjustments are made based on text features and retrieval scenarios; for abstract terms requiring strong semantic understanding, improvements are made. Values ​​are used to enhance the impact of dense vectors; for precise matching scenarios involving specific technical parameters and regulatory numbers, the impact is reduced. The value is used to highlight the keyword matching ability of sparse vectors.

[0227] It should be noted that, in order to enhance the correspondence between the text slices to be reviewed and the legal provisions, this embodiment binds structural tags to the text slices to be reviewed while generating the query vector. These tags include chapter number, paragraph level, table type, cell category (such as "expected result", "actual result", "passed"), test number, etc., which are used to improve the accuracy of similarity calculation in the subsequent retrieval stage.

[0228] Through processing, all text slices to be reviewed are uniformly converted into a set of query vectors with clear structure, carrying original text location information and possessing deep semantic expression, providing standardized input for subsequent legal clause retrieval, knowledge graph reasoning and compliance determination.

[0229] Furthermore, to support multi-granularity retrieval requirements, this embodiment also implements a hierarchical vectorization strategy. For long text slices, the system generates vector representations at different levels: document-level vectors capture the overall theme, paragraph-level vectors represent local semantics, and sentence-level vectors focus on specific statements. These multi-granularity vectors are stored through a hierarchical index structure, supporting adaptive selection of the optimal matching granularity based on query length and complexity during the RAG retrieval stage. The resulting unified vector representation not only serves dense vector retrieval but also provides standardized input for subsequent graph embedding alignment and semantic similarity calculation, significantly improving the matching accuracy and recall rate between complex legal clauses and detected documents.

[0230] It should be noted that by converting complex and inconsistent software quality reports to be reviewed into searchable, inferable, and traceable semantic vector fragments, the software quality reports to be reviewed can be accurately entered into the subsequent RAG retrieval module and knowledge graph inference module, laying the foundation for original text-based compliance review.

[0231] The first step is to receive software quality reports for review, including various types such as test plans, test case design documents, test case execution records, test reports, problem rectification instructions, requirements specifications, detailed design specifications, interface specifications, deployment manuals, and user manuals. Due to the significant differences in the sources and formats of these documents, layout parsing and format standardization are required first. For Word and PDF documents, this embodiment uses a layout structure analysis model to identify paragraphs, headings, numbering systems, headers and footers, table areas, image areas, and appendix structures, and uses a rule engine to restore the chapter hierarchy. For scanned documents and image format documents, this embodiment uses an OCR model to identify text areas and uses a layout analysis network to separate paragraph blocks, table borders, row and column coordinates, and text blocks to ensure complete restoration of structural information.

[0232] After restoring the layout structure, this embodiment performs semantic segmentation on the software quality report to be reviewed, dividing the software quality report to be reviewed into text slices suitable for vector representation.

[0233] To improve search performance, cross-modal alignment optimization is introduced to ensure consistency between the two vector representations in the semantic space. The resulting unified vector representation provides multi-level semantic matching and clause recall support for the RAG search module.

[0234] The RAG search module performs two types of searches: vector search and relational link search.

[0235] The third step is vector retrieval, which involves finding the query vector for each text slice d. With each normalized high-dimensional vector in the high-dimensional vector retrieval library Perform a similarity comparison to obtain the text slice d and each text fragment. Vector similarity between :

[0236] ;

[0237] It should be noted that this vector retrieval method can capture implicit semantic relationships. Even if the query text slice and the legal clause differ significantly at the lexical level (e.g., using synonyms or different sentence structures), as long as the semantic connotations are similar, a high similarity score can still be obtained. To improve retrieval efficiency, this embodiment adopts an approximate nearest neighbor (ANN) index structure based on HNSW (Hierarchical Navigable Small World) or IVF (Inverted File Index), which reduces retrieval complexity from linear to logarithmic while maintaining high accuracy.

[0238] The fourth step is graph path retrieval, which involves comparing the similarity of the query entity of each text slice d in the software quality report to be reviewed with the knowledge graph to obtain the path similarity between the text slice d and the knowledge graph. Path similarity calculation takes into account both edge weights and path length.

[0239] ;

[0240] Where Q is a query entity extracted from the software quality report to be reviewed. In knowledge graph All candidate paths originating from the query entity Q. for Any candidate path in the list; This is a path length penalty factor (0 < γ ≤ 1), used to suppress noise accumulation on excessively long paths; For a single candidate path The length (measured by the number of sides). For a single candidate path Any edge in, The edge weights (reflecting the strength of the relationship) are used to discover implicit logical connections. For example, when a document mentions "insufficient log storage", the relationship link retrieval not only returns the direct "log retention period" clause, but also recalls the relevant re-inspection procedure requirements and liability determination rules through the path of "detection method---non-compliance criteria---re-inspection process".

[0241] It should be noted that this approach utilizes a knowledge graph to calculate the association strength between query entities and text fragments based on the graph structure. This retrieval strategy does not directly compare text vectors; instead, it examines the topological distance and relational path quality between the two within the knowledge graph. For a given query entity Q, the system first identifies its corresponding node in the knowledge graph and then explores the multi-hop neighbor paths of that corresponding node.

[0242] The fifth step involves fusing the two types of search results using a Learning to Rank (LTR) model. Unlike simple score weighting, the LTR model learns the optimal ranking strategy through training data, considering features such as: the original scores of each type of search, the document-to-query length ratio, the timeliness of the terms, and historical click-through rates. This involves calculating the relationship between the text slice d and each text fragment. Final similarity between :

[0243] ;

[0244] in, The weighting coefficients are used for the second-class retrieval scores. Instead of fixed values, these values ​​are dynamically adjusted using Gradient Boosting Decision Tree (GBDT) or neural networks. During the training phase, the system utilizes click logs from historical review records and manually labeled relevance tags to optimize model parameters, prioritizing highly relevant items.

[0245] Step 6: Based on the final similarity Multiple text segments in the high-dimensional vector retrieval library are sorted to select multiple relevant text segments from the high-dimensional vector retrieval library to form a set of relevant text segments for the text slice d, providing input for the compliance assessment module.

[0246] To further improve retrieval quality, this embodiment introduces a re-ranking mechanism. The top K candidate terms (typically K=50 or 100) recalled during the initial screening stage are input into a cross-encoder. This model concatenates the query text with the candidate terms and inputs them into a Transformer, capturing fine-grained interaction features through an attention mechanism to generate more accurate relevance scores. This "dual-tower recall + cross-encoding fine-ranking" architecture balances retrieval efficiency and ranking accuracy.

[0247] Furthermore, considering that software inspection documents often contain tabular data, this embodiment implements structure-aware matching during the retrieval phase. When a query fragment originates from a table cell, the system not only matches the cell content but also considers the contextual constraints provided by its column headings (such as "Test Item", "Actual Result", "Compliant"), thereby enhancing the structural features in the query vector and improving the accuracy of matching tabular data with regulatory clauses.

[0248] Through the collaborative work and intelligent integration of the two types of retrieval described above, this embodiment can generate a set of relevant clauses with high confidence for each document fragment to be reviewed. This set includes not only semantically similar normative clauses, but also logically related process requirements and precisely matched technical indicators, providing comprehensive and multi-faceted evidence support for the subsequent compliance assessment module and significantly improving the accuracy of regulatory application in complex software quality testing scenarios.

[0249] Example 8:

[0250] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, it also includes:

[0251] Each text slice is generated using the Transformer encoder. The original semantic vector is obtained, and the original position of each text slice d in the software quality report to be reviewed is recorded; wherein, the Transformer encoder is based on a pre-trained legal domain language model and captures long-distance dependencies through a multi-head self-attention mechanism:

[0252] ;

[0253] Where Q is the query vector, K is the key vector, and V is the value vector, the core of which is to calculate the matching degree of the text slice; The vector dimension is used. After Softmax normalization, the weighted sum is used to obtain the attention output.

[0254] To enhance location awareness, relative location coding is introduced:

[0255] ;

[0256] in, It is the j-th text slice in the software quality report to be reviewed. The original semantic vector, PositionEncoding(·) is the position encoding function. It is the j-th text slice The original text location; It is the j-th text slice The final semantic vector. This includes the original text location information. Integrating the original semantic vector It supports precise original text location and annotation generation.

[0257] The above vector It preserves semantic information and associates with the original text location, providing high-precision input for RAG stage clause matching, while also supporting subsequent annotation generation and paragraph positioning.

[0258] Example 9:

[0259] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, step S4 includes:

[0260] The RAG search module mentioned earlier only outputs the final similarity between the query text slice and its related text fragments. Semantic matching degree analysis optimizes semantic similarity calculation through a contrastive learning framework, solving the technical pain point of "consistent literal matching but semantic inconsistency, and semantically related but literal differences" in basic matching, and further improving the accuracy of query matching with legal clauses;

[0261] First, such as Figure 5 As shown, the loss function based on contrastive learning Optimize the semantic similarity between the query text slice and its related text fragments in the software quality report to be reviewed:

[0262]

[0263] in, The original semantic vector of the query text slice; These are positive examples, i.e., normalized high-dimensional vectors of relevant text fragments in the query text slice. ; Represents the cosine similarity function; This is a temperature parameter used to adjust the strictness of semantic matching, and its value range is usually (0,1]. The smaller the value, the higher the matching strictness, and the stronger the model's sensitivity to semantic differences; The larger the value, the lower the matching strictness, allowing for a certain degree of semantic deviation; The negative sample set is a collection of text fragments that are irrelevant or have low relevance to the query text slice. This is a sample traversal variable used to iterate through the set of positive samples. } and negative sample set All samples in the dataset; the loss function for contrastive learning. The parameters used to optimize the semantic similarity calculation model are: the smaller the loss value, the higher the model's ability to distinguish between "positive examples" and "negative examples", and the more accurate the semantic matching.

[0264] By temperature parameters Adjust the matching strictness to generate an initial semantic match score between the query text slice and its related text fragments. This serves as the input basis for subsequent analysis;

[0265] It should be noted that by minimizing the contrastive loss function, positive sample pairs are brought closer together in the joint space, while negative sample pairs are pushed further apart. This alignment optimization ensures that the vectors retain deep semantic connections while also possessing explicit lexical matching capabilities, effectively alleviating the "lexical gap" problem in semantic retrieval.

[0266] Second, conduct regulatory conflict detection, which is based on the initial semantic matching score. The initial semantic matching score is selected from the set of relevant text fragments of the query text slice. Highly relevant text fragments exceeding a preset threshold are used to form a set of highly relevant text fragments. For the set of highly relevant text fragments Perform multi-rule conflict detection:

[0267] ;

[0268] in, This represents the set of highly relevant text fragments. The multi-rule conflict detection result takes values ​​of {0, 1}; when the value is 1, it represents a set of highly relevant text fragments. There are logical conflicts or applicability contradictions; when the value is 0, it represents a set of highly relevant text fragments. All regulations and provisions are conflict-free and compatible. Each represents a set of highly relevant text fragments. Two highly relevant text fragments in the text, This indicates two highly correlated text fragments. Conflict detection results between them This represents the set of highly relevant text fragments. ; This indicates two highly correlated text fragments. The system can identify potential contradictions between regulations by measuring semantic similarity between them. For example, one regulation requires that "logs must be kept for no less than 180 days," while another regulation stipulates that "logs must not be kept for more than 90 days." This provides a clear logical basis for subsequent compliance interpretations.

[0269] After completing semantic matching and conflict detection, this embodiment integrates all semantic evidence, logical evidence, and industry rule evidence to generate the final compliance judgment.

[0270] Third, multi-evidence fusion decision-making is performed, that is, the initial semantic matching scores between query text slices and highly relevant text segments are fused based on Dempster's evidence theory. and the set of highly relevant text fragments Multi-rule conflict detection results The overall compliance score of the query text slice is calculated. :

[0271] ;

[0272] in, Indicates the first One source of evidence for compliance events Support For the corresponding weights, For the complete series, The total number of evidence sources involved in the fusion. Take 3; sources of evidence include: Initial semantic matching score For compliance events Support For multi-rule conflict detection results For compliance events Support Expert knowledge evidence for compliance events in industry rule bases Support level; For compliance events to be determined (such as "the query text slice of the text to be reviewed complies with regulatory requirements", "the query text slice of the text to be reviewed is non-compliant", "there is a conflict in the regulatory clauses and it cannot be determined", etc., which are specific events related to compliance).

[0273] To enhance the system's adaptability to the latest regulations and highly credible evidence, the weighting coefficients in this embodiment... Adopt a dynamic update strategy:

[0274] ;

[0275] in, This indicates the historical credibility of the evidence source (e.g., the model's performance on the validation set). This indicates the time-relevantness of the relevant regulations, used to enhance the influence of the latest regulations in compliance analysis. Final fusion score. Calculations based on DS theory yielded the following:

[0276] ;

[0277] in, This is a quantifiable value representing the compliance status, such as the risk score corresponding to levels like compliant, partially compliant, and non-compliant. This final fusion score... This is the final output of the compliance status inference module.

[0278] The above methods yield comprehensive scores and interpretable compliance determinations, providing a basis for subsequent automated reviews and knowledge base updates.

[0279] Fourth, fuzzy logic reasoning is used to calculate the risk level of the query text slice. :

[0280] ;

[0281] in: The overall compliance score for this query text slice; The confidence level for this query text slice is derived from evidence fusion; The degree of impact of violations on the query text slice can be predefined by the industry rule base, such as "affecting the accuracy of results", "affecting process compliance", "affecting security", etc.

[0282] The specific implementation is as follows:

[0283] ;

[0284] in, These are weighting coefficients. =1, determined through expert experience or optimization of historical tasks; The higher the value, the more compliant the risk contribution. This formula aims to mathematically synthesize the combined contributions of multiple factors to risk, making the risk levels of different problems comparable.

[0285] Fifth, considering resource constraints and timeliness requirements, calculate the rectification suggestions for this query text slice. In this embodiment, after obtaining the risk level, rectification suggestions are generated through joint analysis of the risk level and rectification resources. The significance of these rectification suggestions lies in guiding testing institutions or software units to rationally arrange the rectification sequence, prioritizing high-risk and high-impact issues. This embodiment employs the following priority function:

[0286] ;

[0287] in, The severity of the query text slice, such as whether it invalidates the detection results or whether it poses a security risk; The urgency of rectifying this query text slice, such as whether it involves statutory time limits; Assess the resources required for this query text slice, such as whether retesting, supplementing materials, or redesigning the process is necessary;

[0288] It should be noted that, For multi-parameter decision functions, a linear weighting model or an industry rule base configuration model can be used to convert the above parameters into specific priority levels, such as levels 1 to 5. In this embodiment, to avoid excessive amplification of differences, normalization is employed to ensure consistent priority across the entire system.

[0289] Sixth, using a large model, the compliance status, issue type, and citation basis of the query text slice are generated based on the query text slice and its highly relevant text fragment set;

[0290] It should be noted that the issue types are categorized using a hierarchical tagging system: Level 1: Compliant / Partially Compliant / Non-Compliant / Not Applicable; Level 2: Violation of Technical Specifications / Process Specifications / Document Specifications / Security Specifications; Level 3: Mapping of Specific Violation Clauses.

[0291] Seventh, based on the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed, a compliance review report of the software quality report to be reviewed is generated to provide decision support for subsequent rectification; wherein, the compliance review report is stored in structured JSON format and can be exported as PDF or HTML to adapt to different review scenarios and user systems.

[0292] This embodiment also provides a history writing design, enabling the incremental update mechanism of this invention to continuously optimize system performance using historical review behavior. After review is completed, the system records information such as clause invocation, conflict detection triggering, evidence fusion weight distribution, and final compliance determination. History Record Structure It can be represented as:

[0293] ;

[0294] in, This represents the set of terms being referenced. Indicates compliance status; Score represents the overall compliance score. Indicates a conflict detection identifier. Indicates the weight distribution of evidence sources. This is for reviewing timestamps. This record structure is used for subsequent reweighting of clause importance in the knowledge base, updating the knowledge graph, and inferring similar cases.

[0295] This embodiment first extracts the compliance determination results from the compliance data structure, including the compliance status of each document fragment. To generate a unified report structure, the system maps the above content into report entries. Each entry consists of an issue identifier, original text location, compliance level, risk level, rectification recommendations, and cited clauses. To ensure consistent risk identification capabilities in the reports, this embodiment calculates a risk level for each issue, based on a joint measure of comprehensive compliance score, assessment confidence level, and the impact of the violation.

[0296] Eighth, the compliance status, issue type, cited basis, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed are located to the original paragraphs or tables in the software quality report to generate annotation information. The location of the annotation information is achieved through coordinate mapping for precise tracking.

[0297] ;

[0298] Among them, Annotation is a collection of annotation information for a single non-compliant text slice, which is the core data structure for precise positioning in the compliance review report. Each non-compliant text slice corresponds to an independent Annotation; text is the text description of a single non-compliant text slice, including compliance status, problem type, and reference basis; page is the original page number of a single non-compliant text slice in the software quality report to be reviewed. This represents the original location of a single non-compliant text segment in the software quality report under review; `riskLevel` represents the risk level of the single non-compliant text segment; and `priority` represents the rectification recommendations for the single non-compliant text segment. Through this annotation information structure, this embodiment automatically generates a visual annotation sequence, allowing users to quickly browse problem areas within the original document.

[0299] The annotation document uses the original text location information to pinpoint the problem to the paragraph or table in the software quality report to be reviewed, achieving closed-loop traceability.

[0300] Specifically, this embodiment uses extracted original text location information to accurately pinpoint each compliance issue to a specific block in the original document, including paragraph or table cell locations. The location information is represented in coordinate format as follows:

[0301] ;

[0302] in, and These represent the coordinates of the top left and bottom right corners of the target area, respectively.

[0303] This embodiment achieves precise marking of problem areas by aligning with the coordinates of text blocks or table cells recorded in the OCR parsing results, thus enabling the generated annotation documents to assist in manual review.

[0304] Based on the aforementioned retrieval structure, the large-scale model compliance reasoning mechanism proposed in this invention can establish high-confidence judgments under multiple evidence inputs. In compliance judgment, the large-scale model does not directly make judgments based on a single clause, but rather constructs a review context based on a set of candidate clauses, multi-hop reasoning results, entity relationship chains, and graph evidence, thereby ensuring the accuracy of the reasoning. This design avoids "semantic illusions" in the large-scale model and ensures that all generated content has a clear legal source.

[0305] When encountering complex testing documents, such as software test plans, test reports, requirements specifications, design specifications, user manuals, test record sheets, and problem rectification instructions, the content varies greatly, formats are diverse, and language styles are inconsistent. This invention uses mechanisms such as layout parsing, OCR recognition, text slicing, and semantic encoding to uniformly transform these documents into structured semantic fragments, thus ensuring that the entire review process is unaffected by document format. Especially for test record tables, this invention combines cell semantic expression with graph entities to naturally map test case numbers, operation steps, expected results, actual results, and test data to relevant entities in regulatory requirements. This enables the system to perform in-depth "behavior-criteria" comparisons and automatically identify non-compliance items. For example, when a clause requires that "the system should record the number of user authentication failures and trigger a locking mechanism when the threshold is exceeded," the system can automatically find the relevant test items in the test record sheet and determine whether the implementation complies with the specifications based on the entered data. This capability greatly improves the work efficiency of software testing organizations and provides a technical foundation for automated test result analysis. A large-scale model-enhanced interpretation and generation mechanism was constructed. Through the RAG framework, retrieved clause content, graph structure evidence, and document fragments are input into the generation model, ensuring that the model's generation capabilities are subject to clear regulatory constraints and avoiding illusions and unfounded inferences. When outputting compliance judgments, the generation model provides explanations based on a structured chain of evidence, such as citing the original clause text, indicating the scope of application, explaining logical relationships, and explaining the reasons for conflict judgments, making the review output highly interpretable and professional. When generating rectification suggestions, the large-scale model combines industry standards, historical review experience, and regulatory requirements to provide specific and actionable measures, such as supplementing document explanations, fixing missing functions, improving security protection mechanisms, and standardizing process design, enabling the inspected entity not only to identify problems but also to obtain a clear rectification path.

[0306] It should be noted that, based on the comprehensive compliance score, conflict detection results, and compliance judgment conclusions output by the compliance assessment module, the abstract quantitative scores and judgment results are transformed into a feasible, traceable, and executable compliance review report. This is the ultimate value embodiment of the complete technical chain of this invention: "document preprocessing → layout parsing → vectorization → knowledge graph construction → RAG retrieval → compliance assessment → report generation." This step quantifies risk levels through fuzzy logic reasoning, calculates rectification suggestions based on resource constraints, and achieves precise annotation positioning based on coordinate mapping. It solves the defects of existing review reports, such as "lack of risk quantification, lack of rectification priority, and lack of precise problem positioning." This is an important technical feature that distinguishes this invention from traditional review methods, ensuring a closed loop of the entire process from "judgment" to "implementation and rectification," and fully realizing the core design goals of "intelligence, precision, and traceability" of this invention.

[0307] Example 10:

[0308] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, it also includes:

[0309] The set of highly relevant text fragments was calculated based on first-order logical reasoning. Two highly relevant text fragments Conflict detection results between This is used to identify contradictory relationships between different highly relevant text fragments, avoiding judgment bias caused by conflicting clauses.

[0310] ;

[0311] in, The applicable objects or scenarios for highly relevant text fragments (such as "software function test coverage", "table cell data standardization", etc., which correspond one by one with the review points in the software quality report to be reviewed). Indicates highly relevant text fragments In applicable objects The following is established (i.e., the software quality report to be reviewed and included) The corresponding content matches the criteria for highly relevant text fragments. (requirements) Indicates highly relevant text fragments In applicable objects The following is not true (i.e., the software quality report to be reviewed is not valid). The corresponding content does not conform to highly relevant text fragments. Requirements); {⋅} is an indicator function; it is true when the logical expression within the parentheses is true (i.e., it exists). Make Established and If the condition is not met, the function value is 1; otherwise, the function value is 0. A value of 1 indicates a conflict between two related text segments; when... A value of 0 indicates that the two related text segments are not conflicting and are compatible.

[0312] To adapt to scenarios involving parallel review of multiple clauses, first-order logical reasoning is extended to multi-rule conflict detection. This is used to batch identify conflict pairs in all highly relevant text segments, forming a conflict set, and thus extending to multi-rule conflict detection.

[0313] ;

[0314] Here, ConflictSet represents the set of all highly correlated text fragment pairs that conflict, and each element in the ConflictSet set... Both are highly correlated text fragments that conflict with each other; Indicates highly relevant text fragments The set of applicable objects / scenarios (i.e., highly relevant text fragments) All software quality audit points that can be used for review. Indicates highly relevant text fragments The set of applicable objects / scenarios (i.e., highly relevant text fragments) All software quality audit points that can be used for review.

[0315] It should be noted that the compliance assessment module in this invention combines a large model with industry rules to make judgments, outputting compliance status, problem type, cited basis, rectification suggestions, and risk level. This module is the key execution unit for achieving the core objective of software quality report compliance review in this invention. It follows the search results output by the RAG retrieval module mentioned above (matching score after fusion of two types of retrieval, knowledge graph association links, and keyword matching basis), and conducts in-depth comparison and judgment between the retrieved legal reference clauses and knowledge graph structured evidence and the text content and detection data of the software quality report to be reviewed. It is the final output link of the complete technical chain of this invention, "from document preprocessing → vector retrieval → knowledge modeling → compliance judgment". Its core function is to transform the fragmented evidence retrieved into actionable and traceable compliance assessment results, solving the technical pain points of "no basis for judgment, no direction for rectification, and no detection of conflicts" in existing review methods, reflecting the core inventive points of "intelligent, precise, and standardized" in this invention.

[0316] Example 11:

[0317] This embodiment is a further optimization based on the above embodiment. The similarities with the aforementioned technical solutions will not be repeated here. Furthermore, to better implement the software quality report compliance detection method based on Transformer and Graph RAG described in this invention, it also includes:

[0318] This invention further addresses the challenges faced by the system during long-term operation, such as frequent regulatory updates, clause vectorization, knowledge graph generation, RAG retrieval, and compliance assessment, by providing an automated incremental update solution for the completed regulatory knowledge base construction, clause vectorization, knowledge graph generation, RAG retrieval, and compliance assessment processes. The automatic update mechanism in this embodiment ensures that the regulatory knowledge base, clause vector library, and knowledge graph can seamlessly absorb new regulations and achieve dynamic evolution under continuous operation, avoiding knowledge lag and rule conflicts caused by manual maintenance in traditional systems.

[0319] This embodiment first acquires newly added external regulatory documents, including newly revised versions of national laws, newly released versions of national standards, updated versions of industry specifications, and revised content of technical guidelines. To ensure accurate identification of newly added or rewritten parts during the incremental update process, the system employs a preprocessing method similar to that described above to perform layout parsing, OCR, and text structure restoration on the new documents, breaking down the content of the new documents into a set of text fragments. For each new text segment, its initial vector representation is calculated using a pre-trained language model. And perform L2 normalization:

[0320] ;

[0321] in, For the deep semantic vector of the newly added text fragment, Its L2 norm. The normalized vector. Used for scale matching with the clause vectors in the old library.

[0322] To identify which clauses in the newly added document are continuations or rewrites of clauses in the old version, this embodiment uses a semantic fingerprint vector matching mechanism. For newly added text fragments... The system constructs its semantic fingerprint vector. :

[0323] ;

[0324] in, The semantic vector representing the newly added text fragment. This represents the context vector representation of the newly added text fragment in the document. This represents the adjacency entity features temporarily generated based on local dependencies during the construction process; symbol This represents vector concatenation. The system uses cosine similarity to determine whether an entity is equivalent to one in the old graph.

[0325] ;

[0326] When the similarity exceeds a preset threshold of 0.92, the system treats the newly added text fragment as an evolved version of the old text fragment and establishes a cross-version inheritance relationship. This relationship is represented by graph edges:

[0327] ;

[0328] in, Entities in the old text fragment. For entities in the newly added text fragment, This indicates version inheritance relationships. This structure enables the system to automatically locate the most relevant version of the regulations when querying historical projects or handling cross-version consistency checks.

[0329] For newly added text fragments that do not form a high similarity match with old text fragments, the system treats them as entirely new entities, directly adds them to the knowledge graph node set, and continues entity extraction, relation extraction, and triple generation using the methods described above, adding a new triple set. Recorded as:

[0330] ;

[0331] in, To add a new head entity, To add a new relation type, This is a new tail entity. New triples will be merged with the old graph to maintain the scalability of the knowledge structure.

[0332] To ensure the consistency of the knowledge graph embedding space with newly added nodes, this embodiment employs a local RGCN retraining mechanism. Local subgraph sampling is performed on the newly added node and its directly related neighboring nodes to construct the subgraph. ,in, It includes newly added nodes and their neighboring nodes. Contains corresponding edges. Perform a local iterative RGCN update on this subgraph:

[0333] ;

[0334] in, For nodes In the Layer embedding vectors, For a set of relation types, For nodes In relation The set of neighboring nodes below, The normalization constant is For a relation-specific weight matrix, This is the self-connection weight matrix. This is a non-linear activation function. Through this process, new knowledge can be quickly integrated into the overall graph embedding space while maintaining the stability of the old graph.

[0335] Regarding the updating of the vector retrieval library, this embodiment adopts an incremental ANN index construction method to update the vectors of newly added terms. Insert data into the existing hierarchical index structure without rebuilding the entire vector library. For approximate retrieval structures using HNSW or IVF-FLAT, the system performs node insertion or inverted cluster addition operations respectively, enabling real-time retrieval expansion.

[0336] Through an automatic incremental update mechanism, the system can maintain the structural consistency, content integrity, and semantic stability of the legal national standard knowledge base and knowledge graph even as the regulatory environment continues to change, ensuring the long-term effectiveness of the RAG compliance review process.

[0337] In summary, (1) multiple original documents related to software inspection and testing, such as laws, national standards, and industry norms, are obtained; the reference documents are parsed and semantically segmented to break them down into text fragments; entity extraction and relation extraction are performed based on the text fragments to construct a knowledge graph of the legal and standard domains, and semantic associations and applicable scenario mappings between text fragments are established to achieve structured expression and logical constraints of rules; (2) the layout structure of the software quality report to be reviewed is analyzed to identify text paragraphs and tables, and semantic segmentation is performed to generate a set of text slices with original text location information; vector representations are generated for each text slice as input for subsequent retrieval, reasoning, and annotation; (3) the text fragments are input into the vectorization module to generate normalized vector representations, and a high-dimensional vector retrieval library for text fragments is constructed based on the hierarchical ANN index, while storing the metadata of the text fragments (including clause number, applicable testing stage, and control points, etc.) to support rapid retrieval for different testing scenarios; (4) the node representations in the knowledge graph are iteratively updated through a relational graph convolutional network to obtain a representation that can describe "testing method - qualification criterion - re-inspection process". "High-dimensional graph embedding of relationships such as " provides structured evidence for subsequent semantic reasoning; (5) Input text slice vectors, text fragment vectors and optimized graph embedding into the RAG retrieval module, perform vector retrieval and relationship link retrieval to obtain candidate text fragments; and fuse the candidate text fragments through the learning ranking model to obtain relevant text fragments with high confidence; (6) Input text slices and relevant text fragments into the compliance assessment module, use the large model combined with industry rules to generate compliance status, problem type, citation basis and rectification suggestions; perform semantic matching degree calculation and regulatory conflict detection, and use evidence fusion algorithm to output the comprehensive compliance score and risk level of the software quality report to be reviewed; (7) Generate the compliance review report of the software quality report to be reviewed based on the compliance status, problem type, citation basis, comprehensive compliance score, risk level and rectification suggestions of the software quality report to be reviewed; and locate the compliance status, problem type, citation basis, risk level and rectification suggestions of the software quality report to be reviewed to the original paragraphs or tables of the software quality report to be reviewed to generate annotation information.

[0338] This invention can be widely applied to software testing agencies, quality supervision departments, industry regulatory departments, compliance review of enterprise information systems, internal quality management of software development companies, and scenarios involving automatic parsing of laws and regulations, intelligent matching of standard clauses, and verification of the standardization of technical documents.

[0339] The purpose of this invention is to provide a software quality report compliance detection method based on Transformer and Graph RAG. It constructs an automated software quality inspection and compliance review method capable of stable operation in complex regulatory systems, large standard systems, and multi-source inspection document environments. By deeply coupling a legal national standard knowledge base, a structured regulatory knowledge graph, a vector semantic retrieval mechanism, and a large-model generative reasoning framework, it achieves a complete closed loop from unstructured text to structured knowledge, and then to reasonable, searchable, and traceable compliance review results. The core idea of ​​this invention is to transform legal standards from a linear document structure into a machine-understandable knowledge system through techniques such as layout parsing, semantic unit generation, entity recognition, relation extraction, triple construction, vectorized expression, knowledge graph embedding learning, RAG retrieval enhancement generation, semantic matching degree reasoning, multi-rule conflict detection, and evidence fusion calculation. This allows complex regulatory clauses, inspection rules, and compliance requirements to be represented, retrieved, and reasoned in a mathematical manner within the system.

[0340] After constructing a complete technical system, this invention further achieves a continuous optimization cycle of "review-evidence storage-learning-update" in the field of software quality inspection through process-oriented modeling and a knowledge closed-loop structure of review behavior. This allows the system to continuously accumulate review knowledge, user feedback, and review samples during long-term operation, gradually improving its review capabilities and stability. In actual use, each compliance review automatically generates review logs, clause citation records, reasoning link records, evidence matching trajectories, and the output results of the generated model, forming structured metadata. This metadata is incorporated into the system's historical review library. The historical review library not only provides the audit department with a foundation for compliance traceability but also serves as an important data source for subsequent model training and knowledge supplementation. Based on these historical records, the system can identify common matching errors, missing graph regions, ambiguous clause expressions, and high-incidence points of rule conflicts, thereby optimizing the knowledge graph structure, enhancing the vector representation model, and improving the quality of large model generation.

[0341] In summary, this invention discloses a software quality report compliance detection method based on Transformer and Graph RAG, integrating knowledge graphs, vector retrieval, and large-scale model reasoning to achieve automated end-to-end review from regulatory provisions to the detection report. First, the method performs format parsing and semantic segmentation on laws and standards, extracting entity relationships to construct an extensible domain knowledge graph. Simultaneously, it performs OCR, segmentation, and vectorization on the documents to be reviewed, generating semantic fragments with location information. Next, it establishes a hierarchical ANN clause library using "dense + sparse" dual-path encoding, and iteratively updates the graph embedding based on RGCN, explicitly modeling complex dependencies such as detection methods, compliance criteria, and re-inspection processes. The RAG module performs parallel vector and relational link binary retrieval, learning, ranking, and recalling high-confidence clauses. In the compliance assessment stage, it utilizes a large-scale model combined with industry rules for semantic matching, regulatory conflict detection, and evidence fusion, outputting the violation type, cited basis, rectification suggestions, and comprehensive score. Finally, it automatically generates a traceable review report and annotation documents, and supports incremental updates to the knowledge base. This method optimizes semantic matching through comparative learning, introduces DS theory to integrate multiple evidences, and realizes dynamic calculation of risk level and rectification suggestions, which significantly improves the efficiency, accuracy and interpretability of software quality compliance review.

[0342] The above description only details the preferred embodiments of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0343] It should be understood that although the steps in the flowcharts of the various embodiments of the present invention are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the various embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0344] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0345] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the disclosure in the specification and embodiments. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

Claims

1. A software quality report compliance detection method based on Transformer and Graph RAG, characterized in that, Includes the following steps: Step S1: Collect multiple original documents related to software inspection and detection to construct an original document set; and preprocess the multiple original documents in the original document set to obtain a reference document set; wherein, the reference document set includes multiple ordered reference documents; Step S2: On the one hand, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector; on the other hand, entity extraction and relation extraction are performed on each reference document in the reference document set to construct a knowledge graph corresponding to the reference document set. Step S3: Receive the software quality report to be reviewed input by the user; on the one hand, convert the software quality report to be reviewed into a corresponding query vector, and compare the similarity of the query vector with the high-dimensional vector in the high-dimensional vector retrieval library to obtain the vector similarity comparison result; on the other hand, extract entities from the software quality report to be reviewed, and compare the similarity of the entity extraction result of the software quality report to the knowledge graph to obtain the path similarity comparison result; then, based on the vector similarity comparison result and the path similarity comparison result, retrieve relevant reference documents from the high-dimensional vector retrieval library; Step S4: Using the large model, output the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed based on the software quality report to be reviewed and its related reference documents. Generate a compliance review report of the software quality report to be reviewed based on the compliance status, issue type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of the software quality report to be reviewed. And locate the compliance status, issue type, cited basis, risk level, and rectification suggestions of the software quality report to be reviewed in the original paragraphs or tables of the software quality report to be reviewed to generate annotation information.

2. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 1, characterized in that, The preprocessing of multiple original documents in the original document set to obtain a reference document set includes: Multiple original documents in the original document set are preprocessed to obtain multiple reference documents; wherein, the preprocessing includes deduplication, format standardization and metadata annotation; Multiple reference documents are encoded to obtain multiple ordered reference documents, and the reference document set is constructed based on the multiple ordered reference documents.

3. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 1, characterized in that, In step S2, each reference document in the reference document set is converted into a corresponding high-dimensional vector, and a high-dimensional vector retrieval library corresponding to the reference document set is constructed based on each reference document and its corresponding high-dimensional vector, including: Each reference document in the reference document set is divided into multiple semantically complete text segments, and the output is a collection of text segments. : ; in, Indicates the number of text segments in a reference document; Collection of text fragments Each text fragment The data is input into the BERT-base-chinese pre-trained language model to extract its deep semantic features, thus obtaining each text segment. high-dimensional vectors : ; Among them, LMEncoder is a BERT-base-chinese pre-trained language model; For all high-dimensional vectors corresponding to each reference document L2 normalization is performed to obtain a normalized high-dimensional vector. : ; Based on all text fragments from all reference documents and their corresponding normalized high-dimensional vectors A high-dimensional vector retrieval library corresponding to the reference document set was constructed.

4. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 3, characterized in that, In step S2, entity extraction and relation extraction are performed on each reference document in the reference document set to construct a knowledge graph corresponding to the reference document set, including: (1) Entity extraction is performed on each reference document in the reference document set using the BERT-BiLSTM-CRF model: First, each text fragment is obtained through the BERT encoding layer. The set of context vectors of the original entities in : ; in, For each text fragment The first in A primitive entity; B represents each text fragment. The number of original entities in the data; For the first Original entity Context vector; Secondly, each original entity is captured by the BiLSTM layer. context vector Dependency characteristics to obtain each original entity Encoding context vector : ; Finally, each text fragment Each original entity in Encoding context vector Input to a CRF layer to output each text fragment. Optimal entity sequence Its matching score The calculation is as follows: ; in, For each text fragment and optimal entity sequence Match score, For the first The optimal entity The launch score, To obtain the optimal entity Transfer to the optimal entity The transition score; D represents the optimal entity sequence. The optimal number of entities in; Construct the entity set corresponding to the reference document set based on the optimal entity sequence of all text fragments in the reference document set; (2) Use a relation classification model to determine the relation category to which each entity pair in the entity set belongs: Entity pairs are enumerated based on the entity set, and an input sequence corresponding to each entity pair is constructed based on each entity pair and its corresponding text fragment. The position vector of the input sequence is then extracted. Mapped to the relation category space through a fully connected layer: ; in, This is a score vector for the relation categories. and These are weights and biases, respectively. The probability distribution of each entity pair belonging to each relation category is calculated using the Softmax function: ; in, Indicates in a given text fragment Head entity Tail entity Under the condition of relation category For the first The probability of a class; For the first A vector of scores for each relation category. Let be the score vector for the k-th relation category. The number of pre-designed domain relationship categories; Based on the probability distribution of each entity pair belonging to each relation category, relation categories whose probabilities meet the threshold are selected to obtain the relation category to which each entity pair belongs. The final output is a structured triplet. : ; Structured triples are learned through embedding learning algorithms. Map the vector space to satisfy the following relational constraints: ; in, Representing the head entity respectively Vectors and relation categories vectors, tail entities ; (3) Construct the knowledge graph corresponding to the reference document set based on the entity set corresponding to the reference document set and the relation category to which each entity pair in the entity set belongs.

5. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 4, characterized in that, Also includes: For an entity v in the knowledge graph, generate its semantic fingerprint vector. Its formula is: ; Where Embedding represents the embedding model; This indicates vector concatenation; For an entity v, the ontology description; The document context content for a certain entity v; Let v be the adjacency category and adjacent entities of a given entity v; Similarly, the semantic fingerprint vector of another entity u in the knowledge graph is generated as follows: Then the cosine similarity between entity v and entity u for: ; For entity pairs in the knowledge graph with a cosine similarity higher than 0.9, the nodes of the entity pair are merged, the alias list is retained, the structured triples of the entity pair are aggregated and deduplicated, so as to update the knowledge graph; for entity pairs in the knowledge graph with a cosine similarity not higher than 0.9, no processing is performed.

6. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 4, characterized in that, Also includes: Define knowledge graph ,in, For a set of entity nodes, For the set of edges of relation categories; The knowledge graph is iteratively updated using a relational graph convolutional network. Adjacency categories of entity nodes: ; in, Represents entity nodes In relation categories The set of adjacent entity nodes below, It is a set of relation categories; The normalization coefficient is... It is a non-linear activation function. For a relation-specific weight matrix, This indicates the number of layers in a graph convolutional network. and The first The original entity node of the layer and ; Original entity node In the +1 layer updated node representation; For self-loop weights.

7. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 3, characterized in that, Step S3 includes: The first step is to parse the software quality report to be reviewed to generate a set of paragraphs from the software quality report to be reviewed. and table collection ;in, For paragraph collection The number of paragraphs in the text For a set of tables The number of tables in the table; Paragraph segmentation is based on the similarity calculation of adjacent semantic vectors: ; in, This refers to the i-th paragraph of the software quality report to be reviewed. This refers to the (i+1)th paragraph of the software quality report to be reviewed. For the i-th paragraph semantic vector; For the (i+1)th paragraph The semantic vector; when Segmentation is performed at specific times; Similarity threshold Adopt a dynamic adjustment strategy: ; in, Based on the threshold, To adjust the coefficient, This represents the variance of the similarity between adjacent paragraphs. This refers to the j-th paragraph of the software quality report to be reviewed. This refers to the (j+1)th paragraph of the software quality report to be reviewed. Use structured recognition algorithms to analyze the table set Each table in the table is split into multiple cells; The second step involves performing semantic segmentation on the paragraphs and cells in the software quality report to be reviewed, generating multiple text slices d; and using a Transformer-based pre-trained language model to construct a dense vector for each text slice d. Simultaneously, TF-IDF and BM25 methods are used to construct sparse vectors for each text slice d. Then, a linear weighting strategy is used to generate the query vector for each text slice d. : ; in, For fusion weighting coefficients; The third step is to obtain the query vector for each text slice d. With each normalized high-dimensional vector in the high-dimensional vector retrieval library Perform a similarity comparison to obtain the text slice d and each text fragment. Vector similarity between : ; The fourth step involves comparing the similarity of the query entities of each text slice d in the software quality report to be reviewed with the knowledge graph to obtain the path similarity between the text slice d and the knowledge graph. ; ; Where Q is a query entity extracted from the software quality report to be reviewed. In knowledge graph All candidate paths originating from the query entity Q. for Any candidate path in the list, This is the path length penalty factor. For a single candidate path Length, For a single candidate path Any edge in, The edge weight; The fifth step is to calculate the relationship between the text slice d and each text fragment. Final similarity between : ; in, These are the weighting coefficients; Step 6: Based on the final similarity Multiple text segments in the high-dimensional vector retrieval library are sorted to select multiple relevant text segments from the high-dimensional vector retrieval library to form a set of relevant text segments for the text slice d.

8. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 7, characterized in that, Also includes: Each text slice is generated using the Transformer encoder. The original semantic vector is obtained, and the original position of each text slice d in the software quality report to be reviewed is recorded; wherein, the Transformer encoder is based on a pre-trained legal domain language model and captures long-distance dependencies through a multi-head self-attention mechanism: ; Where Q is the query vector, K is the key vector, and V is the value vector; It is the vector dimension; To enhance location awareness, relative location coding is introduced: ; in, It is the j-th text slice in the software quality report to be reviewed. The original semantic vector, PositionEncoding(·) is the position encoding function. It is the j-th text slice The original text location; It is the j-th text slice The final semantic vector.

9. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 8, characterized in that, Step S4 includes: First, the loss function based on contrastive learning. Optimize the semantic similarity between the query text slice and its related text fragments in the software quality report to be reviewed: ; in, The original semantic vector of the query text slice; These are positive examples, i.e., normalized high-dimensional vectors of relevant text fragments in the query text slice. ; For temperature parameters; This is the set of negative examples, i.e., text fragments that are irrelevant to the text slice in the query. This is a sample traversal variable used to iterate through the set of positive samples. } and negative sample set All samples in; By temperature parameters Adjust the matching strictness to generate an initial semantic match score between the query text slice and its related text fragments. ; Second, based on the initial semantic matching score The initial semantic matching score is selected from the set of relevant text fragments of the query text slice. Highly relevant text fragments exceeding a preset threshold are used to form a set of highly relevant text fragments. For the set of highly relevant text fragments Perform multi-rule conflict detection: ; in, This represents the set of highly relevant text fragments. Multi-rule conflict detection results; Each represents a set of highly relevant text fragments. Two highly relevant text fragments in the text, This indicates two highly correlated text fragments. Conflict detection results between them This represents the set of highly relevant text fragments. ; This indicates two highly correlated text fragments. Semantic similarity between them; Third, the initial semantic matching scores between the fused query text slices and their highly relevant text fragments. and the set of highly relevant text fragments Multi-rule conflict detection results The overall compliance score of the query text slice is calculated. : ; in, Indicates the first One source of evidence for compliance events Support For the corresponding weights, For the complete collection, The total number of evidence sources involved in the fusion. Take 3; Initial semantic matching score For compliance events Support For multi-rule conflict detection results For compliance events Support Expert knowledge evidence for compliance events in industry rule bases Support level; Fourth, fuzzy logic reasoning is used to calculate the risk level of the query text slice. : ; in: The overall compliance score for this query text slice. Assess the confidence level for this query text slice. The degree of impact of the violation on the query text slice; Fifth, calculate the rectification suggestions for the query text slice. : ; in, The severity of the query text slice. Given the urgency of rectifying this query text slice, Evaluate the resources required for this query text slice; Sixth, using a large model, the compliance status, issue type, and citation basis of the query text slice are generated based on the query text slice and its highly relevant text fragment set; Seventh, based on the compliance status, problem type, cited basis, comprehensive compliance score, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed, generate a compliance review report for the software quality report to be reviewed; Eighth, locate the compliance status, problem type, reference basis, risk level, and rectification suggestions of each query text slice in the software quality report to be reviewed to the original paragraph or table of the software quality report to be reviewed to generate annotation information.

10. The software quality report compliance detection method based on Transformer and Graph RAG according to claim 9, characterized in that, Also includes: The set of highly relevant text fragments was calculated based on first-order logical reasoning. Two highly relevant text fragments Conflict detection results between : ; in, This is suitable for highly relevant text fragments. Indicates highly relevant text fragments In applicable objects The following was established. Indicates highly relevant text fragments In applicable objects The following is not true; {⋅} is an indicator function.