Training methods for anomaly detection models, anomaly detection methods, devices and equipment
By acquiring and utilizing training samples for supervised fine-tuning and reinforcement learning, the anomaly recognition process of large models is optimized, solving the problems of black boxing and false positives/false negatives, improving the accuracy and interpretability of the model, and reducing training costs.
Patent Information
- Application Number
- CN202611100479.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-11-17
AI Technical Summary
Existing large models suffer from a black-box problem in the field of anomaly detection. The decision-making logic is difficult to trace, which easily leads to false positives and false negatives. Furthermore, they lack the ability to make comprehensive judgments based on multiple pieces of evidence at the expert level, and the training relies on manual annotation, which is inefficient and costly.
By acquiring training samples, including sample traffic log data, sample prompt words, labeled anomaly identification results, and reasoning chain data, supervised fine-tuning training and reinforcement learning are performed. Rewards are provided based on answer dimension, illusion dimension, and logical reasoning dimension to optimize the training process of the anomaly identification model.
It improves the accuracy and interpretability of the anomaly detection model, reduces false positives and false negatives, enhances reasoning ability in complex scenarios, and reduces training costs and the need to rely on external knowledge bases.
Smart Images

Figure CN123117250A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to the fields of artificial intelligence, natural language processing, large models, intelligent agents, and deep learning. In particular, it relates to a training method, anomaly recognition method, apparatus, and device for an anomaly recognition model. Background Technology
[0002] With the development of large-scale model and intelligent agent technologies, applying them to the field of anomaly recognition has become one of the core directions for the intelligent upgrading of the industry.
[0003] However, when using large models for anomaly detection reasoning, the models not only need to memorize knowledge but also need to mimic the reasoning process of experts making comprehensive judgments under multiple pieces of evidence and ambiguous signals. Currently, the anomaly detection reasoning process of large models still suffers from a black-box problem; the decision-making logic is difficult to trace, and false positives and false negatives that contradict expert experience are easily generated. Therefore, it is crucial to define and optimize the interpretable reasoning framework of large models in anomaly detection tasks, ensuring that their decision-making criteria are deeply aligned with the complex practical experience of business experts. Summary of the Invention
[0004] This disclosure provides a training method for an anomaly recognition model, an anomaly recognition method, an apparatus, and a device.
[0005] According to one aspect of this disclosure, a training method for an anomaly detection model is provided. The method includes: acquiring training samples; wherein the training samples include sample traffic log data, sample prompt words corresponding to the sample traffic log data, labeled anomaly detection results, and labeled reasoning chain data; performing supervised fine-tuning training on an initial anomaly detection model based on the training samples to obtain an intermediate anomaly detection model; and performing reinforcement learning training on the intermediate anomaly detection model based on the training samples to obtain a target anomaly detection model; wherein the target dimension reward includes at least one of an answer dimension reward, an illusion dimension reward, and a logical reasoning dimension reward, wherein the answer dimension reward is determined by a first prediction detection result, and the logical reasoning dimension reward is determined based on the accuracy of the identification of anomaly signals in the sample traffic log data using the first prediction reasoning chain data, and the first prediction detection result and the first prediction reasoning chain data are generated when the intermediate anomaly detection model performs reasoning based on the sample prompt words.
[0006] According to another aspect of this disclosure, an anomaly identification method is provided, the method comprising: acquiring target traffic data and determining target prompt words based on the target traffic data; employing a target anomaly identification model to perform anomaly identification on the target traffic data based on the target prompt words, thereby obtaining target anomaly identification results and target reasoning chain data; wherein the target anomaly identification model is trained using the method provided in the above aspect of this disclosure.
[0007] According to another aspect of this disclosure, a training apparatus for an anomaly recognition model is provided. The apparatus includes: an acquisition module for acquiring training samples; wherein the training samples include sample traffic log data, and sample prompt words, labeled anomaly recognition results, and labeled reasoning chain data corresponding to the sample traffic log data; a first training module for supervised fine-tuning training of an initial anomaly recognition model based on the training samples to obtain an intermediate anomaly recognition model; and a second training module for reinforcement learning training of the intermediate anomaly recognition model based on the training samples to obtain a target anomaly recognition model; wherein the target dimension reward includes at least one of an answer dimension reward, an illusion dimension reward, and a reasoning logic dimension reward, the answer dimension reward being determined by a first prediction recognition result, and the reasoning logic dimension reward being determined based on the accuracy of the identification of anomaly signals in the sample traffic log data using the first prediction reasoning chain data, wherein the first prediction recognition result and the first prediction reasoning chain data are generated when the intermediate anomaly recognition model performs reasoning based on the sample prompt words.
[0008] According to another aspect of this disclosure, an anomaly identification device is provided, the device comprising: a first processing module, configured to acquire target traffic data and determine target prompt words based on the target traffic data; and an identification module, configured to use a target anomaly identification model to perform anomaly identification on the target traffic data based on the target prompt words, thereby obtaining target anomaly identification results and target reasoning chain data; wherein the target anomaly identification model is trained using the method provided in the above aspect of this disclosure.
[0009] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a training method for an anomaly recognition model proposed in one aspect of this disclosure, or an anomaly recognition method proposed in another aspect.
[0010] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided that stores computer instructions for causing a computer to execute a training method for an anomaly recognition model proposed in one aspect of this disclosure, or an anomaly recognition method proposed in another aspect.
[0011] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the training method for the anomaly recognition model proposed in one aspect of this disclosure or the anomaly recognition method proposed in another aspect.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0013] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure; Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure; Figure 3 This is a schematic diagram according to the third embodiment of the present disclosure; Figure 4 This is a schematic diagram according to the fourth embodiment of the present disclosure; Figure 5 This is a schematic diagram according to the fifth embodiment of the present disclosure; Figure 6 This is a schematic diagram according to the sixth embodiment of the present disclosure; Figure 7 This is a block diagram of an electronic device used to implement the training method or anomaly recognition method of the anomaly recognition model in the embodiments of this disclosure. Detailed Implementation
[0014] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0015] In related technologies, large-scale model applications in the field of anomaly detection (such as traffic fraud prevention) mainly adopt the following two technical paths: (1) Lightweight application based on prompt word engineering and RAG (Retrieval-Augmented Generation) technology By combining meticulously designed prompt word engineering with search enhancement generation technology, and leveraging external knowledge bases to supplement the general capabilities of the base model, this solution offers advantages such as rapid startup and low deployment costs. It guides the model to perform anomaly detection by injecting business rules and case knowledge into the prompt word templates.
[0016] (2) Direct application based on the general large model This approach directly uses general-purpose models that have not been adapted to the domain (such as models with network architectures like GPT (Generative Pre-trained Transformer) series and Qwen series) for anti-cheating judgment. This scheme relies on the general reasoning ability learned during the model's pre-training stage and guides the model to complete the anomaly detection task using few-shot examples.
[0017] The core idea of both of the above solutions is to leverage the general capabilities of the model to convey business knowledge through prompts or external knowledge bases, but they do not perform targeted domain adaptation or enhance the model's reasoning capabilities.
[0018] The above solution has at least the following limitations: 1. Effectiveness is limited by the capabilities of the base model: The effectiveness of the cue word engineering and RAG schemes heavily depends on the general reasoning capabilities of the base model. For complex tasks such as anti-fraud that require deep logical deduction and multi-evidence correlation, general models often struggle to reach expert-level judgment.
[0019] 2. External knowledge base quality bottleneck: The performance limit of the RAG solution is limited by the quality and coverage of the external knowledge base; the experience of anti-fraud experts is highly unstructured, making it difficult to systematically transform into high-quality knowledge base content, and the maintenance cost of the knowledge base is high.
[0020] 3. The reasoning process is not interpretable: The output of general large models is often a black box, which cannot provide a clear reasoning chain and makes it difficult for relevant staff to understand the basis for the model's judgment, which is not conducive to strategy optimization and case review.
[0021] 4. Training relies on manual annotation, resulting in low iteration efficiency: If the above solutions want to improve the model performance, a large amount of manually annotated data and evaluation are required. The process is lengthy and costly, making it difficult to support rapid model iteration and continuous optimization.
[0022] 5. Lack of domain-specific reasoning ability: General models are difficult to imitate the reasoning process of experts making comprehensive judgments under multiple pieces of evidence and ambiguous signals. In particular, expert-level reasoning abilities such as weighing strong and weak anomalies and identifying contradictory evidence are difficult to achieve through cue word engineering.
[0023] To address at least one of the aforementioned problems, this disclosure proposes a training method for an anomaly recognition model, an anomaly recognition method, apparatus, and device.
[0024] Figure 1 The diagram is based on the first embodiment of the present disclosure. It should be noted that the training method of the anomaly recognition model in the present disclosure can be applied to the training device of the anomaly recognition model. The device can be configured in an electronic device so that the electronic device can perform the training function of the anomaly recognition model.
[0025] The electronic device can be any device with computing capabilities, such as a personal computer (PC), mobile terminal, server, etc. Mobile terminals can include in-vehicle devices, mobile phones, tablets, personal digital assistants, wearable devices, smart speakers, servers, server clusters, and other hardware devices with various operating systems, touchscreens, and / or displays. The training device for the anomaly detection model can also be software within the electronic device, such as training software for the anomaly detection model. The following embodiments use an electronic device as an example for illustration.
[0026] like Figure 1 As shown, the training method for this anomaly detection model may include the following steps: Step 101: Obtain training samples; wherein, the training samples include sample traffic log data, sample prompt words corresponding to the sample traffic log data, anomaly identification results and annotated reasoning chain data.
[0027] The sample traffic log data may include historical business or network business behavior logs, such as access IP (Internet Protocol) addresses, requested interfaces, request frequency, page turning behavior, link jumps, etc., and this disclosure does not impose any restrictions on this. It should be noted that this disclosure does not impose any restrictions on the amount of sample traffic log data.
[0028] The sample prompt words can be constructed based on sample traffic log data. For example, sample traffic log data can be filled into the corresponding positions in the prompt word template to obtain sample prompt words; alternatively, features can be extracted from the sample traffic log data to obtain corresponding features (such as IP type, number of consecutive requests, number of interface accesses, etc.), and these features can be filled into the corresponding positions in the prompt word template to obtain sample prompt words. It should be noted that this disclosure does not limit the features; the features to be extracted can be dynamically set as needed.
[0029] Among them, the anomaly identification results can be used to indicate the anomaly identification results corresponding to the sample traffic log data. For example, the anomaly identification results can be used to indicate whether the sample traffic log data is abnormal, the type of anomaly, etc.
[0030] Among them, the labeled reasoning chain data can be used to indicate the step-by-step reasoning logic, judgment basis, and derivation path for reasoning on sample traffic log data and obtaining labeled anomaly identification results.
[0031] Step 102: Supervised fine-tuning training of the initial anomaly recognition model based on training samples to obtain an intermediate anomaly recognition model.
[0032] The initial anomaly identification model can select a network structure as needed, such as the Qwen network structure.
[0033] For example, sample prompt words can be input into the initial anomaly detection model, and based on the output of the large model, the anomaly detection results and the anomaly reasoning chain data, the loss value can be calculated. The model parameters of the initial anomaly detection model can be adjusted according to the loss value to obtain the intermediate anomaly detection model.
[0034] Step 103: Based on the training samples, perform reinforcement learning training on the intermediate anomaly recognition model with target dimension reward to obtain the target anomaly recognition model.
[0035] The target dimension reward may include at least one of the following: answer dimension reward, illusion dimension reward, and logical reasoning dimension reward.
[0036] The answer dimension reward can be determined based on the first predicted identification result. This first predicted identification result can be the anomaly identification result obtained from an intermediate anomaly identification model through anomaly identification or inference processing. For example, when the first predicted identification result matches the labeled anomaly identification result, the answer dimension reward is 1; when the first predicted identification result does not match the labeled anomaly identification result, the answer dimension reward is -1. It should be noted that the above method for determining the answer dimension reward is merely exemplary, and other methods can be used in practical applications; this disclosure does not impose any limitations on this.
[0037] The reward for logical reasoning can be determined based on the accuracy of identifying abnormal signals in sample traffic log data using the first predictive reasoning thought chain data. It's understandable that in real-world applications, traffic log data commonly contains various potential abnormal signals. These signals are not uniformly risky; rather, they can be categorized into different strength levels based on indicators such as the deviation of user behavior from the baseline pattern, the risk level of the operational behavior, the coverage dimension of abnormal features, and the scope of impact on the business. For example, the strength levels can be divided into strong negative, weak negative, strong positive, weak positive, and none. Strong negative refers to an extreme negative deviation of traffic behavior from the normal baseline pattern; weak negative refers to a slight negative deviation; strong positive refers to an extreme positive deviation, such as a surge in traffic due to compliant activities; weak positive refers to a slight positive deviation, such as a small increase in normal access activity or a temporary increase in traffic from compliant businesses; and "none" indicates that the traffic behavior completely conforms to the normal baseline pattern, with no abnormal signals. It should be noted that the above interpretation of strength levels is merely illustrative, and this disclosure does not limit the method of classifying the strength levels of abnormal signals, the number of levels, or the specific definitions.
[0038] It should also be noted that recognition accuracy can be positively correlated with the reward in the logical reasoning dimension. That is, the higher the recognition accuracy, the higher the reward in the logical reasoning dimension, and vice versa.
[0039] The first prediction recognition result and the first prediction reasoning chain data can both be generated when reasoning based on sample prompt words using the intermediate anomaly recognition model.
[0040] The training method for the anomaly recognition model in this embodiment involves acquiring training samples, which include sample traffic log data, sample prompt words corresponding to the sample traffic log data, labeled anomaly recognition results, and labeled reasoning chain data. Based on the training samples, an initial anomaly recognition model is subjected to supervised fine-tuning training to obtain an intermediate anomaly recognition model. Based on the training samples, the intermediate anomaly recognition model is subjected to reinforcement learning training with a target dimension reward to obtain a target anomaly recognition model. The target dimension reward includes at least one of an answer dimension reward, an illusion dimension reward, and a logical reasoning dimension reward. The answer dimension reward is determined by the first prediction recognition result, and the logical reasoning dimension reward is determined based on the accuracy of the identification of anomaly signals in the sample traffic log data using the first prediction reasoning chain data. The first prediction recognition result and the first prediction reasoning chain data are generated when the intermediate anomaly recognition model performs reasoning based on the sample prompt words. Therefore, by using training samples containing labeled reasoning thought chain data, the initial anomaly detection model can be trained through a reinforcement learning framework that integrates supervised fine-tuning and target-dimensional reward-driven learning. Answer-dimensional rewards can be used to improve the accuracy of anomaly detection results, illusion-dimensional rewards can be used to suppress false outputs, and logical reasoning-dimensional rewards can be used to improve the accuracy of anomaly signal recognition. By specifically optimizing model performance using answer-dimensional, illusion-dimensional, and logical reasoning-dimensional rewards, the accuracy of anomaly detection, anti-illusion capabilities, and comprehensive reasoning capabilities in complex scenarios can be effectively improved. On the one hand, this approach avoids the limitations of simply relying on prompt word engineering, RAG, and general base model capabilities, allowing for targeted refinement of the model's domain-specific reasoning capabilities in traffic anomaly detection. On the other hand, it avoids excessive reliance on structured external knowledge bases, thus mitigating the problems of difficult knowledge base construction, high maintenance costs, and insufficient coverage. Furthermore, the model outputs complete reasoning thought chain data, providing relevant users with clear anomaly judgment logic, making the anomaly detection results interpretable.
[0041] like Figure 2 As shown, this disclosure also proposes a training method for an anomaly recognition model. Figure 2 The diagram is based on the second embodiment of this disclosure. Based on any embodiment of this disclosure, the training method for the anomaly detection model may further include the following steps: Step 201: Analyze the data of the first predictive reasoning thought chain to obtain the index value of the first sub-dimension.
[0042] The first sub-dimension may include at least one of the signal recall sub-dimension, the intensity calibration sub-dimension, and the logical sub-dimension.
[0043] Among them, the index value of the signal recall sub-dimension can be used to characterize the completeness of the first predictive inference thinking chain data in identifying key abnormal signals in the sample traffic log data.
[0044] Among them, the key abnormal signal can be determined based on the strength level of the abnormal signal. For example, a strong positive signal or a strong negative signal can be used as the key abnormal signal.
[0045] It should be noted that completeness can be positively correlated with the indicator value of the signal recall sub-dimension. For example, the higher the completeness, the higher the indicator value of the signal recall sub-dimension, and vice versa.
[0046] For example, the first predictive inference thought chain data can be input into a large model. Based on this data, the large model can evaluate whether the intermediate anomaly identification model identifies and mentions key anomaly signals in the input data, and whether it misses strong positive / strong negative signals. In response to the output of the large model, the completeness is obtained, and based on this completeness, the indicator value for the signal recall sub-dimension is determined. It should be noted that the publicly disclosed range of indicator values for the signal recall sub-dimension is not limited; for example, it can be 1 to 5, etc.
[0047] Among them, the index value of the intensity calibration sub-dimension can be used to characterize the accuracy of the first predictive inference thinking chain data in judging the strength level of abnormal signals in the sample traffic log data.
[0048] For example, the first predictive inference thought chain data can be input into a large model. Based on this data, the large model can evaluate whether the first predictive inference thought chain data strictly anchors the domain specifications in its judgment of the strength of each signal in the sample traffic log data, and whether it exaggerates weak signals or ignores strong signals. In response to the output of the large model, the accuracy of the first predictive inference thought chain data in judging the strength level of abnormal signals in the sample traffic log data can be obtained. Based on this accuracy, the index value of the intensity calibration sub-dimension can be determined. It should be noted that the disclosed range of the index value for the intensity calibration sub-dimension is not limited; for example, it can be 1 to 5, etc.
[0049] Among them, the index value of the logical sub-dimension can be used to characterize the degree of logical consistency between the data of the first predictive reasoning thought chain and the preset reasoning rules.
[0050] Among them, the preset inference rules can be pre-configured, such as signal priority rules, risk judgment rules, and data pre-verification rules based on the strength level of abnormal signals.
[0051] For example, the first predictive inference thought chain data can be input into a large model. Based on this data, the large model evaluates whether adversarial rules such as "strong positive suppresses weak negative" and "strong negative veto" are followed, and whether the pre-validation of statistical validity is correctly executed. In response to the output of the large model, the logical consistency degree of the first predictive inference thought chain data with the preset inference rules is obtained. Based on this logical consistency degree, the index value of the logical sub-dimension is determined. It should be noted that the publicly disclosed range of index values for the logical sub-dimension is not limited; for example, it can be 1 to 5, etc.
[0052] Step 202: Aggregate the index values of at least one first sub-dimension to obtain the first target score.
[0053] As an example, assuming the first sub-dimension includes a signal recall sub-dimension, an intensity calibration sub-dimension, and a logical sub-dimension, the weighted sum of the index values corresponding to the signal recall sub-dimension, the intensity calibration sub-dimension, and the logical sub-dimension can be used to obtain the first target score.
[0054] Step 203: Determine the accuracy of the judgment based on the score of the first target.
[0055] As an example, the score for the first objective can be defined as the accuracy of the judgment.
[0056] As another example, the score of the first objective can be mapped to the value space of the first objective to obtain the judgment accuracy. For example, assuming the value space of the first objective is [0.05, 0.25], the score of the first objective can be mapped to [0.05, 0.25] according to the corresponding mapping relationship to obtain the judgment accuracy. Thus, by mapping the score of the first objective to the corresponding value space to obtain the judgment accuracy, the quantification standard can be unified, the differences in the units of different dimensions of indicators can be eliminated, making the evaluation results more intuitive and standardized, facilitating the unified calculation and comparison of subsequent reward scores, maintaining the stability and controllability of reward signal output in reinforcement learning training, and thus accurately guiding the model to optimize the reasoning chain, continuously improving the recognition accuracy and reasoning standardization of the anomaly recognition model.
[0057] The training method for the anomaly recognition model in this embodiment analyzes the data of a first predictive inference thought chain to obtain the index values of a first sub-dimension. The first sub-dimension includes at least one of a signal recall sub-dimension, an intensity calibration sub-dimension, and a logical sub-dimension. The index value of the signal recall sub-dimension characterizes the completeness of the first predictive inference thought chain data in identifying key anomaly signals in traffic log data. The index value of the intensity calibration sub-dimension characterizes the accuracy of the first predictive inference thought chain data in determining the strength level of anomaly signals in traffic log data. The index value of the logical sub-dimension characterizes the logical consistency of the first predictive inference thought chain data with preset inference rules. The index values of at least one first sub-dimension are aggregated to obtain a first target score. The judgment accuracy is determined based on the first target score. Therefore, it can refine the model's expert-level reasoning capabilities from multiple fine-grained dimensions, including the completeness of key anomaly signal recall, the accuracy of anomaly strength level calibration, and the compliance of reasoning logic. This effectively solves the problems of evidence omission, anomaly strength judgment bias, and chaotic reasoning logic that exist in general models in complex traffic anomaly identification scenarios. The first target score obtained by aggregating multi-dimensional index values can truly and comprehensively reflect the overall accuracy of the model's judgment, providing reliable data basis for the calculation of subsequent logical reasoning dimension rewards. Furthermore, it relies on reward signals to guide model iterative optimization, continuously strengthening the model's domain-specific reasoning capabilities for multi-evidence association, fuzzy anomaly signal identification, and contradictory logic verification. At the same time, it makes the model's reasoning performance quantifiable, traceable, and optimizable, improving the shortcomings of related technologies such as the black box of model reasoning process, lack of clear guidance for effect optimization, and insufficient recognition accuracy in complex scenarios. This enhances the accuracy, logic, and credibility of anomaly identification results and improves the adaptability of the model to anomaly identification business scenarios.
[0058] like Figure 3 As shown, this disclosure also proposes a training method for an anomaly recognition model. Figure 3 The diagram illustrates an anomaly detection model according to a third embodiment of this disclosure. The training method for this anomaly detection model may include the following steps: Step 301: Extract features from the sample traffic log data to obtain sample features.
[0059] It should be noted that this disclosure does not impose any restrictions on the extracted sample features. For example, they can be IP features (such as IP address, IP type, etc.), interface features (such as request interface name, interface type, etc.), behavioral features (such as whether there is continuous pagination, whether there is external link redirection, etc.), statistical features, etc.
[0060] As an example, a feature extraction model can be used to extract features from sample traffic log data to obtain sample features.
[0061] Step 302: Based on the sample characteristics, construct sample prompt words corresponding to the sample traffic log data, and annotate the sample traffic log data to obtain the anomaly identification results.
[0062] As an example, sample features can be filled into the corresponding positions in the prompt word template to obtain sample prompt words; then, manual annotation or annotation tools can be used to annotate the sample traffic log data to obtain the annotation anomaly identification results; furthermore, the sample prompt words and the annotation anomaly identification results can be used as training data.
[0063] It should be noted that the explanations of sample prompts and anomaly identification results in any of the foregoing embodiments also apply to this embodiment, and will not be repeated here.
[0064] Step 303: Based on the sample prompt words and the results of anomaly identification, perform inference processing to obtain annotated inference thought chain data used as training data.
[0065] As one possible approach, a teacher model is employed. Based on sample prompts and anomaly identification results, reasoning is performed in the following order: anomaly signal identification, evidence association analysis, contradiction detection, and conclusion derivation, to obtain annotated reasoning thought chain data.
[0066] The abnormal signal identification stage can be used to identify abnormal signals in sample traffic log data, obtain sample abnormal signals, and determine the abnormal signal strength level of the sample abnormal signals according to the preset signal strength grading rules.
[0067] The signal strength grading rules can be pre-defined and can be used to classify abnormal signals in sample traffic log data into different levels and define signal types. For example, abnormal signals in sample traffic log data can be classified into strong negative, weak negative, strong positive, weak positive, and none levels.
[0068] The evidence association analysis stage can be used to perform evidence association analysis on abnormal signals of samples with varying degrees of abnormal signal strength, and generate evidence association relationships.
[0069] Among them, the evidence correlation relationship can be, for example, but not limited to: the correspondence between features and the strength level of abnormal signals, the primary and secondary hierarchical relationship between multiple sets of evidence, the conflict suppression or fusion relationship between different abnormal signals, the causal inference relationship between abnormal evidence and abnormal identification conclusions, etc.
[0070] The conflict detection stage is used to detect conflicts in the correlation of evidence in order to obtain conflict detection results.
[0071] Among them, conflict detection results can be used to indicate whether there are contradictions or conflicts in the correlation of evidence.
[0072] The conclusion derivation stage can be used to generate labeled anomaly identification results based on the conflict detection results.
[0073] For example, sample prompts and anomaly identification results can be input into the teacher model. The teacher model first performs the anomaly signal identification stage, that is, based on the sample prompts, the teacher model identifies anomaly signals in the sample traffic log data, obtains sample anomaly signals, and determines the anomaly signal strength level according to the preset signal strength grading rules. Then, the teacher model performs the evidence association analysis stage, that is, the teacher model performs evidence association analysis on sample anomaly signals with anomaly signal strength levels to generate evidence association relationships. Next, the teacher model performs the contradiction detection stage, that is, the teacher model performs conflict detection on the evidence association relationships to obtain conflict detection results. Finally, the teacher model performs the conclusion deduction stage, that is, in response to the conflict detection result indicating no conflict, the teacher model generates the anomaly identification result corresponding to the sample traffic log data based on the evidence association relationship. Finally, when the anomaly identification result corresponding to the sample traffic log data matches (or is the same as) the anomaly identification result, the teacher model can use the reasoning logic data used in the reasoning processing according to the above stages in sequence to generate annotated reasoning thought chain data.
[0074] Optionally, if the conflict detection result indicates a conflict, or if the anomaly identification result corresponding to the sample traffic log data does not match the labeled anomaly identification result, the teacher model can be re-adopted. The reasoning process can be re-executed according to the sample prompt words and labeled anomaly identification results, following the sequence of anomaly signal identification stage, evidence association analysis stage, contradiction point detection stage, and conclusion derivation stage, until the set conditions (such as no conflict) are met.
[0075] Therefore, by using a teacher model to generate labeled reasoning thought chain data step by step according to a standardized four-stage process, the data sequentially completes the identification of abnormal signals, evidence correlation analysis, contradiction detection, and conclusion deduction. This allows the labeled reasoning thought chain data to completely replicate the judgment logic of domain experts, saving the high cost of manual labeling of thought chains, improving sample production efficiency, and unifying the reasoning paradigm and evaluation criteria. It can provide high-quality and standardized learning samples for model training, helping to guide the anomaly identification model to learn the steps and multi-dimensional professional reasoning capabilities. This effectively strengthens the model's core capabilities such as anomaly signal classification, evidence linkage, and conflict identification, further improving the accuracy and interpretability of anomaly identification in complex scenarios.
[0076] As another possible implementation, the target base model is trained under supervision using sample prompts and anomaly identification results to obtain a domain base model. Then, the domain base model is used to perform inference processing based on sample prompts and anomaly identification results to obtain labeled inference thought chain data.
[0077] It should be noted that the target base model can have the same network architecture as the initial anomaly detection model. For example, if the network architecture of the initial anomaly detection model is Qwen, then the network architecture of the target base model can also be Qwen. It should also be noted that the model sizes of the target base model and the initial anomaly detection model can be the same or different. For example, the initial anomaly detection model can be Qwen3-32B, Qwen3-7B, etc., and the target base model can be Qwen3-32B. It should be noted that the network architectures and sizes used for the target base model and the initial anomaly detection model described above are merely illustrative, and this disclosure does not impose any limitations on them.
[0078] To achieve the acquisition of the domain base model, as an example, sample prompt words can be input into the target base model, and a third prediction recognition result can be obtained in response to the output of the target base model; based on the difference between the third prediction recognition result and the labeled anomaly recognition result, the model parameters of the target base model can be adjusted.
[0079] Furthermore, exemplarily, a first loss value can be generated based on the difference between the third predicted identification result and the labeled anomaly identification result. Thus, in this disclosure, the model parameters in the target base model can be adjusted based on the first loss value to minimize the loss value. It should be noted that the above example only uses minimizing the loss value as the termination condition for training the target base model. In practical applications, other termination conditions can also be set, such as reaching a set number of training iterations or a set training duration, etc. This disclosure does not impose any limitations on these conditions.
[0080] After obtaining the base domain model, in order to acquire the labeled reasoning thought chain data, as an example, sample prompt words can be input into the base domain model. The base domain model can then perform reasoning processing on the sample traffic log data, that is, perform anomaly identification on the sample traffic log data through the base domain model, and respond to the output of the base domain model to obtain the fourth prediction identification result. When the fourth prediction identification result matches (or is the same as) the labeled anomaly identification result, the reasoning logic used by the base domain model in the reasoning process is used to generate labeled reasoning thought chain data.
[0081] Therefore, by first adapting the target base model to the anomaly recognition domain through supervised fine-tuning to obtain a domain-based model, and then having this model autonomously generate labeled reasoning thought chain data, reasoning can be carried out by fully combining domain-specific knowledge. This not only effectively avoids the problem of insufficient domain adaptation of general models, but also eliminates the need for manual labeling of thought chains, reducing sample production costs. At the same time, the generated thought chain data can fit the business judgment logic, providing highly adapted and high-quality training data for subsequent model training, which helps to improve the model's anomaly recognition and reasoning capabilities.
[0082] It is understandable that the quality of the obtained training data varies, therefore, the training data can be filtered. One possible approach is to analyze the labeled inference thought chain data to obtain the index values of the second sub-dimension; aggregate the index values of at least one second sub-dimension to obtain the second target score; and then filter the labeled inference thought chain data based on the second target score.
[0083] The second sub-dimension may include at least one of the following: data accuracy sub-dimension, illusion suppression sub-dimension, and contextual logic sub-dimension.
[0084] Among them, the index value of the data accuracy sub-dimension can be determined based on the accuracy of the feature information introduced into the labeled reasoning thought chain data.
[0085] Among them, the index value of the illusion suppression sub-dimension can be determined based on whether the labeled reasoning thought chain data contains information that is not present in the sample prompt words.
[0086] Among them, the index value of the contextual logic sub-dimension can be determined by the degree of fit between the level of refinement of the reasoning generalization based on the labeled reasoning thought chain data and the strength level of the abnormal signals in the sample traffic log data.
[0087] As an example, labeled reasoning thought chain data, sample prompt words, sample traffic log data, and sample features corresponding to the sample traffic log data can be input into a large model. The large model can then comprehensively score the input feature data (referred to as feature information in this disclosure) from the labeled reasoning thought chain data based on three aspects: the fidelity (referred to as accuracy in this disclosure) of the input feature data, the distinction between reasonable generalizations and factual errors in content, and whether numerical estimation leads to a reversal of logical direction. This yields an index value for the data accuracy sub-dimension, which can range from 1 to 5 points. Alternatively, the large model can also use labeled reasoning thought chain data... The evaluation criteria are as follows: whether information not present in the input data (referred to as sample prompts in this disclosure) is included, and whether there are issues of misattribution of sample features in the labeled reasoning thought chain data. These two aspects are used to comprehensively score the data, resulting in an index value for the illusion suppression sub-dimension, which can range from 1 to 5 points. Alternatively, a large model can be used to comprehensively score the data based on the degree of matching between the reasoning summary of the labeled reasoning thought chain data and the input context, combined with the judgment rule of "allowing moderate ambiguity in macro-description and requiring strict precision in precise reasoning." This yields an index value for the contextual logic sub-dimension, which can also range from 1 to 5 points.
[0088] It should be noted that the above methods for determining the indicator values and the range of indicator values are merely illustrative examples, and other methods may be used in practical applications. This disclosure does not impose any restrictions on these methods.
[0089] Further, for example, after obtaining the index value of the second sub-dimension, the index values of at least one second sub-dimension can be weighted and summed to obtain the second target score; when the second target score is greater than the set score threshold, the training data consisting of the labeled reasoning thought chain data and the corresponding sample prompt words, labeled anomaly identification results, and sample traffic log data is retained for subsequent model training; when the second target score is not greater than the set score threshold, the training data consisting of the labeled reasoning thought chain data and the corresponding sample prompt words, labeled anomaly identification results, and sample traffic log data can be cleared.
[0090] Therefore, the labeled reasoning thought chain data can be quantitatively evaluated from multiple dimensions, including data accuracy, hallucination suppression, and contextual logic. The target score obtained by aggregating the indicators of each dimension can be used to screen training samples. This can effectively identify and eliminate low-quality training data such as feature referencing errors, irrelevant information generated out of thin air, and inference statements that do not match the anomaly level. This effectively purifies the training sample set, reduces hallucination problems from the source, standardizes reasoning logic, and provides high-precision, compliant, and logically adapted high-quality samples for model training. This further maintains the subsequent model training effect and effectively enhances the model's information referencing ability, anti-hallucination ability, and the matching degree of reasoning with business scenarios.
[0091] Step 304: Supervised fine-tuning training of the initial anomaly recognition model based on training samples to obtain an intermediate anomaly recognition model.
[0092] It should be noted that the execution process of step 304 can refer to the execution process of any embodiment of this disclosure, and will not be repeated here.
[0093] In one possible implementation of this disclosure, sample prompt words are input into an initial anomaly recognition model to obtain a second predicted anomaly recognition result and a second predicted inference thought chain data; based on the difference between the second predicted recognition result and the labeled anomaly recognition result, and the difference between the second predicted inference thought chain data and the labeled inference thought chain data, the initial anomaly recognition model is trained to obtain an intermediate anomaly recognition model.
[0094] The second predicted anomaly identification result and the second predicted inference thought chain data can be obtained by the initial anomaly identification model based on sample prompt words to perform anomaly identification or inference processing on sample traffic log data. The second predicted anomaly identification result can be used to indicate the anomaly identification result obtained by the initial anomaly identification model based on sample prompt words to perform anomaly identification or inference processing on sample traffic log data. The second predicted inference thought chain data can be used to indicate the logical processing process when the initial anomaly identification model performs anomaly identification or inference processing on sample traffic log data based on sample prompt words.
[0095] To train the initial anomaly detection model, one possible approach is to determine a first sub-loss value based on the difference between the second predicted anomaly detection result and the labeled anomaly detection result; and a second sub-loss value based on the difference between the second predicted inference chain data and the labeled inference chain data. Then, the first and second sub-loss values are fused to obtain the target loss value. Based on the target loss value, the parameters of the initial anomaly detection model are adjusted to minimize the loss value, thus obtaining an intermediate anomaly detection model. Therefore, by calculating and fusing loss values for both the anomaly detection result and the inference chain data, the target loss value can be obtained. This target loss value allows for simultaneous constraint on the model's judgment conclusions and inference process, optimizing the model's capabilities in two dimensions, effectively improving the model's detection accuracy and inference rigor, and enhancing the model's performance.
[0096] It should be noted that the above example only uses minimizing the loss value as the termination condition for the initial anomaly recognition model training. In actual applications, other termination conditions can also be set. For example, the termination condition can be that the number of training iterations reaches a set number, or the training duration reaches a set duration, etc. This disclosure does not impose any restrictions on this.
[0097] To obtain the target loss value, as one possible approach, the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value are determined based on the first number of word elements in the second prediction recognition result and the second number of word elements in the second prediction inference thought chain data. Based on the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value, the first sub-loss value and the second sub-loss value are weighted and summed to obtain the target loss value.
[0098] It is understandable that the number of words in the second prediction recognition result may be much smaller than the number of words in the second prediction inference chain data. For example, the second prediction recognition result may be "anomaly exists," but the number of words is small. If the target loss value is calculated directly, the loss value corresponding to the second prediction recognition result may be overwhelmed by the overall loss value, thus preventing the model from effectively learning and recognizing task-related features. Therefore, in this embodiment, the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value can be determined based on the first number of words in the second prediction recognition result and the second number of words in the second prediction inference chain data. For example, the weights can be set inversely proportional to the first and second numbers, with a larger weight value for fewer words to avoid dilution of the loss term. Thus, after obtaining the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value, the first sub-loss value and the second sub-loss value can be weighted and summed based on the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value to obtain the target loss value.
[0099] Therefore, by dynamically configuring the corresponding loss weights based on the number of lexical units in the prediction recognition results and the prediction reasoning chain data, the problem of a single loss term dominating training can be effectively avoided. This allows the model to achieve balanced optimization in both conclusion judgment and logical deduction, improving the rationality of model training and helping to improve the accuracy and reliability of model reasoning.
[0100] Understandably, the differences between the second predicted identification results and the labeled anomaly identification results, as well as the differences between the second predicted reasoning chain data and the labeled reasoning chain data, can be used to train the initial anomaly identification model. This can simultaneously optimize the model's judgment and logical reasoning abilities, achieve bidirectional alignment between the judgment conclusions and the reasoning process, effectively improve the accuracy and standardization of anomaly identification, and enhance the model's anomaly identification capabilities and domain adaptability.
[0101] Step 305: Based on the training samples, perform reinforcement learning training on the intermediate anomaly recognition model with target dimension reward to obtain the target anomaly recognition model.
[0102] The target dimension reward includes at least one of the answer dimension reward, illusion dimension reward, and logical reasoning dimension reward. The answer dimension reward is determined by the first prediction recognition result, and the logical reasoning dimension reward is determined by the accuracy of the judgment of the strength of abnormal signals in the sample traffic log data based on the first prediction reasoning thought chain data. The first prediction recognition result and the first prediction reasoning thought chain data are generated when the intermediate anomaly recognition model is used to reason based on the sample prompt words.
[0103] It should be noted that the execution process of step 305 can refer to the execution process of any embodiment of this disclosure, and will not be described in detail here.
[0104] In one possible implementation of this disclosure, the illusion dimension reward can be determined based on the accuracy of the reference to the input feature data by the first predictive reasoning thought chain data, the situation of content distinguishing reasonable generalization from factual errors, and whether the numerical estimation leads to a reversal of the logical direction.
[0105] As an example, the first predictive reasoning thought chain data, sample prompts, and sample traffic log data can be input into a large model. The large model then comprehensively scores the input feature data based on three aspects: the accuracy of the references to the input feature data using the first predictive reasoning thought chain data, the reasonableness of content summarization and factual errors, and whether numerical estimation leads to a reversal of logical direction. This yields a third objective score. Based on this third objective score, the illusion dimension reward can be determined. For example, the third objective score can be mapped to the second objective value space (e.g., [0.05, 0.25]) to obtain the illusion dimension reward. Therefore, the illusion dimension reward can be comprehensively evaluated from multiple aspects, including feature reference accuracy, reasonableness of content summarization, factual errors, and the impact of numerical estimation. This effectively measures the authenticity and compliance of the reasoning thought chain, effectively constrains problems such as the model fabricating information out of thin air, distorted expression, and logical errors caused by numerical deviations. It strengthens the model's illusion suppression ability, ensuring that the model's reasoning content aligns with the original data, and improving the correctness and stability of the model's logical direction during reasoning.
[0106] In one possible implementation of this disclosure, the intermediate anomaly identification model can be trained by reinforcement learning using the PPO (Proximal Policy Optimization) algorithm based on training samples to obtain the target anomaly identification model; wherein, the reward signal for reinforcement learning training can be obtained by aggregating the answer dimension reward, the illusion dimension reward and the logical reasoning dimension reward.
[0107] For example, the specific process of the PPO algorithm based on target dimension reward can be as follows: (1) (2) (3) (4) Where θ is the policy parameter; t is the time step; x t This indicates the sample prompt word used at time step t; a t This represents the action at time step t, including the corresponding first prediction and recognition result and the first prediction and reasoning chain data; π θ The intermediate anomaly identification model to be updated is used as the new strategy to be updated; π θ (a t |x t ) indicates that in state x t Next, select action a according to the new strategy. t The probability of π θold This refers to the old strategy frozen in the previous iteration; π θold (a t |x t ) indicates that in state x t Next, select action a according to the old strategy. t The probability of r t (θ) represents action a t The probability ratio under the two corresponding strategies; V is the discount factor; V(·) is the value network used to evaluate the long-term expected reward of the input state; clip(·) is the stage function used to limit the fluctuation range of the probability ratio and prevent abrupt changes in model parameters; ε is the pruning coefficient, for example, 0.2, used to limit the update magnitude of the old and new policies; R(t) is the reward R_t at time step t based on the answer dimension. answer Illusion Dimension Reward R hallucination Reward R in logical reasoning dimension logic The aggregated reward signal; ω1, ω2, and ω3 are the corresponding weight coefficients, for example, ω1 is 0.5, ω2 is 0.25, and ω3 is 0.25; E is the expectation operator, representing the expectation of policy π. θ All possible state-action pairs (x) t a t Take the expected value.
[0108] Then, to maximize To achieve the goal, the gradient of the policy network parameter θ is calculated and updated until the iteration converges, thus obtaining the target anomaly recognition model.
[0109] It should be noted that the above process for the PPO algorithm based on the target dimension reward is merely illustrative.
[0110] Therefore, the PPO algorithm can be used to conduct reinforcement learning training on the intermediate anomaly identification model. By integrating multi-dimensional reward signals from answers, illusions, and logical reasoning, a comprehensive reward mechanism can be constructed. The model iteration can be guided simultaneously from three aspects: identification results, content authenticity, and reasoning logic. With the advantages of stable training and controllable update range of the PPO algorithm, the intermediate anomaly identification model can be trained, and the model can achieve performance optimization in multiple dimensions such as answers, illusions, and logical reasoning.
[0111] The training method for the anomaly detection model in this embodiment extracts features from sample traffic log data to obtain sample features; based on the sample features, it constructs sample prompt words corresponding to the sample traffic log data and annotates the sample traffic log data to obtain annotated anomaly detection results; and it performs inference processing based on the sample prompt words and annotated anomaly detection results to obtain annotated inference thought chain data. Therefore, by first extracting features from the traffic logs and constructing suitable sample prompt words, and then performing inference processing based on the sample prompt words and annotated anomaly detection results, it achieves the acquisition of annotated inference thought chain data without relying on manual annotation of the inference thought chain data, effectively reducing manual intervention, lowering the labor and time costs of training sample production, and improving the production efficiency of training samples.
[0112] The above describes the training method for the anomaly detection model. Below, we also propose the model application method, namely the anomaly detection method.
[0113] like Figure 4 As shown, this disclosure also proposes an anomaly identification method. Figure 4 The diagram is based on a third embodiment of this disclosure. The anomaly identification method may include the following steps: Step 401: Obtain target traffic data and determine target prompt words based on the target traffic data.
[0114] The target traffic data may include business or network behaviors, such as access IPs, requested interfaces, request frequency, pagination behavior, link redirects, etc., and this disclosure does not impose any restrictions on this. It should be noted that this disclosure does not impose any restrictions on the amount of target traffic data.
[0115] The target prompt words can be constructed based on target traffic data. For example, target traffic data can be filled into the corresponding positions in the prompt word template to obtain the target prompt words; alternatively, features can be extracted from the target traffic data to obtain corresponding features (such as IP type, number of consecutive requests, number of API accesses, etc.), and these features can be filled into the corresponding positions in the prompt word template to obtain the target prompt words. It should be noted that this disclosure does not limit the extracted features; the features to be extracted can be dynamically set as needed.
[0116] Step 402: Using the target anomaly identification model, based on the target prompt words, anomaly identification is performed on the target traffic data to obtain the target anomaly identification results and target reasoning chain data.
[0117] The target anomaly identification model can be trained using the training method described above.
[0118] The target anomaly identification result can be used to indicate whether the target traffic data is abnormal, and optionally, it can also indicate the type of anomaly in the target traffic data.
[0119] Among them, the target reasoning thought chain data can be used to instruct the target anomaly identification model on the process of anomaly identification or reasoning processing of target traffic data.
[0120] As an example, target prompts can be input into a target anomaly detection model, which can then perform anomaly detection or inference processing on target traffic data. Based on the inference processing of the target anomaly detection model, target thought chain data can be generated, and in response to the output of the target anomaly detection model, the target anomaly detection result can be obtained.
[0121] In one possible implementation of this disclosure, the target anomaly identification results and target reasoning chain data can be displayed; and / or, target traffic data can be intercepted based on the target anomaly identification results. Thus, the anomaly identification results and reasoning chain data can be visually displayed, facilitating relevant personnel to review the analysis logic and conduct case reviews; simultaneously, abnormal traffic can be automatically intercepted based on the identification results, meeting user needs.
[0122] The anomaly identification method of this disclosure acquires target traffic data and determines target prompt words based on the target traffic data; it then employs a target anomaly identification model to identify anomalies in the target traffic data based on the target prompt words, obtaining target anomaly identification results and target reasoning chain data; wherein, the target anomaly identification model is trained using the training method described above. Therefore, by using the trained target anomaly identification model in conjunction with the target prompt words generated from the target traffic data to perform reasoning identification, the method effectively obtains target anomaly identification results and reasoning chain data. This not only improves the accuracy and reliability of the anomaly identification results but also presents the basis for judgment through the reasoning chain data, making the reasoning process clear and explainable, facilitating business verification and strategy optimization.
[0123] To clearly illustrate the training method of the anomaly detection model disclosed herein, a detailed explanation is provided below with examples.
[0124] As an example, the training method of the anomaly detection model disclosed herein is applied to the method for constructing a domain-specific inference large-scale model for traffic anti-fraud. The method for constructing a domain-specific inference large-scale model for traffic anti-fraud adopts a complete technical solution of automated data construction, two-stage fine-tuning, and intelligent alignment evaluation, and is specifically implemented as follows: (1) Construction of automated high-quality thought chain data (referred to as training data in this disclosure) Abandoning the manual annotation method in related technologies, this disclosure proposes an unsupervised data construction framework that automatically produces high-quality thought chain data through two paths: data distillation and self-distillation, for use as training data. 1.1 Data distillation: Using anti-fraud business logs (referred to as sample traffic log data in this disclosure) and historical case samples as input, dynamic feature processing is performed using feature operator services to obtain log features (referred to as sample features in this disclosure). Based on the log features, a Prompt (referred to as sample prompt in this disclosure) – Answer (referred to as annotated anomaly identification result in this disclosure) pair containing log features is constructed. Based on the Prompt-Answer pair, the original training set is constructed. Then, by calling the powerful teacher LLM (referred to as teacher model in this disclosure), thought chain data (Prompt, Reasoning, Answer) containing a complete reasoning chain (referred to as annotated reasoning thought chain data in this disclosure) is generated and used as training data. This path can transform the case logic, rule system, and investigation experience of anti-fraud experts into structured thought chains. The specific reasoning chain can cover the anomaly signal identification stage, evidence correlation analysis stage, contradiction detection stage, and conclusion derivation stage, without the need for manual annotation of each chain, realizing the automated construction of large-scale training data.
[0125] 1.2 Self-distillation: This disclosure proposes a model fine-tuning method based on self-generated thought chains. Specifically, it utilizes a domain-based foundation model infused with SFT (Supervised Fine-Tuning) knowledge, enabling the thought chain function during the inference phase to perform secondary inference on the original training set (Prompt + Answer pairs), automatically constructing an enhanced training dataset rich in inference processes. This process can be viewed as a model-inherent data distillation. Unlike knowledge distillation, which relies on external teacher models, this method leverages the domain knowledge learned by the model itself to drive data augmentation, eliminating the need to call large external models and significantly reducing data construction costs and the debugging threshold of the Prompt project. The overall process can be divided into two steps: Step 1: Domain knowledge injection: Use the original training set (without thought chain) to perform SFT full parameter fine-tuning on the base model (referred to as the target base model in this disclosure) Qwen3-32B to obtain a domain base model injected with domain discriminative knowledge.
[0126] Step 2: Self-generated CoT (Chain-of-Thought) bootstrapping: Using the domain base model obtained in Step 1, perform reasoning with thought patterns on the original training set, and automatically generate enhanced training data with thought chains by utilizing the model's own domain understanding ability.
[0127] Optionally, in some embodiments, the Rubric-A evaluation system can be used to automatically score the constructed training data by calling an LLM (Large Language Model), and the training data can be filtered based on the scoring results (referred to as the second target score in this disclosure). The Rubric-A evaluation system is shown in Table 1. Table 1 Rubric-A Evaluation System
[0128] Optionally, the training data can be scored from the three evaluation dimensions in Table 1 using LLM to obtain accuracy_score, hallucination_score, and context_logic_score. Then, the accuracy_score, hallucination_score, and context_logic_score can be weighted and fused to obtain the scoring results corresponding to the training data.
[0129] (2) Fine-tuning of the two-stage model A two-stage fine-tuning process is performed on an initial anomaly detection model with the same network architecture as the target base model and of unlimited size: SFT (Knowledge Injection) Stage: Employing full-parameter fine-tuning technology, data containing expert precedents, rule systems, and experiential judgments are directly injected into the model parameters. Training data includes historical precedents and expert annotations, rule texts and deductive logic, investigation notes and experience summaries, and automatically generated thought chain data. This enables the model to initially acquire the basic ability to identify anomalies and correlate clues from multi-dimensional evidence.
[0130] The RLHF (Reinforcement Learning from Human Feedback) phase (inference alignment) uses the PPO algorithm to build a reinforcement learning framework and a target Rubric evaluation system designed specifically for traffic anti-fraud scenarios as the source of reward signals to finely align the model's inference logic.
[0131] The target Rubric evaluation system establishes evaluation standards for feature fields based on a five-level anomaly signal strength system: strong negative, weak negative, strong positive, weak positive, and none. For example, capturing IP addresses is a strong negative anomaly signal, page-turning behavior is a weak negative anomaly signal, and deep link sources are weak positive anomalies. The evaluation model CoT's ability to identify and calibrate signal strength levels is assessed, outputting scores for the answer dimension, illusion dimension, and logical reasoning dimension. The reward aggregation formula for the reinforcement training framework is: R_total = 0.5 * R_answer + 0.25 * R_hallucination + 0.25 * R_logic; (5) Where R_answer is the answer dimension score, R_hallucination and R_logic are Rubric's evaluation scores for the illusion dimension and logical reasoning dimension, respectively. The two evaluation dimensions are combined with equal weight to guide the model to improve simultaneously in factual accuracy and reasoning logic. It should be noted that the weight coefficients for the scores of each dimension in the above formula (5) are only illustrative. In practical applications, they can also be other values, and this disclosure does not limit them.
[0132] The logical reasoning dimension score, R_logic, can be determined using the Rubric-B evaluation system, as shown in Table 2. Table 2 Rubric-B Evaluation System
[0133] Optionally, the inference chain generated by the model can be scored from the three evaluation dimensions in Table 2 using LLM to obtain signal_recall_score, strength_calibration_score, and logic_reasoning_score. Then, the signal_recall_score, strength_calibration_score, and logic_reasoning_score are weighted and fused, and the result of the full price fusion is mapped to [0.05, 0.25] to obtain the logic reasoning dimension score R_logic.
[0134] Optionally, the inference chain generated by the model can be scored from the data accuracy assessment dimension in Table 1 using a large model, and the scoring results can be mapped to [0.05, 0.25] to obtain the hallucination dimension score R_hallucination.
[0135] It's important to note that the above method integrates data construction, two-stage training, and LLM-based automated evaluation into an end-to-end automated pipeline. The data construction module automatically extracts cases from business logs, calls the model to generate thought chains, and performs quality assessment and screening using LLM. The training module automatically performs two-stage training using SFT and RLHF, supporting training of models of various scales such as 32B and 7B. The evaluation module automates test set evaluation, outputting multi-dimensional metrics such as accuracy, recall, and thought chain quality. The iterative optimization module automatically adjusts training parameters and reward function weights based on evaluation results, achieving continuous improvement in model performance. This pipeline effectively reduces manual intervention, enabling the model to iterate rapidly based on business feedback, resulting in an order-of-magnitude improvement in R&D efficiency.
[0136] It should also be noted that the method disclosed herein can also be applied to multi-agent collaborative architectures. For example, a three-layer decoupled architecture—business layer, scenario layer, and general capability layer—is adopted, using the LangGraph workflow orchestration framework to achieve multi-agent linkage. The business layer agent is responsible for overall task orchestration and result aggregation, calling the corresponding scenario layer agent based on different scenarios. The scenario layer agent is used for specialized adaptation to different traffic scenarios such as PC (Personal Computer) and WISE (Web Inside, Smart Engine), with each scenario agent independently configurable for inference strategies and threshold parameters. The general capability layer agent provides basic capabilities such as evidence extraction, signal analysis, and logical reasoning for reuse by upper-layer agents. Thus, through multi-agent collaboration, a dynamic workflow is formed, supporting flexible configuration and rapid expansion across various scenarios.
[0137] In summary, this disclosure has at least the following technical advantages: (1) Through the dual paths of data distillation and self-distillation, this disclosure realizes the unsupervised automated production of high-quality thinking chain data, and completely solves the bottleneck problem of training data acquisition in the field of anti-fraud.
[0138] (2) This disclosure does not rely on prompt word engineering and RAG technology. Instead, it directly encodes expert knowledge into the model parameters through full parameter fine-tuning, thereby achieving deeper knowledge internalization.
[0139] (3) This disclosure enables the model to output clear, interpretable expert-level analysis by training with thought chain and aligning with RLHF.
[0140] (4) The Rubric reward mechanism proposed in this disclosure not only improves the quality of model inference, but also ensures the stability of the reinforcement learning training process, effectively solving the technical challenges of difficult reward signal design and unstable training in reinforcement learning training in the field of anti-cheating.
[0141] (5) This disclosure can achieve continuous autonomous evolution of model capabilities through automated data construction and evaluation pipelines.
[0142] The domain-specific inference model construction method for traffic anti-fraud disclosed herein has at least the following advantages: 1. It can output interpretable expert-level analysis, improving the credibility of decision-making. The model not only outputs judgment results, but also generates a clear reasoning chain. Through the clear reasoning chain, it can clearly point out strong and weak abnormal evidence points, show how to link multi-dimensional clues for comprehensive judgment, improve the interpretability and credibility of the model's decision, and provide a direct basis for strategy optimization and case review. Compared with black box models, it is easier to gain the trust and adoption of relevant staff.
[0143] 2. Reduce labor costs and improve development efficiency It provides a fully automated training pipeline, eliminating the reliance on manual annotation; through the automated data construction, training, and evaluation process, it achieves an order-of-magnitude improvement in R&D efficiency, and also supports rapid iteration of models based on business feedback, enhancing the ability to quickly advance and continuously optimize related projects.
[0144] To implement the above embodiments, this disclosure also provides a training apparatus for an anomaly recognition model. For example... Figure 5 As shown, Figure 5 This is a schematic diagram according to the fifth embodiment of the present disclosure. The training device 500 for the anomaly recognition model may include: an acquisition module 510, a first training module 520, and a second training module 530.
[0145] The acquisition module 510 is used to acquire training samples; wherein, the training samples include sample traffic log data, sample prompt words corresponding to the sample traffic log data, anomaly identification results and annotated reasoning chain data.
[0146] The first training module 520 is used to perform supervised fine-tuning training of the initial anomaly recognition model based on training samples to obtain an intermediate anomaly recognition model.
[0147] The second training module 530 is used to perform reinforcement learning training on the intermediate anomaly recognition model based on training samples to obtain the target anomaly recognition model. The target dimension reward includes at least one of the answer dimension reward, illusion dimension reward and logical reasoning dimension reward. The answer dimension reward is determined based on the first prediction recognition result. The logical reasoning dimension reward is determined based on the recognition accuracy of the abnormal signals in the sample traffic log data by the first prediction reasoning thought chain data. The first prediction recognition result and the first prediction reasoning thought chain data are generated when the intermediate anomaly recognition model performs reasoning based on sample prompt words.
[0148] In one possible implementation of this disclosure, the training device 500 for the anomaly recognition model may further include: The first analysis module is used to analyze the data of the first predictive inference thinking chain to obtain the index values of the first sub-dimension. The first sub-dimension includes at least one of the signal recall sub-dimension, the intensity calibration sub-dimension, and the logic sub-dimension. The index value of the signal recall sub-dimension is used to characterize the completeness of the first predictive inference thinking chain data in identifying key abnormal signals in the sample traffic log data. The index value of the intensity calibration sub-dimension is used to characterize the accuracy of the first predictive inference thinking chain data in determining the strength level of abnormal signals in the sample traffic log data. The index value of the logic sub-dimension is used to characterize the logical consistency of the first predictive inference thinking chain data with the preset inference rules.
[0149] The first processing module is used to aggregate the index values of at least one first sub-dimension to obtain the first target score.
[0150] The first determination module is used to determine the recognition accuracy based on the first target score.
[0151] In one possible implementation of this disclosure, the first determining module is configured to: map the first target score to the first target value space to obtain the recognition accuracy.
[0152] In one possible implementation of this disclosure, the acquisition module 510 is used to: extract features from the sample traffic log data to obtain sample features; construct sample prompt words corresponding to the sample traffic log data based on the sample features, and annotate the sample traffic log data to obtain annotated anomaly identification results; and perform reasoning processing based on the sample prompt words and the anomaly identification results to obtain annotated reasoning thought chain data.
[0153] In one possible implementation of this embodiment, the acquisition module 510 is used to: employ a teacher model, based on sample prompt words and anomaly identification results, and perform reasoning processing in the following order: anomaly signal identification stage, evidence association analysis stage, contradiction detection stage, and conclusion derivation stage, to obtain annotated reasoning thought chain data; wherein, the anomaly signal identification stage is used to identify anomaly signals in sample traffic log data, obtain sample anomaly signals, and determine the anomaly signal strength level of the sample anomaly signals according to preset signal strength grading rules; the evidence association analysis stage is used to perform evidence association analysis on sample anomaly signals with anomaly signal strength levels to generate evidence association relationships; the contradiction detection stage is used to perform conflict detection on the evidence association relationships to obtain conflict detection results; and the conclusion derivation stage is used to generate anomaly identification results based on the conflict detection results.
[0154] In one possible implementation of this disclosure, the acquisition module 510 is used to: perform supervised fine-tuning training on the target base model using sample prompt words and anomaly identification results to obtain a domain base model; and use the domain base model to perform inference processing based on sample prompt words and anomaly identification results to obtain annotated inference thought chain data.
[0155] In one possible implementation of this disclosure, the first training module 520 is configured to: input sample prompt words into an initial anomaly recognition model to obtain a second predicted anomaly recognition result and a second predicted inference thought chain data; and train the initial anomaly recognition model based on the difference between the second predicted recognition result and the labeled anomaly recognition result, and the difference between the second predicted inference thought chain data and the labeled inference thought chain data, to obtain an intermediate anomaly recognition model.
[0156] In one possible implementation of this disclosure, the first training module 520 is configured to: determine a first sub-loss value based on the difference between the second predicted identification result and the labeled anomaly identification result; determine a second sub-loss value based on the difference between the second predicted inference thought chain data and the labeled inference thought chain data; fuse the first sub-loss value and the second sub-loss value to obtain a target loss value; and adjust the parameters of the initial anomaly identification model based on the target loss value to obtain an intermediate anomaly identification model.
[0157] In one possible implementation of this embodiment, the first training module 520 is configured to: determine the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value based on the first number of lexical units in the second prediction recognition result and the second number of lexical units in the second prediction inference thought chain data; and perform a weighted summation of the first sub-loss value and the second sub-loss value based on the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value to obtain the target loss value.
[0158] In one possible implementation of this disclosure, the training device 500 for the anomaly recognition model may further include: The second analysis module is used to analyze the labeled reasoning thought chain data to obtain the index values of the second sub-dimension. The second sub-dimension includes at least one of the following: data accuracy sub-dimension, hallucination suppression sub-dimension, and contextual logic sub-dimension. The index value of the data accuracy sub-dimension is determined based on the accuracy of the feature information introduced into the labeled reasoning thought chain data. The index value of the hallucination suppression sub-dimension is determined based on whether the labeled reasoning thought chain data contains information that is not present in the sample prompt words. The index value of the contextual logic sub-dimension is determined based on the degree of fit between the refinement of the reasoning generalization of the labeled reasoning thought chain data and the strength level of the abnormal signals in the sample traffic log data.
[0159] The second processing module is used to aggregate the index values of at least one second sub-dimension to obtain the second target score.
[0160] The filtering module is used to filter the labeled reasoning thought chain data based on the second objective score.
[0161] In one possible implementation of this disclosure, the illusion dimension reward is determined based on the accuracy of the reference of the first predictive reasoning thought chain data to the input feature data, the situation of content distinguishing reasonable generalization from factual errors, and whether the numerical estimation leads to a reversal of the logical direction.
[0162] In one possible implementation of this disclosure, the second training module 530 is used to: perform reinforcement learning training on the intermediate anomaly recognition model based on training samples and using a proximal strategy to optimize the PPO algorithm, thereby obtaining the target anomaly recognition model; wherein the reward signal for reinforcement learning training is obtained by aggregating the answer dimension reward, the illusion dimension reward, and the logical reasoning dimension reward.
[0163] The training apparatus for the anomaly recognition model in this embodiment acquires training samples, which include sample traffic log data, sample prompt words corresponding to the sample traffic log data, labeled anomaly recognition results, and labeled reasoning chain data. Based on the training samples, an initial anomaly recognition model is subjected to supervised fine-tuning training to obtain an intermediate anomaly recognition model. Based on the training samples, the intermediate anomaly recognition model is subjected to reinforcement learning training with a target dimension reward to obtain a target anomaly recognition model. The target dimension reward includes at least one of an answer dimension reward, an illusion dimension reward, and a logical reasoning dimension reward. The answer dimension reward is determined by the first prediction recognition result, and the logical reasoning dimension reward is determined based on the accuracy of anomaly signal recognition in the sample traffic log data using the first prediction reasoning chain data. The first prediction recognition result and the first prediction reasoning chain data are generated when the intermediate anomaly recognition model performs reasoning based on the sample prompt words. Therefore, by using training samples containing labeled reasoning thought chain data, the initial anomaly detection model can be trained through a reinforcement learning framework that integrates supervised fine-tuning and target-dimensional reward-driven learning. Answer-dimensional rewards can be used to improve the accuracy of anomaly detection results, illusion-dimensional rewards can be used to suppress false outputs, and logical reasoning-dimensional rewards can be used to improve the accuracy of anomaly signal recognition. By specifically optimizing model performance using answer-dimensional, illusion-dimensional, and logical reasoning-dimensional rewards, the accuracy of anomaly detection, anti-illusion capabilities, and comprehensive reasoning capabilities in complex scenarios can be effectively improved. On the one hand, this approach avoids the limitations of simply relying on prompt word engineering, RAG, and general base model capabilities, allowing for targeted refinement of the model's domain-specific reasoning capabilities in traffic anomaly detection. On the other hand, it avoids excessive reliance on structured external knowledge bases, thus mitigating the problems of difficult knowledge base construction, high maintenance costs, and insufficient coverage. Furthermore, the model outputs complete reasoning thought chain data, providing relevant users with clear analytical logic and making the anomaly detection results interpretable.
[0164] To implement the above embodiments, this disclosure also provides an anomaly detection device. For example... Figure 6 As shown, Figure 6 This is a schematic diagram according to the sixth embodiment of the present disclosure. The anomaly identification device 600 may include: a first processing module 610 and an identification module 620.
[0165] The first processing module 610 is used to acquire target traffic data and determine target prompt words based on the target traffic data.
[0166] The identification module 620 is used to identify anomalies in target traffic data based on target prompt words using a target anomaly identification model, and to obtain target anomaly identification results and target reasoning chain data; wherein, the target anomaly identification model is trained using the training method of the anomaly identification model described above.
[0167] In one possible implementation of this disclosure, the anomaly detection device 600 may include: The second processing module is used to display the target anomaly identification results and target reasoning chain data; and / or, based on the target anomaly identification results, to intercept target traffic data.
[0168] The anomaly detection device of this embodiment acquires target traffic data and determines target prompt words based on the target traffic data; it then employs a target anomaly detection model to perform anomaly detection on the target traffic data based on the target prompt words, obtaining target anomaly detection results and target reasoning chain data; wherein, the target anomaly detection model is trained using the training method described above. Therefore, by using the trained target anomaly detection model combined with target prompt words generated from target traffic data to perform reasoning detection, the device effectively obtains target anomaly detection results and reasoning chain data. This not only improves the accuracy and reliability of the anomaly detection results but also presents the basis for judgment through the reasoning chain data, making the reasoning process clear and explainable, facilitating business verification and strategy optimization.
[0169] The collection, storage, use, processing, transmission, provision, and disclosure of users' personal information are all conducted with the consent of the users and comply with relevant laws and regulations, and do not violate public order and good morals.
[0170] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0171] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0172] like Figure 7As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded into random access memory (RAM) 703 from storage unit 708. The RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0173] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0174] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as anomaly detection model training methods or anomaly detection methods. For example, in some embodiments, the anomaly detection model training methods or anomaly detection methods can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the anomaly detection model training methods or anomaly detection methods described above can be performed. Alternatively, in other embodiments, the computing unit 701 may be configured by any other suitable means (e.g., by means of firmware) to perform a training method or an anomaly recognition method for an anomaly recognition model.
[0175] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0176] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0177] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0178] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0179] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0180] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0181] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0182] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A training method for an anomaly detection model, the method comprising: Obtain training samples; wherein, the training samples include sample traffic log data, sample prompt words corresponding to the sample traffic log data, anomaly identification results, and annotated reasoning chain data; The initial anomaly detection model is trained under supervised supervision based on the training samples to obtain an intermediate anomaly detection model. The intermediate anomaly identification model is trained using reinforcement learning with target dimension rewards based on the training samples to obtain a target anomaly identification model. The target dimension rewards include at least one of answer dimension rewards, illusion dimension rewards, and logical reasoning dimension rewards. The answer dimension rewards are determined based on the first prediction recognition result, and the logical reasoning dimension rewards are determined based on the accuracy of the identification of abnormal signals in the sample traffic log data using the first prediction reasoning thought chain data. The first prediction recognition result and the first prediction reasoning thought chain data are generated when the intermediate anomaly identification model performs reasoning based on the sample prompt words.
2. The method according to claim 1, wherein, The method for determining the recognition accuracy includes the following steps: The first predictive inference thought chain data is analyzed to obtain the index value of the first sub-dimension; wherein, the first sub-dimension includes at least one of the signal recall sub-dimension, the intensity calibration sub-dimension, and the logic sub-dimension, the index value of the signal recall sub-dimension is used to characterize the completeness of the first predictive inference thought chain data in identifying key abnormal signals in the sample traffic log data, the index value of the intensity calibration sub-dimension is used to characterize the accuracy of the first predictive inference thought chain data in determining the strength level of abnormal signals in the sample traffic log data, and the index value of the logic sub-dimension is used to characterize the logical consistency of the first predictive inference thought chain data with the preset inference rules. Aggregate the index values of at least one of the first sub-dimensions to obtain the first target score; The recognition accuracy is determined based on the first target score.
3. The method according to claim 2, wherein, Determining the recognition accuracy based on the first target score includes: The first target score is mapped to the first target value space to obtain the recognition accuracy.
4. The method according to claim 1, wherein, The acquisition of training samples includes: Feature extraction is performed on the sample traffic log data to obtain sample features; Based on the sample features, sample prompt words corresponding to the sample traffic log data are constructed, and the sample traffic log data is labeled to obtain the labeled anomaly identification results; Based on the sample prompts and the anomaly identification results, reasoning processing is performed to obtain the annotated reasoning thought chain data.
5. The method according to claim 4, wherein, The reasoning process based on the sample prompts and the anomaly identification results yields the annotated reasoning thought chain data, including: Using the teacher model, based on the sample prompt words and the anomaly identification results, reasoning is performed in the following order: anomaly signal identification stage, evidence association analysis stage, contradiction point detection stage, and conclusion deduction stage, to obtain the annotated reasoning thought chain data. The abnormal signal identification stage is used to identify abnormal signals in the sample traffic log data, obtain sample abnormal signals, and determine the abnormal signal strength level of the sample abnormal signals according to the preset signal strength grading rules. The evidence association analysis stage is used to perform evidence association analysis on sample abnormal signals with the aforementioned abnormal signal strength levels, and generate evidence association relationships. The contradiction detection stage is used to perform conflict detection on the evidence association relationship to obtain conflict detection results; The conclusion derivation stage is used to generate the labeled anomaly identification result based on the conflict detection result.
6. The method according to claim 5, wherein, The reasoning process based on the sample prompts and the anomaly identification results yields the annotated reasoning thought chain data, including: Using the sample prompts and the anomaly identification results, the target base model is subjected to supervised fine-tuning training to obtain the domain base model; Using the aforementioned domain-based model, reasoning is performed based on the sample prompts and the anomaly identification results to obtain the annotated reasoning thought chain data.
7. The method according to claim 1, wherein, The step of supervising and fine-tuning the initial anomaly detection model based on the training samples to obtain an intermediate anomaly detection model includes: The sample prompt words are input into the initial anomaly recognition model to obtain the second predicted anomaly recognition result and the second predicted reasoning thought chain data. Based on the difference between the second predicted identification result and the labeled anomaly identification result, and the difference between the second predicted reasoning chain data and the labeled reasoning chain data, the initial anomaly identification model is trained to obtain the intermediate anomaly identification model.
8. The method according to claim 7, wherein, The step of training the initial anomaly identification model based on the difference between the second predicted identification result and the labeled anomaly identification result, and the difference between the second predicted inference thought chain data and the labeled inference thought chain data, to obtain the intermediate anomaly identification model, includes: The first sub-loss value is determined based on the difference between the second predicted identification result and the labeled anomaly identification result; The second sub-loss value is determined based on the difference between the second predictive inference thought chain data and the labeled inference thought chain data; The first sub-loss value and the second sub-loss value are fused to obtain the target loss value; Based on the target loss value, the parameters of the initial anomaly identification model are adjusted to obtain the intermediate anomaly identification model.
9. The method according to claim 8, wherein, The process of fusing the first sub-loss value and the second sub-loss value to obtain the target loss value includes: Based on the first number of word elements in the second prediction recognition result and the second number of word elements in the second prediction reasoning chain data, determine the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value. Based on the first weight corresponding to the first sub-loss value and the second weight corresponding to the second sub-loss value, the first sub-loss value and the second sub-loss value are weighted and summed to obtain the target loss value.
10. The method according to any one of claims 1-9, wherein, The method further includes: The labeled reasoning thought chain data is analyzed to obtain the index value of the second sub-dimension; wherein, the second sub-dimension includes at least one of the data accuracy sub-dimension, the hallucination suppression sub-dimension, and the contextual logic sub-dimension. The index value of the data accuracy sub-dimension is determined based on the accuracy of the feature information introduced in the labeled reasoning thought chain data. The index value of the hallucination suppression sub-dimension is determined based on whether the labeled reasoning thought chain data contains information that is not present in the sample prompt words. The index value of the contextual logic sub-dimension is determined based on the degree of fit between the refinement of the reasoning generalization of the labeled reasoning thought chain data and the strength level of the abnormal signals in the sample traffic log data. The index values of at least one of the second sub-dimensions are aggregated to obtain the second target score; The labeled reasoning thought chain data is filtered based on the second target score.
11. The method according to any one of claims 1-9, wherein, The reward for the illusion dimension is determined based on the accuracy of the reference to the input feature data by the first predictive reasoning thought chain data, the situation of reasonable generalization and factual errors in content differentiation, and whether the numerical estimation leads to a reversal of the logical direction.
12. The method according to any one of claims 1-9, wherein, The step of training the intermediate anomaly recognition model using reinforcement learning based on the training samples to obtain the target anomaly recognition model includes: Based on the training samples, the PPO algorithm is optimized using a near-end strategy to perform reinforcement learning training on the intermediate anomaly recognition model, thereby obtaining the target anomaly recognition model; wherein, the reward signal of the reinforcement learning training is obtained by aggregating the answer dimension reward, the illusion dimension reward, and the logical reasoning dimension reward.
13. An anomaly identification method, the method comprising: Acquire target traffic data, and determine target prompt words based on the target traffic data; An anomaly detection model is used to identify anomalies in the target traffic data based on the target prompt words, thereby obtaining target anomaly detection results and target reasoning chain data; wherein, the target anomaly detection model is trained using the method described in claims 1-12.
14. The method according to claim 13, wherein, The method further includes: The results of the target anomaly identification and the target reasoning chain data are displayed. And / or, Based on the target anomaly identification results, the target traffic data is intercepted.
15. A training apparatus for an anomaly detection model, the apparatus comprising: The acquisition module is used to acquire training samples; wherein, the training samples include sample traffic log data, as well as sample prompt words, labeled anomaly identification results and labeled reasoning chain data corresponding to the sample traffic log data; The first training module is used to perform supervised fine-tuning training on the initial anomaly recognition model based on the training samples to obtain an intermediate anomaly recognition model. The second training module is used to perform reinforcement learning training on the intermediate anomaly recognition model based on the training samples to obtain a target anomaly recognition model; wherein, the target dimension reward includes at least one of answer dimension reward, illusion dimension reward and reasoning logic dimension reward, the answer dimension reward is determined by the first prediction recognition result, the reasoning logic dimension reward is determined based on the recognition accuracy of the abnormal signals in the sample traffic log data based on the first prediction reasoning thought chain data, and the first prediction recognition result and the first prediction reasoning thought chain data are generated when the intermediate anomaly recognition model performs reasoning based on the sample prompt words.
16. An anomaly detection device, the device comprising: The first processing module is used to acquire target traffic data and determine target prompt words based on the target traffic data; The identification module is used to identify anomalies in the target traffic data based on the target prompt words using a target anomaly identification model, and to obtain target anomaly identification results and target reasoning chain data; wherein, the target anomaly identification model is trained using the method described in claims 1-12.
17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 12, or the method of any one of claims 13 to 14.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 12, or the method according to any one of claims 13 to 14.
19. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 12, or the method according to any one of claims 13 to 14.
