Standard term numerical value conflict judgment method based on deep learning
By introducing a conflict-aware attention mechanism and a numerical semantic encoding layer into the RoBERTa model, combined with a vector comparison enhancement strategy, the problem of numerical conflict detection in numerical reasoning tasks using deep learning models is solved, achieving more efficient numerical conflict judgment.
Patent Information
- Application Number
- CN202511344729.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-02-10
AI Technical Summary
Existing deep learning models struggle to effectively handle numerical conflicts in standard clauses during numerical reasoning tasks, especially due to semantic integrity issues caused by word segmentation mechanisms, which affect the model's performance in precise numerical comparison scenarios.
We adopt a standard clause numerical conflict detection model based on RoBERTa, and introduce a conflict-aware attention mechanism, a numerical semantic encoding layer, and a vector comparison enhancement strategy. We directly perform deep modeling of numerical relationships within the model and protect the atomicity of numerical values through a pseudo-labeling strategy.
This improves the model's performance in numerical conflict detection, enabling it to capture the complex relationship between numerical values and context more deeply, and enhancing the semantic integrity and accuracy of the judgment.
Smart Images

Figure CN121501974A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of natural language processing and deep learning, and relates to a standard clause numerical conflict judgment method based on deep learning. BACKGROUND
[0002] Standards are the technical cornerstone supporting and guaranteeing the development of industries, and the consistency of their internal clauses, especially numerical provisions, directly affects product quality and safety levels. In recent years, the standard system has continued to expand in both horizontal and vertical dimensions, with a sharp increase in the number of clauses across levels and fields, leading to frequent numerical conflicts and potential risks for regulatory enforcement. Traditional manual review methods have been unable to meet the needs of modern standard systems in terms of efficiency and scalability.
[0003] Automatic identification of conflicts in legal, regulatory, contractual and other normative texts is also an important research area in natural language processing technology (NLP). Early NLP technology research mainly relied on rule-based methods and statistical-based methods. With the development of NLP technology, traditional machine learning (Machine Learning, ML) methods, such as models represented by Support Vector Machines (SVM), began to use text features such as Term Frequency-Inverse Document Frequency (TF-IDF) for classification. In recent years, deep learning-based methods have become the mainstream. For example, the Chain of Specific-enhancement for Large Language Models (COSLLM) framework for the field of building standards uses a large language model trained for domain adaptability to convert conflict identification into a natural language inference (NLI) task. Similarly, in the legal field, models such as GPT-4 have also shown high accuracy in detecting evidence conflicts. However, these methods usually require a large amount of domain-labeled data for fine-tuning and face the inherent "hallucination" risk of LLMs.
[0004] Bidirectional Encoder Representations from Transformer (BERT) based on Transformer greatly promotes the development of deep learning in the field of NLP, but it still faces fundamental bottlenecks in numerical reasoning tasks, such as the subword segmentation mechanism that easily splits complete numerical expressions like "10mg / branch" into isolated tokens, thereby destroying their semantic integrity and limiting the model's performance in accurate numerical comparison scenarios. SUMMARY
[0005] This invention addresses the technical problems existing in the original pre-trained model in numerical reasoning tasks by providing a standard clause numerical conflict judgment method based on deep learning. Based on the RoBERTa architecture, it introduces a conflict-aware attention mechanism (CAA), a numerical semantic encoding layer (NSE), and a vector comparison enhancement strategy (EVC). It directly performs deep modeling of numerical relationships within the model, and the synergistic effect of each new module improves the overall performance of the DNCC model.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] This invention provides a method for determining numerical conflicts in standard clauses based on deep learning, comprising the following steps:
[0008] S1: Obtain the dataset containing pairs of terms labeled "conflicting" and "non-conflicting";
[0009] S2: Construct a standard clause numerical conflict detection model, which includes a dual encoder with shared weights, a numerical semantic encoding layer, and a fully connected neural network layer; introduce a conflict-aware attention mechanism in the first encoder to optimize the attention weights of word pairs; the numerical semantic encoding layer is located after the second encoder;
[0010] S3: Train the standard clause numerical conflict detection model using the dataset, and calculate the total loss function of the standard clause numerical conflict detection model using a joint optimization strategy;
[0011] S4: Obtain the standard document to be tested, extract the text and segment it into structured clause units, and perform numerical extraction and pseudo-tag processing on the structured clause units;
[0012] S5: Input the pseudo-labeled structured clause unit into the standard clause numerical conflict judgment model, and input the output vector of the numerical semantic encoding layer into the fully connected neural network layer to obtain the conflict logic value;
[0013] S6: Determine whether there is a numerical conflict in the standard clauses based on the conflict logic value.
[0014] In the above technical solution, the formula for calculating the attention weight is as follows:
[0015]
[0016] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively. For L×d k The set of real matrices, where L is the sequence length and d k M is the dimension of the key matrix; M is the conflict-aware dynamic matrix, M∈RL×L .
[0017] In the above technical solution, a vector comparison enhancement strategy is introduced into the numerical semantic encoding layer. This strategy concatenates the original vectors, difference vectors, and product vectors of two sentences to form a combined feature vector. The combined feature vector is then input into the fully connected neural network layer. The combined feature vector is represented as follows:
[0018] V combined =[v A ;v B ;|v A -v B |;v A ⊙v B ],
[0019] Where: v A and v B These are the original vectors of statements A and B, respectively; [;] represents the concatenation operation between the two vectors; |v A -v B | represents the absolute difference between two vectors, used to capture the degree of semantic difference; v A ⊙v B It is the Hadamard product of two vectors, used to capture semantically shared activation patterns.
[0020] In the above technical solution, the total loss function is L total The calculation formula is as follows:
[0021]
[0022] Where: L CL To contrast the learning loss function, L CLS For the weighted classification loss function, σ1 and σ2 are learnable parameters for task uncertainty.
[0023] In the above technical solution, the contrastive learning loss function L CL The calculation formula is as follows:
[0024]
[0025] Where: v A and v B Let v be the original vector of two statements A and B. i To iterate through all vectors within a batch, N is the batch size, and τ is the temperature hyperparameter.
[0026] In the above technical solution, the weighted classification loss function L CLS The calculation formula is as follows:
[0027]
[0028] Where: N is the number of aligned samples in the traversal batch, y i Let y be the true label of the i-th sample. i =1 indicates a sample conflict, y i =0 indicates that the samples do not conflict, x i It is the original logical value output by the model; when y i When = 1, w i Equal to the proportion of conflicting samples; when y i When = 0, w i =1.
[0029] In the above technical solution, the specific process of numerical extraction and pseudo-tag processing of the structured clause unit is as follows: the numerical expression in the standard text is identified and extracted from the structured clause unit through a regular expression script; a pseudo-tag strategy is adopted to replace the numerical expression with a special tag to achieve the encapsulation of the numerical expression.
[0030] In the above technical solution, step 6 specifically involves the following steps: The conflict logic value is converted into a confidence probability using a sigmoid function. If the confidence probability is greater than 0.5, the standard clause is determined to have a numerical conflict; if the confidence probability is ≤0.5, the standard clause is determined not to have a numerical conflict. The formula for calculating the confidence probability is as follows:
[0031]
[0032] Where: C is the conflict logic value.
[0033] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0034] This invention proposes a deep learning-based standard clause numerical conflict detection model (DNCC). Based on the RoBERTa model, it introduces a conflict-aware attention mechanism (CAA), a numerical semantic encoding layer (NSE), and a vector comparison enhancement strategy (EVC). The conflict-aware dynamic matrix strengthens the focus on conflicting word pairs, the numerical semantic encoding layer (NSE) ensures the stability of information flow, and the vector comparison enhancement strategy (EVC) improves the depth of model comparison. It directly performs deep modeling of numerical relationships within the model. The synergistic effect of each new module improves the overall performance of the DNCC model and outperforms state-of-the-art models that rely on data preprocessing.
[0035] This invention also protects the atomicity of numerical values through a pseudo-tagout strategy, further enhancing the integrity of semantic comparisons during model judgment and providing a new approach for models to handle complex numerical values. The method of this invention can not only be used for clause conflict detection in publicly available national standards, industry standards, group standards, local standards, and enterprise standards, but also for clause conflict detection in internal enterprise production management systems and operating procedures, providing convenience for industry supervision. Attached Figure Description
[0036] Figure 1 This is a structural diagram of the DNCC model in the standard clause numerical conflict judgment method based on deep learning of this invention. Detailed Implementation
[0037] The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of protection of the present invention. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art. Unless otherwise specified, the test methods in the following embodiments are conventional methods.
[0038] Example 1
[0039] S1: Obtain the dataset containing pairs of terms labeled “conflicting” and “non-conflicting”.
[0040] Since no existing dataset was available, this invention required the construction of a dedicated dataset for numerical conflict detection, derived from 109 corporate standard documents from a municipal tobacco company. First, using MinerU automated parsing, 7341 independent clause units containing numerical values were extracted from the corporate standard documents as the raw corpus. Then, using the large-scale language model (LLM) Qwen3, a large number of semantically aligned clause pairs were generated based on the clause units containing numerical values, but with two numerical categories: "conflicting" and "non-conflicting." Semantically unrelated clause pairs were also constructed through random sampling. Considering the uncertainty of LLM-generated labels, this invention further designed and ran a rule-based conflict judgment engine to automatically verify and correct the conflict labels of all aligned samples. Finally, a high-quality dataset containing 998 labeled sample pairs was constructed and fixedly divided into training and validation / test sets at a 9:1 ratio to ensure the fairness of all comparative experiments. All experiments were implemented using PyTorch on an NVIDIA RTX 4090 GPU.
[0041] S2: Construct a standard clause numerical conflict detection model (DNCC).
[0042] like Figure 1The model structure diagram shown illustrates that the Detecting Numerical Conflicts in Standard Clauses model of this invention is based on a shared-weight dual encoder architecture (RoBERTa) and integrates the following innovative modules: Conflict-Aware Attention (CAA), Numerical Semantic Encoding (NSE), and Vector Comparison Enhancement (EVC). The specific architecture includes a shared-weight dual encoder, a Numerical Semantic Encoding layer, and a fully connected neural network layer. A conflict-aware attention mechanism is introduced in the first encoder to optimize the attention weights of word pairs. The Numerical Semantic Encoding layer follows the second encoder, and a Vector Comparison Enhancement strategy is introduced in this layer. This strategy concatenates the original vectors, difference vectors, and product vectors of the two sentences to form a combined feature vector, which is then input into the fully connected neural network layer.
[0043] The formula for calculating the attention weights mentioned above is as follows:
[0044]
[0045] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively. For L×d k The set of real matrices, where L is the sequence length and d k M is the dimension of the key matrix; M is the conflict-aware dynamic matrix, M∈R L×L .
[0046] The conflict-aware dynamic matrix M of this invention is essentially a trainable attention bias parameter matrix, which participates in the calculation of attention scores along with the Query-Key similarity term of the RoBERTa model. During training, M, along with other network parameters, is continuously updated through backpropagation. Its update direction and magnitude are determined by the gradient of the total loss function (contrastive learning loss + weighted classification loss). The numerical change of M depends on:
[0047] 1. Input token vector pairs - When certain word pairs (such as "not less than" vs "less than") frequently correspond to conflicting tags, the gradient will push the corresponding position of M to increase;
[0048] 2. Loss function design: Contrastive learning loss affects the overall semantic alignment, while weighted BCE loss specifically strengthens the discrimination of a few conflicting samples, making M pay more attention to key numerical relationships;
[0049] 3. Optimizer and learning rate – The AdamW optimizer, combined with the learning rate, determines the update magnitude and convergence speed of M.
[0050] The above combined feature vectors are represented as follows:
[0051] V combined =[v A ;v B ;|v A -v B |;v A ⊙v B ],
[0052] Where: v A and v B These are the original vectors of statements A and B, respectively; [;] represents the concatenation operation between the two vectors; |v A -v B | represents the absolute difference between two vectors, used to capture the degree of semantic difference; v A ⊙v B It is the Hadamard product of two vectors, used to capture semantically shared activation patterns.
[0053] S3: Train a standard clause numerical conflict detection model using a dataset, and calculate the total loss function of the standard clause numerical conflict detection model using a multi-task joint optimization strategy adjusted by dynamic loss weights (DLW).
[0054] The DNCC model of this invention was trained on a dataset containing 998 sample pairs, using the same 9:1 training / validation set partition, and underwent systematic hyperparameter tuning. The optimal configuration for achieving the best performance was determined to be: a learning rate of 2e... -5 The batch size is 16, and the training epochs are 5. At the end of each epoch, the best-performing model checkpoint is saved based on the F1 score on the validation set.
[0055] The total loss function of the DNCC model is L total The calculation formula is as follows:
[0056]
[0057] Where: L CL To contrast the learning loss function, L CLS For the weighted classification loss function, σ1 and σ2 are learnable parameters for task uncertainty.
[0058] Contrast learning loss function L CL The calculation formula is as follows:
[0059]
[0060] Where: v A and v BLet v be the original vector of two statements A and B. i To iterate through all vectors within a batch, N is the batch size, and τ is the temperature hyperparameter.
[0061] Weighted classification loss function L CLS The calculation formula is as follows:
[0062]
[0063] Where: N is the number of aligned samples in the traversal batch, y i Let y be the true label of the i-th sample. i =1 indicates a sample conflict, y i =0 indicates that the samples do not conflict, x i It is the original logical value output by the model; when y i When = 1, w i Equal to the proportion of conflicting samples; when y i When = 0, w i =1.
[0064] S4: Obtain the standard document to be tested (such as an internal enterprise standard), extract the text and segment it into structured clause units, and perform numerical extraction and pseudo-tag processing on the structured clause units.
[0065] This embodiment utilizes a structured parsing tool (such as MinerU) to perform layout analysis and text extraction on the input standard document to be tested, segmenting it into structured clause units. Each output structured clause unit contains its contextual information in the source document, laying the data foundation for subsequent refined processing. Then, a regular expression script is used to identify and extract numerical expressions (e.g., "not less than 25g", "10%~15%", etc.) from the structured clause units; a pseudo-tokenization (PT) strategy is employed, using special tokens (e.g., |).<NUM_OP_GE_VAL_25_UNIT_g> |) Replace the numerical expression to encapsulate it. This step preserves the integrity of the numerical expression while transforming it into a format that the model can understand as a unit.
[0066] S5: Input the pseudo-labeled structured clause unit into the standard clause numerical conflict judgment model, and input the output vector of the numerical semantic encoding layer into the fully connected neural network layer to obtain the conflict logic value.
[0067] S6: Convert the conflict logic value into a confidence probability using the sigmoid function. If the confidence probability is greater than 0.5, the standard clause is determined to have a numerical conflict; if the confidence probability is less than or equal to 0.5, the standard clause is determined not to have a numerical conflict.
[0068] The formula for calculating the confidence level probability is as follows:
[0069]
[0070] Where: C is the conflict logic value.
[0071] To compare the superiority of the DNCC model in numerical conflict detection, this embodiment uses other representative baseline models covering different technical approaches, such as SVM, Siamese LSTM, Native BERT, RoBERTa, and NumBERT, and compares the training results, as shown in Table 1.
[0072] Table 1 Comparison of Model Performance
[0073] Model P R F1 DNCC 54.55 66.67 60.00 SVM 47.83 35.48 40.74 Siamese LSTM 30.77 38.71 34.29 Native BERT 53.33 25.81 34.78 RoBERTa 52.94 29.03 37.50 NumBERT (SOTA) 46.67 45.16 45.90
[0074] As shown in Table 1, the DNCC model achieved the best performance across all evaluation metrics, with an F1 score of 0.6000, surpassing all tested baselines and demonstrating its superiority. Specifically, DNCC's performance advantage is mainly reflected in its architectural design, especially its core module NC-RoBERTa (RoBERTa+CAA). Compared to NumBERT (F1 = 0.4590), another state-of-the-art model dedicated to solving numerical representation problems, the DNCC framework achieved a performance improvement of nearly 15 percentage points. This indicates that, compared to rewriting text during the preprocessing stage, our strategy of integrating Conflict-Aware Attention (CAA) and Numerical Semantic Encoding (NSE) within the model allows for a deeper and more flexible capture of the complex relationships between numerical values and context. Furthermore, when compared with the standard Cross-Encoder baseline, which also uses the RoBERTa platform, the value of the DNCC model itself is highlighted: with identical pre-trained models, DNCC's F1 score exceeds 22 percentage points (0.6000 vs 0.3750), demonstrating the superior performance of the model's innovative modules, rather than simply relying on a stronger pre-trained model.
[0075] To verify the contribution of each innovative module in the DNCC model, an ablation experiment was conducted, and the results are shown in Table 2. The results indicate that removing any newly added module leads to a decrease in model performance. In particular, removing the core conflict-aware attention module resulted in a sharp drop in the F1 score of 39.4%, demonstrating that it is the most critical factor enabling the model to achieve state-of-the-art (SOTA) performance.
[0076] Table 2 Ablation Experiment Results
[0077] Model F1 Perf. Drop DNCC 60.00 - After removing the dynamic loss weight (DLW) 42.86 -28.6 After removing the numerical semantic encoding layer (NSE) 38.10 -36.5 After removing the conflict-aware attention mechanism (CAA) 36.36 -39.4
[0078] The embodiments described above are merely preferred embodiments of the present invention and are only used to explain the present invention. They are not intended to limit the scope of the present invention. For those skilled in the art, other implementation methods can be easily made by substitution or modification based on the technical content disclosed in this specification. Therefore, all changes and improvements made on the principle of the present invention should be included within the scope of the patent application of the present invention.
Claims
1. A method for determining numerical conflicts in standard clauses based on deep learning, characterized in that, The steps include: S1: Obtain the dataset containing pairs of terms labeled "conflicting" and "non-conflicting"; S2: Construct a standard clause numerical conflict detection model, which includes a dual encoder with shared weights, a numerical semantic encoding layer, and a fully connected neural network layer; introduce a conflict-aware attention mechanism in the first encoder to optimize the attention weights of word pairs; the numerical semantic encoding layer is located after the second encoder; S3: Train the standard clause numerical conflict detection model using the dataset, and calculate the total loss function of the standard clause numerical conflict detection model using a joint optimization strategy; S4: Obtain the standard document to be tested, extract the text and segment it into structured clause units, and perform numerical extraction and pseudo-tag processing on the structured clause units; S5: Input the pseudo-labeled structured clause unit into the standard clause numerical conflict judgment model, and input the output vector of the numerical semantic encoding layer into the fully connected neural network layer to obtain the conflict logic value; S6: Determine whether there is a numerical conflict in the standard clauses based on the conflict logic value.
2. The method for determining numerical conflicts in standard clauses according to claim 1, characterized in that, The formula for calculating the attention weight is as follows: Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively. For L×d k The set of real matrices, where L is the sequence length and d k M is the dimension of the key matrix; M is the conflict-aware dynamic matrix, M∈R L×L .
3. The method for determining numerical conflicts in standard clauses according to claim 1, characterized in that, A vector comparison enhancement strategy is introduced into the numerical semantic encoding layer. This strategy concatenates the original vectors, difference vectors, and product vectors of two sentences to form a combined feature vector. This combined feature vector is then input into the fully connected neural network layer. The combined feature vector is represented as follows: V combined =[v A ;v B ;|v A -v B |;v A ⊙v B ], Where: v A and v B These are the original vectors of statements A and B, respectively; [;] represents the concatenation operation between the two vectors; |v A -v B | represents the absolute difference between two vectors, used to capture the degree of semantic difference; v A ⊙v B It is the Hadamard product of two vectors, used to capture semantically shared activation patterns.
4. The method for determining numerical conflicts in standard clauses according to claim 1, characterized in that, The total loss function is L total The calculation formula is as follows: Where: L CL To contrast the learning loss function, L CLS For the weighted classification loss function, σ1 and σ2 are learnable parameters for task uncertainty.
5. The method for determining numerical conflicts in standard clauses according to claim 4, characterized in that, The contrastive learning loss function L CL The calculation formula is as follows: Where: v A and v B Let v be the original vector of two statements A and B. i To iterate through all vectors within a batch, N is the batch size, and τ is the temperature hyperparameter.
6. The method for determining numerical conflicts in standard clauses according to claim 4, characterized in that, The weighted classification loss function L CLS The calculation formula is as follows: Where: N is the number of aligned samples in the traversal batch, y i Let y be the true label of the i-th sample. i =1 indicates a sample conflict, y i =0 indicates that the samples do not conflict, x i It is the original logical value output by the model; when y i When = 1, w i Equal to the proportion of conflicting samples; when y i When = 0, w i =1.
7. The method for determining numerical conflicts in standard clauses according to claim 1, characterized in that, The specific process of numerical extraction and pseudo-tag processing of structured clause units is as follows: numerical expressions in the standard text are identified and extracted from the structured clause units using regular expression scripts; a pseudo-tag strategy is adopted to replace the numerical expressions with special tags to achieve encapsulation of the numerical expressions.
8. The method for determining numerical conflicts in standard clauses according to claim 1, characterized in that, Step 6 is as follows: The conflict logic value is converted into a confidence probability using the sigmoid function. If the confidence probability is greater than 0.5, the standard clause is determined to have a numerical conflict; if the confidence probability is ≤0.5, the standard clause is determined not to have a numerical conflict. The formula for calculating the confidence probability is as follows: Where: C is the conflict logic value.