A large model-based traffic query method, device and electronic equipment

By splitting the large model and the NL2SQL large model in the intelligent transportation system to handle user query problems, the accuracy problem caused by fuzzy queries is solved, accurate data analysis and result output are achieved, and the accuracy and reliability of query results are improved.

CN120892440BActive Publication Date: 2026-01-09QINGDAO HISENSE TRANS TECH +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511442861.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-01-09
Estimated Expiration
2045-10-10

AI Technical Summary

Technical Problem

In intelligent transportation systems, user-initiated queries are often ambiguous, leading to low accuracy of query results, difficulty in accurately understanding user intent, and the return of generalized or redundant data results.

Method used

By receiving query questions, obtaining keywords and determining query vectors, matching target vectors with high similarity using a pre-saved vector library, inputting the query question into a large splitting model to break it down into multiple sub-questions, generating SQL statements for querying using the NL2SQL large model, and combining anomaly detection algorithms and predefined tools for data analysis, the accuracy and reliability of query results are ensured.

Benefits of technology

It improves the semantic accuracy and reliability of query results, ensures that query results are highly consistent with user intent, avoids syntax errors and logical deviations that may occur when manually writing SQL, and enhances the flexibility and accuracy of data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120892440B_ABST
    Figure CN120892440B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a traffic query method and device based on a large model and electronic equipment, to solve the problem of inaccurate query in the related art. In the embodiment of the application, the electronic equipment first acquires a plurality of target vectors with high matching degree with the keywords in the query question after receiving the query question. Then, the electronic equipment inputs the query question and the word group corresponding to the target vector into a splitting large model, and the splitting large model splits the query question into a plurality of sub-questions. Each sub-question contains more detailed information, ensuring the accuracy of the question expression. The electronic equipment respectively performs targeted query according to the split sub-questions, and acquires accurate query results corresponding to each sub-question. This effectively improves the semantic accuracy of the sub-questions, and further improves the accuracy and reliability of the final query result. In addition, the embodiment of the application also identifies abnormal data and performs root cause analysis based on a causal knowledge base.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a traffic query method and device based on a large model and electronic equipment. BACKGROUND

[0002] In the data service scene of an intelligent transportation system (ITS), a query question initiated by a user side often has a relatively fuzzy problem. For example, a request such as "analyze the accident details of Qingdao in 2025". Such a fuzzy problem leads to difficulty in accurately understanding the user's intention, and then returns a data result that is generalized, redundant or even deviates from the actual demand, so that the accuracy of the query result is low. SUMMARY

[0003] The traffic query method and device based on a large model and electronic equipment provided in the embodiments of the present application are used to solve the problem of inaccurate query in the related art.

[0004] The embodiments of the present application provide a traffic query method based on a large model, which comprises:

[0005] receiving a query question; obtaining a query keyword in the query question; determining a query vector corresponding to the query question according to the type of each obtained query keyword and the component position of the keyword of the corresponding type in the vector;

[0006] determining a preset number of target vectors with high similarity according to the similarity of each vector in a pre-saved vector library and the query vector; for each target vector, obtaining a word group saved for the target vector, wherein the word group contains at least one keyword;

[0007] inputting each obtained word group and the query question into a split large model to obtain each sub-question output by the split large model after splitting; performing a query according to each sub-question to obtain a corresponding query result.

[0008] The above technical solution has the following advantages or beneficial effects: in the embodiments of the present application, after the electronic equipment receives a query question, it first obtains a plurality of target vectors with high matching degree with the keywords in the query question. Then, the query question and the word group corresponding to the target vector are input into a split large model, and the split large model splits the query question into a plurality of sub-questions. Each sub-question contains more detailed information, ensuring the accuracy of the problem statement. The electronic equipment performs a targeted query according to the split sub-questions to obtain accurate query results corresponding to each sub-question. This effectively improves the semantic accuracy of the sub-questions, and further improves the accuracy and reliability of the final query result.

[0009] The embodiment of the present application also provides a query device, the device comprises:

[0010] The receiving acquisition module is used for receiving a query question; acquiring a query keyword in the query question; determining a query vector corresponding to the query question according to the type of each acquired query keyword and the component position of the keyword of the corresponding type in the vector;

[0011] The determining module is used for determining a target vector with a high similarity in a pre-stored vector library according to the similarity between each vector in the vector library and the query vector; and acquiring a word group saved for each target vector, wherein the word group contains at least one keyword.

[0012] The processing module is used for inputting each acquired word group and the query question into a split large model, acquiring each sub-question output by the split large model after splitting; and performing a query according to each sub-question to acquire a corresponding query result.

[0013] The present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;

[0014] The memory is used for storing a computer program;

[0015] The processor is used for executing the program stored on the memory to realize the method. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0017] Figure 1 A process schematic diagram of a traffic query method based on a large model provided by the embodiment of the present application;

[0018] Figure 2 A schematic diagram of a keyword corresponding word group provided by the embodiment of the present application;

[0019] Figure 3 A detailed process schematic diagram of abnormality identification provided by the embodiment of the present application;

[0020] Figure 4 A training process schematic diagram of a second target large model provided by the embodiment of the present application;

[0021] Figure 5 A detailed process diagram of a query provided for an embodiment of the present application is shown in FIG. 5;

[0022] Figure 6 A detailed process diagram provided for an embodiment of the present application is shown in FIG. 6;

[0023] Figure 7 A structure diagram of a query device provided for an embodiment of the present application is shown in FIG. 7;

[0024] Figure 8 An electronic device structure diagram provided for an embodiment of the present application is shown in FIG. 8. DETAILED DESCRIPTION

[0025] In order to make the purpose and implementation of the present application more clear, the following will combine the drawings in the exemplary embodiments of the present application to clearly and completely describe the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only some of the embodiments of the present application, but not all of the embodiments of the present application.

[0026] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the following described embodiments, and is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their ordinary and general meanings.

[0027] The terms "first", "second", "third", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit the specific order or sequence, unless otherwise specified. It should be understood that the terms used in this way can be interchanged under appropriate circumstances.

[0028] The terms "include" and "have" and any variations thereof are intended to cover but not exclusive inclusion, for example, a product or device including a series of components does not necessarily limit to all components clearly listed, but can include other components not clearly listed or inherent to these products or devices.

[0029] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware or / and software code capable of performing functions associated with the element.

[0030] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

[0031] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to exhaust or limit the embodiments to the specific forms disclosed above. Various modifications and variations can be derived according to the above teachings. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different modified embodiments suitable for specific use considerations.

[0032] In order to improve the query accuracy, the embodiment of the present application provides a traffic query method based on a large model, a device and an electronic equipment.

[0033] The traffic query method based on a large model comprises: an electronic equipment receives a query question; acquires query keywords in the query question; determines a query vector corresponding to the query question according to the type of each query keyword acquired and the component position of the keyword of the corresponding type in the vector; determines a target vector with a high similarity in a pre-saved vector library according to the similarity of each vector in the vector library and the query vector; for each target vector, acquires a word group saved for the target vector, wherein the word group contains at least one keyword; inputs each word group acquired and the query question into a split large model to acquire each sub-question output by the split large model after splitting; queries according to each sub-question to acquire a corresponding query result.

[0034] Figure 1 A process schematic diagram of a traffic query method based on a large model provided by the embodiment of the present application, the process comprises the following steps:

[0035] S101: receiving a query question; acquiring query keywords in the query question; determining a query vector corresponding to the query question according to the type of each query keyword acquired and the component position of the keyword of the corresponding type in the vector.

[0036] The traffic query method based on a large model provided by the embodiment of the present application is applied to an electronic equipment, which can be a PC or a server or other intelligent equipment.

[0037] To improve the accuracy of the query, the electronic device can first receive a raw query question input by the user. In an example, the user can input a query question that the user wants to query through a device used by the user or a preset device, and click a preset button, for example, a "query" button, at which time the electronic device can receive a query instruction.

[0038] Since there can be some auxiliary words in the query instruction that are irrelevant to the query, such as mood words such as "please ask" and "hello", or prepositions such as "about" and "for", and these auxiliary words are irrelevant to the query, based on this, after receiving the query instruction, the electronic device can obtain the query keywords in the query question. In an example, the electronic device can perform syntactic analysis on the query question to extract main words, time expressions, location entities, vehicle type words, etc., to form a set of multiple keywords; in another example, the electronic device can extract query keywords through natural language processing technology; wherein the natural language processing technology can be a Bidirectional Encoder Representations from Transformers (BERT) model. That is, input the query question into the pre-trained BERT model, and the BERT model can output each query keyword in the query question.

[0039] The electronic device performs multi-dimensional semantic type recognition on each query keyword, and determines its component position in the vector space based on a predefined mapping rule of type and component position; and finally determines the corresponding query vector. The query vector as a high-dimensional semantic representation can be used for cosine similarity calculation with vectors in the document library to achieve accurate retrieval or intelligent recommendation.

[0040] In an example, different keywords have different dimensions, for example, the dimensions of "2025" and "first quarter" are different, and the electronic device can also generate corresponding query vectors according to the components corresponding to different dimensions.

[0041] S102: According to the similarity between each vector in the pre-saved vector library and the query vector, determine a pre-set number of target vectors with high similarity; for each target vector, obtain a word group saved for the target vector, wherein the word group contains at least one keyword.

[0042] In order to improve the accuracy of the query, the electronic device can obtain a pre-stored vector library, which can be stored locally on the electronic device or in other devices. The electronic device can determine the similarity of each vector in the vector library to the query vector, and optionally, the cosine similarity of each vector to the query vector can be determined as the corresponding similarity. For each determined similarity, the corresponding vector is sorted in descending order of similarity, and the top pre-set number of target vectors in the sorting result are obtained. The pre-set number of target vectors are vectors with higher similarity to the query vector. The word groups corresponding to the pre-set number of target vectors can be the content that the query question wants to query. Based on this, the electronic device can obtain the word groups stored for the target vectors. Among them, the word groups contain at least one keyword.

[0043] Optionally, the electronic device can also perform Approximate Nearest Neighbor (ANN) search in the vector library and return the target vector with a confidence Top-k. The word groups corresponding to the target vector include keywords of different dimensions.

[0044] S103: input each word group and the query question obtained into a split large model to obtain each sub-question output by the split large model; query according to each sub-question to obtain the corresponding query result.

[0045] In order to improve the accuracy of the query, the electronic device can drill down and decompose the general query question into multiple sub-questions and query related data to provide basic data support for subsequent analysis.

[0046] After obtaining each word group corresponding to each target vector, the electronic device can input each word group and the query question into a split large model and obtain the output of the split large model, which is each sub-question after splitting. After obtaining each sub-question, the query can be performed according to each sub-question to obtain the corresponding query result.

[0047] The embodiments of the present application are based on Figure 2 The word groups corresponding to the keywords shown in the vector library are constructed, Figure 2 In the accident scene, a total of 598 values of 37 dimensions of four categories of space, time, vehicle and accident characteristics are realized, and the deepest dimension has four levels of drilling values.

[0048] In the embodiments of the present application, when constructing the vector library, a two-level strategy of "large model coarse annotation + manual fine calibration" can be adopted. A large model with a large number of parameters is used to generate 2-3 natural language descriptions for each dimension value, including colloquial synonyms, phrase variants, and dialect expressions. Then, a traffic domain expert reviews the model output, deletes ambiguous descriptions, and supplements high-frequency colloquialisms, such as aligning the keywords "red light running" and "violating traffic signals", to ensure accurate alignment of professional terms and daily language. Each natural language description is represented by a 768-dimensional sentence bidirectional encoder using Siamese BERT-Networks (SBERT) encoding, and is stored in the Milvus vector library along with the dimension-value information, supporting efficient similarity retrieval.

[0049] In an example, if multiple keywords in a phrase have a first value of "accident cause" and a second value of "violation of traffic signals", the corresponding natural language description is "running a red light, not passing according to traffic signals", and the corresponding vector is [0.12, 0.45,...].

[0050] To improve the accuracy of splitting large models, a prompt word (Prompt) for splitting large models is also pre-constructed. The Prompt is used to prompt the splitting large model to independently decide to deconstruct into several independently executable sub-problems according to the three core rules of "dimension integrity, hierarchical consistency, and business queryability". In an example, the Prompt can be represented as follows: ([System role] you are a traffic accident dimension alignment and problem deconstruction engine. Please generate independently executable sub-problems according to the recalled dimensions L and the original question Q; [Recalled dimension values] L={d_1,d_2,...,d_k}; [User original question] Q; [Decomposition rules] R1: p_i, d_j∈L, s.t. d_j∈p_i; R2: Prioritize spatial + temporal integrity; R3: Default output quantity + sorting / compared; R4: Format: sub-problem{number}:...).

[0051] In an example, the input of the splitting large model can be: [System role] You are a traffic accident dimension alignment and problem deconstruction engine. Please strictly follow the recall dimension value and business rules to split the user's original question into sub-questions that can be independently queried. [Knowledge background] Dimension hierarchy example: accident characteristics → accident cause → motor vehicle violation → violation of traffic signals; Queryable dimensions: accident time, administrative division, vehicle type, accident type, illegal behavior, property loss amount, etc. [Recall dimension value] {L = ANN(Q, K)} [Splitting rule] R1 Each sub-question must contain at least one recall dimension value; R2 Prefer to ensure the integrity of the "space + time" dimension; R3 If the user does not specify the statistical caliber, output "quantity" by default with sorting or same ring ratio; R4 Output format: start with "sub-question {serial number}:" in each line, and prohibit adding explanations. [User original question] {Q}. [Example] User question: Analyze the accident details in Qingdao in 2025. Recall dimension values: time-year-2025; space-administrative division-Qingdao city. Sub-question 1: Query the number of accidents in each district of Qingdao city in 2025 and rank them in descending order of quantity. Sub-question 2: Calculate the same period change rate of the total number of accidents in Qingdao city in 2025 relative to 2024. Sub-question 3: Group by accident type, and count the number of different accident types in Qingdao city in 2025. Sub-question 4: According to the type of illegal behavior, count the number of traffic accidents causing property damage in Qingdao city in 2025.

[0052] In the embodiments of the present application, after receiving the query question, the electronic device first obtains a plurality of target vectors with high matching degrees with the keywords in the query question. Then, the query question and the word groups corresponding to the target vectors are input into the splitting large model, and the query question is split into a plurality of sub-questions by the splitting large model. Each sub-question contains more detailed information, ensuring the accuracy of the question expression. The electronic device performs targeted queries according to the split sub-questions to obtain accurate query results corresponding to each sub-question. This effectively improves the semantic accuracy of the sub-questions, and further improves the accuracy and reliability of the final query results.

[0053] To improve the accuracy of the query, on the basis of the above-mentioned embodiments, in the embodiments of the present application, the querying according to the each sub-question to obtain a corresponding query result comprises:

[0054] determining a structured query language (SQL) statement corresponding to the each sub-question through a natural language to structured query language (NL2SQL) large model;

[0055] According to the obtained each SQL statement, the database is queried to obtain the corresponding query result.

[0056] In order to improve the accuracy of the query, the electronic device can first convert the natural language into a query language, that is, obtain the SQL statement corresponding to each sub-question, and then query based on the obtained SQL statement.

[0057] In an example, the electronic device inputs each sub-question into the NL2SQL large model, and the NL2SQL large model generates the SQL statement. The electronic device obtains the output of the NL2SQL large model, and the output of the NL2SQL large model is the SQL statement corresponding to each sub-question. Optionally, each sub-question can be input into the NL2SQL large model respectively, and the SQL statement corresponding to each sub-question output by the NL2SQL large model can be obtained respectively. Alternatively, multiple sub-questions can be input into the NL2SQL large model together, and the SQL statement corresponding to the multiple sub-questions output by the NL2SQL large model can be obtained.

[0058] After obtaining each SQL statement, the electronic device can query the database according to the obtained each SQL statement to obtain the corresponding query result.

[0059] The above technical solution has the following advantages or beneficial effects: the semantic understanding ability of the NL2SQL large model for the sub-questions can be accurately mapped to the SQL structure, avoiding syntax errors or logical deviations that may occur when manually writing SQL, and ensuring that the query result is highly consistent with the user's intention.

[0060] In order to improve the accuracy of the query, on the basis of the above embodiments, in the embodiments of the present application, the NL2SQL large model is trained in the following manner:

[0061] A first sample question and a sample SQL statement saved for the first sample question are obtained.

[0062] The first sample question is input into the NL2SQL large model to obtain an output SQL statement output by the NL2SQL large model.

[0063] According to the deviation of the sample SQL statement and the output SQL statement, a corresponding target loss value is determined, and the parameters of the NL2SQL large model are fine-tuned according to the target loss value.

[0064] In order to improve the accuracy of the query, the initial NL2SQL large model can be fine-tuned using experience sample data to construct an NL2SQL large model suitable for a characteristic vertical domain.

[0065] In an example, the electronic device can obtain a first sample question and obtain a sample SQL statement saved for the first sample question. The electronic device inputs the first sample question into an NL2SQL large model, processes the first sample question by the NL2SQL large model, and obtains an SQL statement output by the NL2SQL large model. For the convenience of distinction, the SQL statement can be referred to as an output SQL statement.

[0066] The electronic device can determine a corresponding target loss value according to the deviation between the sample SQL statement and the output SQL statement. The electronic device can fine-tune the parameters of the NL2SQL large model according to the target loss value.

[0067] Although the large model has the ability to directly convert natural language into SQL, in real traffic business scenarios, this ability often does not adapt to the local conditions. Taking the accident business scenario as an example, typical dimensions such as "accident characteristics" are divided into 5 levels (dimension→first-level value→second-level value→third-level value→fourth-level value), and the enumeration value is as many as 200. In the case of such complex logical relationships between tables, the accuracy of the NL2SQL large model of the general large model cannot even reach 10%, and it is almost impossible to land. Therefore, the embodiment of the present application adopts the mode of "training model with model", eliminates syntax errors, logical errors, and dimension missing from the past multiple real query logs to produce cold start data, so that the large model acts as a labeler to perform batch efficient labeling, and then a group of experts who understand both business and SQL perform manual verification to eliminate syntax errors, logical errors, and dimension missing.

[0068] The above technical solution has the following advantages or beneficial effects: by fine-tuning the parameters of the NL2SQL large model, the fine-tuned NL2SQL large model can improve the accuracy of SQL statement generation.

[0069] In order to improve the accuracy of the query, on the basis of the above embodiments, in the embodiment of the present application, the determining of the corresponding target loss value according to the deviation between the sample SQL statement and the output SQL statement comprises:

[0070] determining a first sub-loss value according to the tree edit distance between the sample SQL statement and the output SQL statement and whether the syntax types of the tokens at the same positions in the sample SQL statement and the output SQL statement are consistent, determining a second sub-loss value according to the similarity between the sample SQL statement and the output SQL statement and whether the syntaxes of the sample SQL statement and the output SQL statement are consistent, and determining a third sub-loss value according to the probability distribution of each token predicted and the probability distribution of each token in the sample SQL statement;

[0071] According to the first sub-loss value, the second sub-loss value, and the third sub-loss value, a target loss value is determined.

[0072] In an embodiment of the present application, the electronic device can quantify the structural difference between the sample SQL and the output SQL by tree edit distance, which reflects the minimum number of insertion, deletion, and replacement operations and directly reflects the matching degree of the statement structure. At the same time, the consistency of the syntax type of the token in the same position is compared to ensure that the NL2SQL large model not only generates a structurally correct SQL but also maintains the semantic accuracy of the syntax elements. Optionally, the electronic device can determine a first sub-loss value according to the tree edit distance between the sample SQL statement and the output SQL statement and whether the syntax type of the token in the same position in the sample SQL statement and the output SQL statement is consistent. The first sub-loss value is calculated by combining the syntax tree structure similarity and the type constraint.

[0073] In an example, the first sub-loss value satisfies the following formula:

[0074]

[0075] wherein, is the first sub-loss value, and are respective weights, is the sample SQL statement, is the output SQL statement, is the tree edit distance between the sample SQL statement and the output SQL statement, and N is the number of tokens in the sample SQL statement or the number of tokens in the output SQL statement. In an example, if the number of tokens in the sample SQL statement is greater than the number of tokens in the output SQL statement, N is the number of tokens in the sample SQL statement, otherwise, N is the number of tokens in the output SQL statement. is the syntax type of the i-th token in the sample SQL statement, is the syntax type of the i-th token in the output SQL statement, is an indicator function, which is 1 if , otherwise 0, that is, if is 1, otherwise is 0.

[0076] The electronic device can also determine a second sub-loss value based on the statement similarity. In an example, the electronic device can determine the second sub-loss value according to the similarity between the sample SQL statement and the output SQL statement and whether the syntax of the sample SQL statement and the output SQL statement is consistent.

[0077] In an example, the second sub-loss value satisfies the following formula:

[0078]

[0079] wherein, is the second sub-loss value, and is the corresponding weight respectively, is the sample SQL statement, is the output SQL statement, JaccardLoss is used to measure the similarity between the sample SQL statement and the output SQL statement, and ExecutionError is a syntax error penalty term, is an indicator function, and the correct value is 1 and otherwise 0, that is, if the syntax of the sample SQL statement and the output SQL statement is inconsistent, is 1, otherwise, is 0.

[0080] After obtaining the first sub-loss value and the second sub-loss value, the target loss value is determined according to the obtained first sub-loss value and the second sub-loss value. In an example, the target loss value can be determined according to the first sub-loss value, the second sub-loss value, and the corresponding weight respectively.

[0081] Optionally, the electronic device can also determine a third sub-loss value according to the Token-level cross-entropy loss. In an example, the third sub-loss value satisfies the following formula:

[0082]

[0083] wherein, is the third sub-loss value, T is the total number of tokens in the sample SQL statement, p θ is the probability distribution determined by the NL2SQL large model parameter θ, S t is the tth token in the predicted output SQL statement, S <t is the historical token before the tth token, and x is the data in the input large model.

[0084] If the third sub-loss value is obtained, the electronic device can determine the target loss value based on the first sub-loss value, the second sub-loss value, the third sub-loss value, and the corresponding weight respectively.

[0085] The above technical solution has the following advantages or beneficial effects: using the first sub-loss value, the second sub-loss value, and the third sub-loss value to determine the target loss value for adjusting the parameters of the NL2SQL large model can improve the accuracy of the NL2SQL large model recognition.

[0086] The embodiments of the present application can train the NL2SQL large model based on a structured constraint supervised fine-tuning framework (StructSFT). In an example, a double-encoder model architecture is used: a text encoder (Text Encoder) and a structure encoder (Schema Encoder) are jointly trained to realize end-to-end mapping from semantics to SQL.

[0087] In the embodiments of the present application, a high-quality data set (i.e., the first sample question and the corresponding saved sample SQL statement) is constructed, and a general language model-9B (General Language Model-9B, GLM-9B) is selected as the base model for full-parameter fine-tuning. After training for only 3 epochs, the SQL accuracy of the model on the closed test set can be greatly improved.

[0088] To improve the accuracy of the query, on the basis of the above embodiments, in the embodiments of the present application, after receiving the query question, before querying according to each sub-question and obtaining the corresponding query result, the method further comprises:

[0089] determining the query intent and the query scene corresponding to the query question; obtaining a target template saved for the query intent and the query scene;

[0090] The querying according to each sub-question and obtaining the corresponding query result comprises:

[0091] inputting each sub-question and the target template into a first target large model to obtain a query result output by the target large model according to the target template.

[0092] To improve the readability of the query result, in the embodiments of the present application, corresponding templates are saved in advance for different intents and scenes, and the first target large model can output the corresponding query result based on the corresponding templates.

[0093] In an example, the electronic device can determine the query intent and the query scene corresponding to the query question, wherein the query intent refers to the core purpose or requirement of the query, including data query, operation processing, etc., and the query scene refers to the specific application scene or operation type of the query operation, including counting, maximum value, etc. Optionally, the electronic device can input the query question into a pre-trained model to obtain the query intent and the query scene output by the model. The electronic device can obtain a target template saved for the query intent and the query scene.

[0094] Table 1 is an example of the correspondence between the intent and the scene and the template provided by the embodiments of the present application:

[0095]

[0096]

[0097]

[0098] Table 1

[0099] From Table 1, the intention is "indicator, data query", the scene is "counting - grouping inquiry by dimension", and the corresponding template is "the current question is {xxx}, belongs to the counting scene, and the total number, maximum value, and minimum value of {field} should be fully utilized when summarizing. The example can be referred to as follows: "".

[0100] Among them, the templates corresponding to other intentions and scenes have been described in Table 1, and will not be repeated here.

[0101] After obtaining the target template, the electronic device can input each sub-question and the target template into the first target large model, the first target large model calls the corresponding database to obtain the corresponding query result, and outputs the corresponding query result according to the target template.

[0102] Since the text organization capability of the large model is more prominent, but the mathematical calculation capability is weak, and there is illusion, based on this, in the embodiment of the application, the determination of the predefined tool can be performed by the large model, and the calculation of the numerical value can be performed by the predefined tool, such as calculating the average value, calculating the difference value, and calculating the same ring ratio. The first target large model calculates the numerical value based on the determined predefined tool, and the target template is used for text summarization, which improves the summarization standardization and the accuracy of the summary.

[0103] In the embodiment of the application, by presetting the corresponding summary template for each intention and scene, it is ensured that the output language style is consistent and the logic is rigorous. At the same time, a dedicated attention knowledge base can also be constructed for different intentions and scenes, and through the Retrieval-Augmented Generation (RAG) technology, relevant business rules and common analysis logic are dynamically retrieved before generating the abstract, and the text style is injected, to ensure that the output content conforms to the statistical law and is consistent with the business reality.

[0104] The above technical solution has the following advantages or beneficial effects: in the embodiment of the application, the corresponding target template is saved for the query intention and the query scene, and the first target large model outputs the query result with higher readability according to the target template.

[0105] In order to improve the accuracy of the query, on the basis of the above embodiments, in the embodiment of the application, the method further comprises:

[0106] According to the preset algorithm, the first abnormal data in the plurality of query results is identified.

[0107] inputting the query question into a second target large model, obtaining an abnormality recognition algorithm output by the second target large model; according to the abnormality recognition algorithm, identifying second abnormal data in a plurality of query results; wherein the abnormality recognition algorithm includes isolated forest technology, local outlier factor (Local Outlier Factor, LOF) technology;

[0108] obtaining grouping information in the query question; wherein the grouping information includes at least one of accident occurrence time, accident occurrence place, accident type, accident road section type, and accident form; obtaining an abnormality category saved for the grouping information; determining target information of the first abnormal data and the second abnormal data corresponding to the abnormality category; wherein the abnormality category includes at least one of time and field.

[0109] In order to improve the accuracy of the query, the electronic device can perform abnormality recognition according to a preset algorithm to identify first abnormal data in a plurality of query results. The preset algorithm can be a Z-Score detection algorithm based on a statistical threshold.

[0110] However, the analysis method based on pre-computation and fixed dimension, although with high stability and interpretability, can meet the needs of routine monitoring, but its inherent limitations are increasingly prominent: fixed analysis dimension, rigid process, delayed response, lack of flexibility and agility in the face of complex and changing traffic situation. To break this bottleneck, the embodiments of the present application construct a set of large model driven abnormality finding agents, combined with a pluggable diagnostic tool library, to realize dynamic, autonomous and multi-dimensional abnormality identification of traffic data trends. The pluggable tool library is an open algorithm library, consisting of two categories of tools: general tool library and special tool library. The general tool is used to find unknown, rare or atypical abnormal patterns, and makes up for the coverage blind area of the special model. Typical methods include: Isolation Forest: suitable for detecting outliers in high-dimensional traffic feature space, such as abnormal Origin-Destination (OD) patterns or vehicle behavior clustering deviation. LOF: identifies local density anomaly area, suitable for fine-grained discovery of urban micro-area traffic state mutation. Autoencoder: used for nonlinear feature extraction and reconstruction error analysis to detect potential anomalies in complex spatio-temporal patterns. The special tool library includes: by integrating the Bayesian Online Change Point Detection (BOCPD) model, real-time monitoring of the mutation point of accident reporting frequency, accurate identification of sudden accident outbreak or regional risk increase events; using the Autoregressive Integrated Moving Average (ARIMA) model or the Prophet model for trend fitting, combined with residual analysis to identify significant deviations from expected traffic anomalies, such as early morning peak or late evening peak extension; based on signal control tools to detect whether the phase configuration of the traffic signal at the specified intersection has logical or temporal conflicts, to ensure that the traffic flow, non-motor vehicles and pedestrian traffic rights in each direction are mutually exclusive and safe in space and time.

[0111] The electronic device can input the query question into the second target large model to obtain an abnormality identification algorithm output by the second target large model, the abnormality identification algorithm being the tool described above. According to the abnormality identification algorithm, the second abnormal data in the plurality of query results is identified.

[0112] The electronic device can obtain grouping information in the query question, wherein the grouping information includes at least one of accident occurrence time, accident occurrence location, accident type, accident road segment type, and accident form. And obtain an abnormality category saved for the grouping information. Determine that the first abnormal data and the second abnormal data correspond to target information of the abnormality category, wherein the abnormality category includes at least one of time and field.

[0113] In an example, the normal value statistics can also be based on predefined tools. The query results are feature extracted and situation quantified by the predefined tools, and a data cognition summary containing extreme value statistics, trend fluctuation and distribution deviation is output. Due to the illusion problem of large models, the step of mathematical calculation by large models needs to be avoided, so the application embodiment designs a scientific calculation auxiliary tool (tool) to complete the formation of the data cognition summary. Finally, the first target large model calculates the values based on the determined predefined tools, and the target template is queried to summarize the text. In the process of data analysis and insight generation, in order to ensure the accuracy and scientificity of the output results, the application embodiment constructs a rigorous and verifiable data cognition summary generation mechanism. The mechanism aims to perform in-depth feature extraction and situation quantification analysis on the query results, and output content covering core dimensions such as extreme value statistics, trend fluctuation analysis, and distribution deviation evaluation, forming a data insight summary with clear structure, explicit semantics, and business interpretation. In order to effectively avoid the "illusion" problem that may occur in the mathematical calculation process of large language models, a scientific calculation auxiliary tool chain is designed and introduced, which is specially responsible for executing statistical calculation tasks, such as accurate solution of quantization indexes such as maximum value, minimum value, mean value, standard deviation, coefficient of variation, trend slope, skewness / kurtosis, etc. The large model does not directly participate in numerical operation, but only acts as an "analysis engine" to receive structured results calculated by the tool, and combines the context semantics to perform induction and expression at the natural language level. In the data analysis process, the schema (Schema) meta information in the SQL query statement is deeply mined and fully utilized to realize accurate identification of business semantics and analysis intent. For example, the table name involved in the FROM clause (such as the acd table usually represents "accident" data, and the driver table corresponds to "driver" information) is used to automatically infer the business field and core entity type to which the current query belongs. Further, through comprehensive analysis of the SELECT field, GROUP BY dimension, aggregation function and WHERE filter condition, the user's calculation intent is intelligently identified. For example, when the query is "statistical number of accidents in each jurisdiction", the electronic device will automatically determine that the analysis target is "frequency distribution in spatial dimension", and trigger the corresponding analysis logic: not only output the overall trend, but also focus on extracting key features such as the jurisdiction with the most accidents (extreme value statistics), the jurisdiction with the fewest accidents (low value insight), and the difference amplitude between jurisdictions (distribution dispersion degree), etc. The intent recognition mechanism driven by Schema meta information semantics enables the electronic device to automatically match the corresponding analysis template and statistical strategy without additional manual annotation.For example, if the number of events is grouped by time, the trend fluctuation analysis module is activated to identify time periods with significant increases / decreases; if the events are aggregated by category fields (such as accident type or vehicle brand), the distribution deviation detection is initiated to identify categories with abnormally high or low proportions; for numerical indicators (such as accident loss amount), descriptive statistics such as mean, median, and standard deviation are added to help determine central tendency and outlier risk.

[0114] The above technical solution has the following advantages or beneficial effects: by using the method provided in the embodiments of this application, a more suitable anomaly recognition algorithm can be used to identify abnormal data and determine the target information of the corresponding anomaly category.

[0115] Figure 3 This is a detailed schematic diagram illustrating an anomaly identification process provided in an embodiment of this application.

[0116] Depend on Figure 3 It is known that the SQL statement's Schena can be analyzed by the meta-information analysis engine to determine the intent and analysis dimension (i.e., the scenario described in the embodiments of this application). Through the RAG knowledge base, the corresponding summary template and analysis rules can be determined. The corresponding anomaly recognition algorithm can be determined by the data feature extraction and situation quantification intelligent agent (the second target large model described in the embodiments of this application).

[0117] To improve the accuracy of the query, based on the above embodiments, in this embodiment, the second target large model is trained in the following way:

[0118] Obtain the second sample problem and the sample recognition algorithm saved for the second sample problem;

[0119] Input the second sample problem into the second target large model, and obtain the output recognition algorithm of the second target large model;

[0120] A reinforcement learning optimization strategy based on human feedback (Group Relative Policy Optimization, GRPO) is adopted to determine the reward values ​​corresponding to the sample recognition algorithm and the output recognition algorithm; the parameters of the second target large model are adjusted according to the reward values.

[0121] Although large models have strong language understanding and generation capabilities, there are common illusion problems in the actual tool calling process, which are manifested as generating parameters that do not conform to the tool interface specification, calling non-existent tools or low tool calling rate, which seriously affects the reliability and flexibility of the query process. To solve the above problems, the embodiment of the present application uses GRPO to fine-tune the large model based on the general large model base (Qwen3-14b). By designing a structured training process and constraint mechanism, the accuracy and rationality of the model tool calling are significantly improved. The specific design is as follows: an abnormal diagnosis method of reinforcement learning and plug-in tool library cooperative optimization is designed, which takes into account reliability and autonomy. Through dynamic loading of special algorithms (such as accident domain Bayesian mutation detection, signal domain phase conflict model), accurate abnormal capture is realized, and the generalization ability of the model is greatly improved by introducing reinforcement learning strategy.

[0122] In an example, the electronic device can obtain a second sample question and a sample recognition algorithm saved for the second sample question. The electronic device inputs the second sample question into the second target large model to obtain an output recognition algorithm output by the second target large model. And using GRPO, determine the reward value corresponding to the sample recognition algorithm and the output recognition algorithm. According to the reward value obtained, the parameters of the second target large model are adjusted.

[0123] In the embodiment of the present application, the reward function is divided into format reward and accuracy reward. The format reward ensures that the structured output of the second target large model conforms to the expected format, including but not limited to the validity of the JSON structure and the tool parameter format. This part of the reward aims to ensure that the generated action instruction can be correctly parsed and executed by the electronic device, avoiding calling failure or invalid operation due to format error.

[0124] In an example, the format reward value satisfies the following formula:

[0125]

[0126] Wherein, The format reward value is the format reward value, and the format correct means that the format of the output recognition algorithm output by the second target large model is accurate.

[0127] The accuracy reward focuses on the actual effect of the action, and measures whether the selected action can effectively improve the performance indicators of the traffic scheduling electronic device. Including the correctness of the tool (abnormal recognition algorithm) name and parameter.

[0128] In an example, the accuracy reward value satisfies the following formula:

[0129]

[0130] Wherein, The accuracy reward value is the accuracy reward value. an output anomaly algorithm output by the second target large model, a set of anomaly identification algorithms saved in advance for the query scenario, a sample identification algorithm, a a preset numerical value in the sample.

[0131] For example, it is legal to call the "accident domain Bayesian mutation detection tool" in the accident analysis scenario, but it is unreasonable to call the "accident domain Bayesian mutation detection tool" in other scenarios.

[0132] In an example, the parameter reward value satisfies the following formula:

[0133]

[0134] wherein, the parameter reward value, the number of all mandatory parameters required by the sample output algorithm, all parameters output by the second target large model, is a check on the parameter type and format constraint, is a normalized matching score reflecting the integrity and accuracy of the parameters. For example, if 3 parameters need to be filled in, only 2 are correctly filled in, and the parameter reward value is .

[0135] The above reward values are combined to obtain the overall correctness reward.

[0136] In the embodiments of the present application, the GRPO in-group advantage normalization technique is used to strengthen the fine-tuning tool scheduling model. For each query question, a set of responses obtained by reasoning includes multiple groups of responses and their corresponding reward values. wherein A represents the true annotation result for the query question Q, represents the sum of the format and correctness rewards of each response. For each group, the mean and standard deviation of the rewards are calculated. Then, for each sample in the group , the normalization is defined as: wherein, is the normalized value corresponding to the i-th sample, is the reward value of the i-th sample, is the mean value of the rewards, is the standard deviation of the rewards, is a very small constant to avoid division by 0.

[0137] Figure 4 is a second target large model training process schematic diagram provided by the embodiments of the present application.

[0138] byFigure 4 It can be known that the second target large model (LLM) is connected with the pluggable tool library, and the corresponding abnormality recognition algorithm can be called based on the pluggable tool library. The second sample question is input into the second target large model, and the corresponding output abnormality algorithm (i.e., the selected tool shown in the figure) is output by the second target large model. Based on the determined output abnormality algorithm and the pre-saved sample abnormality algorithm, the determination of the format reward and the accuracy reward is determined, and the second target large model is optimized based on the GRPO optimization strategy. In an example, the tool execution result can also be obtained based on the execution of the tool, and the second target large model is optimized according to the tool execution result and the pre-saved data (i.e., the pre-labeled accurate execution result). Figure 4 Figure 2

[0139] At the same time, in order to encourage the second target large model to explore the scheduling ability of the tool, the optimization strategy is defined as follows:

[0140]

[0141] Among them, is a numerical value for measuring the optimization effect of the strategy, and the parameter θ is updated by gradient; is the probability of selecting action q under state Q, i is the probability of selecting action q i under state Q before optimization of the parameter θ, is the reward value of selecting action q i , and is a preset numerical value.

[0142] The optimization target of the embodiment of the application can effectively guide the policy to generate a tool call sequence that is structured and semantically accurate, and at the same time, the difference in reward values of different inference paths is alleviated through the intra-group normalization mechanism, thereby realizing a stable and efficient tool call strategy that matches the specific data analysis needs.

[0143] The above technical solution has the following advantages or beneficial effects: the method provided by the embodiment of the application can improve the accuracy of the second target large model in determining the abnormality recognition algorithm.

[0144] In order to improve the accuracy of the query, on the basis of the above embodiments, in the embodiment of the application, the method further comprises:

[0145] According to the information in the pre-saved causal knowledge base and the similarity of the target information, the first target information with the highest similarity is determined;

[0146] ​​​Obtain second target information having an association relationship with the first target information in the cause-effect knowledge base; if the type of the second target information is a cause or a consequence or a solution, output the second target information.

[0147] In the embodiment of the present application, the cause-effect knowledge base is pre-stored, and the electronic device can determine the first target information with the highest similarity according to the similarity between the information in the pre-stored cause-effect knowledge base and the determined target information. The second target information having an association relationship with the first target information is obtained, and if the type of the second target information is a cause or a consequence or a solution, the second target information can be output.

[0148] In order to more accurately understand the traffic phenomenon, a comprehensive and accurate cause-effect reasoning knowledge base is pre-constructed to provide scientific and in-depth cause-effect analysis support for traffic management. The "cause-effect chain + data-driven discovery" double mechanism is introduced, on the one hand, to solidify the experience of front-line police officers and experts (construction occupation, traffic capacity reduction, congestion), and on the other hand, to automatically discover potential causes based on large-scale data. Expert knowledge sorting and rule extraction: based on the rich practical experience and professional knowledge of front-line police officers and experts, the common cause-effect relationships between traffic events are sorted, such as "construction occupation, lane reduction, traffic capacity reduction, congestion index increase", "traffic accident, road blockage or slow traffic, queue length increase", etc. These cause-effect relationships are coded in the form of rules to construct a preliminary cause-effect rule base, i.e. the cause-effect knowledge base described in the embodiment of the present application.

[0149] Among them, multi-source heterogeneous data fusion is the core link of intelligent traffic management, and its goal is to integrate unstructured, structured and semi-structured data from different sources (such as sensors, monitoring, event reporting, etc.), with different formats and granularities. These data contain rich traffic information, but due to the lack of effective integration, it is difficult to fully play its value, and eliminating the data island effect is particularly critical. For example, road construction information needs to be aligned with real-time speed, weather conditions and other dynamic data to accurately depict the driving factors of traffic state changes. The main technical path is as follows: Data collection and aggregation: Through various traffic perception devices such as sensors, cameras, weather perception, etc., real-time collection of road conditions, weather, traffic flow and other raw data, as well as structured data such as road construction, large-scale activity arrangements. Accurate alignment of time and space dimensions: For the time dimension, use high-precision clock synchronization technology to unify the time stamps of data from different data sources to Coordinated Universal Time (UTC), ensuring consistent data time scale. For the spatial dimension, based on Geographic Information System (GIS), traffic data and maps are matched using the WGS84 coordinate system. For data of different granularities, processing is done through interpolation, aggregation, etc. For example, high-frequency speed data is aggregated every 5 minutes to align with congestion index and other low-frequency data in terms of time granularity; for road segment data in space, different precision road information is unified to the same spatial division standard according to road length and node location. Data cleaning and preprocessing: Identify and remove incorrect data, such as speed values that are obviously outside the normal range, abnormal flow data, etc. For missing data, use interpolation methods (such as linear interpolation, K-nearest neighbor interpolation), model-based prediction filling, etc. to supplement. Standardize different formats of data, such as converting weather conditions in enumeration code form to text explanations, and converting traffic flow data in different units to standard units to eliminate the impact of data format differences on subsequent analysis. Feature extraction: Extract key features from the cleaned multi-source data. For traffic flow data, calculate flow rate, peak hour flow, etc. For speed data, extract average speed, speed standard deviation (reflecting speed fluctuation), etc. From weather data, extract temperature, precipitation, wind force, etc. related to traffic; from road construction information, extract construction road length, construction duration, affected lane number, etc. Form a multi-source fusion traffic data set, with accurate alignment in time and space dimensions, uniform format, rich and representative features. This data set covers various aspects of traffic system operation, providing a solid data foundation for subsequent causal relationship analysis and deduction, and can more comprehensively and accurately reflect the true state of the traffic system.

[0150] From the multi-source data after fusion in the past years, the data mining algorithm is used to infer the causal dependence between variables. The data mining algorithm used is as follows: Bayesian network modeling and structure learning: using structure learning algorithms such as Peter-Clark (PC) algorithm, Greedy Equivalence Search (GES) algorithm, etc. to infer the causal dependence relationship between variables from high-dimensional spatio-temporal data, build a causal graph, including not only the direct causal chain of "bad weather" and "accident rate", but also the complex causal pattern of "heavy rain + school surrounding road segment → congestion probability significantly increased". At the same time, maximum likelihood estimation or Bayesian estimation is used for parameter estimation to quantify the causal strength, such as "congestion probability increases by 35% under heavy rain, and the model robustness is evaluated by 10-fold cross-validation and other cross-validation methods to avoid overfitting. Causal inference algorithm strengthens causal dependence: in terms of confounding factor control, propensity score matching is used to construct the weighted score of the covariate to eliminate observation bias, for example, when analyzing the "impact of construction on congestion", the relevant covariates are matched; the instrumental variable method is used to introduce exogenous variables such as sudden rainfall to solve the endogeneity problem. In dynamic causal modeling, Granger causality test is used to analyze the lead-lag relationship between time series variables, such as "road construction announcement published 3 days in advance → traffic capacity decreased"; dynamic Bayesian network is used to capture the time-varying characteristics of causal relationships, such as the periodic enhancement of holiday effect. Counterfactual reasoning and intervention effect quantification: using the Do-Calculus framework, based on the causal graph, the intervention operation is defined, and the counterfactual result is calculated, which can also be used to generate "hypothetical scenarios" to provide quantitative basis for decision-making. Shapley value decomposition method is used to quantify the contribution of multiple factors, such as "construction contribution 40%, bad weather contribution 25%, and traffic restriction measures contribution 35%"; LIME algorithm is used to generate local interpretability report, such as "the main driving factor of congestion probability increase on school surrounding road segment under heavy rain is the surge of student drop-off vehicles".

[0151] The generated structured causal graph, causal strength quantification table, counterfactual analysis result and dynamic causal model are combined with natural language generation technology to convert into text reports that are easy for decision-makers to understand, and the report content and related dimension values are stored in the Milvus vector database to support efficient retrieval and subsequent analysis of large models.

[0152] The integrated multi-dimensional traffic data is combined with the rules in the causal reasoning knowledge base using a causal reasoning engine to construct a causal network model. The traffic events are nodes and the causal relationships are edges, and different types of traffic data (such as weather, road conditions, accidents, etc.) and their mutual influence relationships are mapped into the network structure. For example, the "traffic accident" node is connected to the "road slow" node through the "cause" edge, and the "road slow" node is connected to the "congestion index rise" node, forming a network topology reflecting the traffic causal logic. Root cause tracing algorithm: starting from the node corresponding to the abnormal index, the causal network is traversed in reverse, and the causal strength (such as conditional probability, confidence) and data evidence (such as accident reporting records, construction announcements) are combined for multi-path search: reverse causal reasoning: using the posterior probability inference of Bayesian network, the conditional probability of each potential cause (such as accident, construction) is calculated, and the root causes with confidence higher than the threshold are screened. Multi-path contribution analysis: by simulating the influence of node disturbance in the causal network on the target node (Shapley value decomposition, counterfactual reasoning), the contribution degree of each root cause is quantified. For example, assume that the contribution of "traffic accident" to "congestion index rise" is 60%, and the contribution of "road construction" is 40%. Priority ranking: according to the contribution degree, the urgency (such as the severity of the accident) and the controllability (such as the controllability of the construction), the root causes are prioritized to guide the large model to consider the priority of factors. Integrate the results of root cause tracing and contribution analysis, and use natural language generation algorithm to convert each item of data and analysis conclusion into structured text report. In turn, the description of abnormal traffic indicators, the time and location of discovery, the key root causes and contribution degrees, the display of causal network related relationships, the support of data evidence, and the management suggestions are included, which greatly improves the accuracy of large model root cause analysis.

[0153] Currently, with the technological upgrades brought by advanced big data models such as ChatGPT and DeepSeek, big data model technology has moved from exploring general capabilities to deeply empowering vertical industries, becoming a core engine driving industrial digital transformation. Intelligent data querying, as a typical application scenario of big data models, enables data querying and analysis through natural language interaction, significantly lowering the barrier for business personnel to use data. However, existing technical approaches still face a dual bottleneck: at the cognitive level, while current intelligent data querying systems can achieve flexible statistics, they heavily rely on manually preset analysis dimensions (such as time range or jurisdiction), only outputting basic statistical data (such as total accidents, year-on-year and month-on-month comparisons), and cannot autonomously identify business anomalies (such as automatically judging whether "the surge in rear-end collisions during morning rush hour exceeds the standard"); at the analytical level, the discrete multi-source data (construction logs / accident reports / public opinion texts) in traffic management scenarios suffer from modal heterogeneity and a lack of a unified spatiotemporal benchmark, making it difficult to coordinate and attribute key factors (for example, it is impossible to establish a quantitative causal chain between heavy rain and a sharp increase in accident rates on specific road sections). This limitation of "passively responding to statistical needs" and "isolated root cause analysis" restricts the closed-loop value transformation from data to decision-making. To address the aforementioned shortcomings, this patent proposes a "four-stage intelligent analysis chain" architecture based on multi-agent collaboration, which enables full-process empowerment from data query to root cause analysis through a four-stage progressive architecture.

[0154] The above technical solution has the following advantages or beneficial effects: the method provided in the embodiments of this application can determine the information corresponding to the cause or consequence or solution.

[0155] Figure 5 This is a detailed schematic diagram illustrating a query process provided in an embodiment of this application.

[0156] Depend on Figure 5 It can be seen that the number of questions can be decomposed by dynamically generating the semantic structure domain NL2SQL; then, the data feature extraction and situation quantification can be used to summarize and understand the situation; then, anomaly detection can be carried out by collaborative detection through a pluggable diagnostic tool library; and finally, root cause analysis can be carried out by multi-source causal chain inference and strategy generation.

[0157] The embodiment of the application provides a traffic management abnormal data self-sensing and root cause tracing method for multi-agent collaborative decision-making. Through a four-stage progressive architecture, the whole process from data query to root cause analysis is enabled. First, a problem semantic decomposition engine is constructed to intelligently disassemble the user's natural language request into multi-dimensional sub-problems. Through the domain fine-tuned NL2SQL large model, accurate query instructions are dynamically generated. Then, the query results are quantified and visualized, and the cognitive summary containing extreme value statistics, trend fluctuations and distribution deviations is output. Then, based on the pluggable diagnostic tool library, special detection algorithms are loaded according to the business domains such as accidents and signal control, and multi-level abnormal sensing is realized by integrating the general outlier detection engine. Finally, by constructing cross-domain causal knowledge, the root cause chain is deduced by integrating traffic management control, weather, public opinion and other multi-source heterogeneous data. In one example, a disposal strategy with confidence evaluation can be output.

[0158] Figure 6 A detailed process diagram is provided for the embodiment of the application.

[0159] By Figure 6 It can be seen that when disassembling the problem, multiple sub-problems can be obtained through multi-level semantic analysis, and then converted into SQL statements corresponding to the multiple sub-problems through the NL2SQL large model.

[0160] In the summary understanding, multi-dimensional feature extraction can be performed, and then the corresponding target template can be determined by identifying the intent and scene. The first target large model outputs the query results according to the target template.

[0161] In the abnormal diagnosis, the corresponding abnormal recognition algorithm can be determined according to the target large model, and the target large model can be optimized according to the GRPO to realize the vertical domain customized large model.

[0162] In the root cause analysis stage, the corresponding target information can be determined through the causal knowledge base. The causal chain knowledge base is based on multi-source spatio-temporal alignment data and causal relationship reasoning.

[0163] The combination of multi-source space-time alignment and causal reasoning knowledge base provides key support for root cause analysis accuracy. Through the establishment of a space-time-business-environment fusion graph, the system realizes the second-level space-time alignment of multi-source heterogeneous data such as construction control, accidents, police cases, weather interfaces, public opinion text, etc., and solves the problem of collaborative analysis caused by the dispersion of data sources, different modalities and lack of unified space-time benchmark. On this basis, with the aid of data mining algorithms, causal modeling is performed on historical traffic data, and the contribution of cross-domain root causes is quantitatively sorted, so that the accuracy of abnormal root cause positioning is improved, and the reliability and scientificity of root cause analysis are greatly enhanced. The application provides a traffic management abnormal data self-sensing and root cause tracing method based on multi-agent collaborative decision-making, which is characterized by deep integration of business problem semantic decomposition and multi-source space-time alignment causal reasoning knowledge base, and construction of a full-process empowerment system from data query to root cause analysis. Under the driving of the four-stage intelligent analysis chain, the process realizes layer-by-layer progressive closed-loop evolution: first, relying on the problem semantic decomposition engine, the user's natural language request is intelligently disassembled into multi-dimensional sub-problems, and a precise query instruction is dynamically generated through the field-tuned NL2SQL large model, breaking the dependence on artificial preset dimensions in traditional analysis; second, the query results are quantified and visualized, and a cognitive summary containing extreme value statistics, trend fluctuations and distribution deviations is output, so that the system can form business cognition autonomously; third, based on the pluggable diagnostic tool library, special detection algorithms (such as accident domain Bayesian mutation detection and signal domain phase conflict model) are loaded according to business domains such as accidents and signal control, and a general outlier detection engine is integrated to accurately capture multi-level abnormalities; finally, the root cause chain is deduced through cross-domain causal knowledge, and a disposal strategy with confidence evaluation is output, realizing seamless information transmission throughout the process and breaking through the information fault bottleneck of traditional single-point analysis.

[0164] Figure 7 A structural schematic diagram of a query device provided by an embodiment of the application is shown in the figure. The device comprises:

[0165] The receiving and acquiring module 701 is configured to receive a query question, acquire a query keyword in the query question, and determine a query vector corresponding to the query question according to the type of each acquired query keyword and the component position of the keyword of the corresponding type in the vector.

[0166] The determining module 702 is configured to determine a preset number of target vectors with high similarity according to the similarity of each vector in a pre-stored vector library and the query vector, and acquire a word group saved for each target vector, wherein the word group contains at least one keyword.

[0167] The processing module 703 is configured to input each phrase and the query question obtained to a split large model, and obtain each sub-question output by the split large model after splitting.

[0168] In a possible implementation, the processing module 703 is specifically configured to determine, by using an NL2SQL large model, a SQL statement corresponding to each sub-question, and perform a query in a database according to each SQL statement obtained to obtain a corresponding query result.

[0169] In a possible implementation, the processing module 703 is further configured to train the NL2SQL large model by: obtaining a first sample question and a sample SQL statement saved for the first sample question; inputting the first sample question to the NL2SQL large model to obtain an output SQL statement output by the NL2SQL large model; determining a target loss value according to a deviation between the sample SQL statement and the output SQL statement, and fine-tuning parameters of the NL2SQL large model according to the target loss value.

[0170] In a possible implementation, the processing module 703 is specifically configured to determine a first sub-loss value according to a tree edit distance between the sample SQL statement and the output SQL statement and whether the token types at the same positions in the sample SQL statement and the output SQL statement are consistent, determine a second sub-loss value according to a similarity between the sample SQL statement and the output SQL statement and whether the grammars of the sample SQL statement and the output SQL statement are consistent, determine a third sub-loss value according to a probability distribution of each token predicted and a probability distribution of each token in the sample SQL, and determine the target loss value according to the first sub-loss value, the second sub-loss value and the third sub-loss value.

[0171] In a possible implementation, the processing module 703 is further configured to determine a query intent and a query scene corresponding to the query question, and obtain a target template saved for the query intent and the query scene.

[0172] The processing module 703 is specifically configured to input each sub-question and the target template to a first target large model to obtain a query result output by the target large model according to the target template.

[0173] In a possible implementation, the processing module 703 is further configured to: perform abnormality identification according to a preset algorithm, to identify first abnormal data in the plurality of query results; input the query question into a second target large model, to obtain an abnormality identification algorithm output by the second target large model; identify second abnormal data in the plurality of query results according to the abnormality identification algorithm; wherein the abnormality identification algorithm includes an isolation forest technology and an LOF technology; obtain grouping information in the query question; wherein the grouping information includes at least one of an accident occurrence time, an accident occurrence location, an accident type, an accident road segment type, and an accident form; obtain an abnormality category saved for the grouping information; determine target information of the abnormality category corresponding to the first abnormal data and the second abnormal data; and wherein the abnormality category includes at least one of a time and a field.

[0174] In a possible implementation, the processing module 703 is further configured to train the second target large model by: obtaining a second sample question and a sample identification algorithm saved for the second sample question; inputting the second sample question into the second target large model, to obtain an output identification algorithm output by the second target large model; determining a reward value corresponding to the sample identification algorithm and the output identification algorithm by using a GRPO; and adjusting parameters of the second target large model according to the reward value.

[0175] In a possible implementation, the processing module 703 is further configured to: determine, according to information in a pre-saved causal knowledge base and a similarity of the target information, first target information with a highest similarity; obtain second target information having an association relationship with the first target information in the causal knowledge base; and output the second target information if the second target information is of a type of cause or consequence or solution.

[0176] Figure 8 An electronic device structure schematic diagram is provided in the embodiments of the present application, and on the basis of the above embodiments, the embodiments of the present application further provide an electronic device, as shown in the figure, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804. Figure 8

[0177] The memory 803 stores a computer program, and when the program is executed by the processor 801, the processor 801 executes any of the above method steps.

[0178] ​The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0179] The communication interface 802 is used for communication between the electronic device and other devices.

[0180] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0181] The processor mentioned above can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; can also be a Digital Signal Processing (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0182] The present application also provides a computer storage readable storage medium, the computer readable storage medium stores a computer program executable by an electronic device, when the program runs on the electronic device, makes the electronic device execute the above any method steps.

[0183] The present application provides a computer program product, the computer program product includes an executable program, the executable program is executed by the processor to realize the method.

[0184] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to the embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0185] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.

Claims

1. A large model-based traffic query method, characterized in that, The method comprises: receiving a query question; obtaining query keywords in the query question; determining a query vector corresponding to the query question according to the type of each obtained query keyword and the component position of the keyword of the corresponding type in the vector; determining a preset number of target vectors with high similarity according to the similarity of each vector in a pre-stored vector library and the query vector; for each target vector, obtaining a word group saved for the target vector, wherein the word group contains at least one keyword; inputting each obtained word group and the query question into a split large model to obtain each sub-question output by the split large model after splitting; querying according to each sub-question to obtain a corresponding query result; The method further comprises: performing abnormality identification according to a preset algorithm to identify first abnormal data in the plurality of query results; wherein the preset algorithm comprises a Z-Score detection algorithm based on a statistical threshold; inputting the query question into a second target large model to obtain an abnormality identification algorithm output by the second target large model; identifying second abnormal data in the plurality of query results according to the abnormality identification algorithm; wherein the abnormality identification algorithm comprises isolated forest technology and local outlier factor (LOF) technology; obtaining grouping information in the query question; wherein the grouping information comprises at least one of accident occurrence time, accident occurrence location, accident type, accident road segment type, and accident form; obtaining an abnormality category saved for the grouping information; determining target information of the abnormality category corresponding to the first abnormal data and the second abnormal data; wherein the abnormality category comprises at least one of time and field; The querying according to each sub-question to obtain a corresponding query result comprises: determining a structured query language (SQL) statement corresponding to each sub-question through a natural language to structured query language (NL2SQL) large model; querying in a database according to each obtained SQL statement to obtain a corresponding query result; The NL2SQL large model is trained in the following manner: obtaining a first sample question and a sample SQL statement saved for the first sample question; inputting the first sample question into the NL2SQL large model to obtain an output SQL statement output by the NL2SQL large model; The first sub-loss value is determined according to a tree edit distance between the sample SQL statement and the output SQL statement and whether the syntax types of tokens at the same positions in the sample SQL statement and the output SQL statement are consistent, the second sub-loss value is determined according to a similarity between the sample SQL statement and the output SQL statement and whether the syntaxes of the sample SQL statement and the output SQL statement are consistent, the third sub-loss value is determined according to a predicted probability distribution of each token and a probability distribution of each token in the sample SQL, and the target loss value is determined according to the first sub-loss value, the second sub-loss value and the third sub-loss value, and the parameters of the NL2SQL large model are fine-tuned according to the target loss value.

2. The method of claim 1, wherein, After receiving the query question, before querying according to each sub-question to obtain the corresponding query result, the method further comprises: determining a query intention and a query scene corresponding to the query question; and obtaining a target template saved for the query intention and the query scene; the querying according to each sub-question to obtain the corresponding query result comprises: inputting each sub-question and the target template into a first target large model to obtain a query result output by the target large model according to the target template.

3. The method of claim 1, wherein, The second target large model is trained in the following manner: obtaining a second sample question and a sample recognition algorithm saved for the second sample question; inputting the second sample question into the second target large model to obtain an output recognition algorithm output by the second target large model; adopting a reinforcement learning optimization policy GRPO based on human feedback to determine a reward value corresponding to the sample recognition algorithm and the output recognition algorithm; and adjusting parameters of the second target large model according to the reward value.

4. The method of claim 2, wherein, The method further comprises: determining a first target information with the highest similarity according to information in a pre-saved causal knowledge base and a similarity with the target information; obtaining second target information having an association relationship with the first target information in the causal knowledge base; and outputting the second target information if the type of the second target information is a cause or a consequence or a solution.

5. A query device, characterized in that The device comprises: a receiving and obtaining module configured to receive a query question, obtain query keywords in the query question, and determine a query vector corresponding to the query question according to the type of each obtained query keyword and the component position of the keyword of the corresponding type in the vector; a determining module configured to determine a preset number of target vectors with high similarity according to the similarity between each vector in a pre-saved vector library and the query vector, and obtain a word group saved for each target vector, wherein the word group contains at least one keyword; a processing module configured to input each obtained word group and the query question into a splitting large model to obtain each sub-question output by the splitting large model after splitting, and query according to each sub-question to obtain the corresponding query result. The processing module is further configured to identify first abnormal data in the multiple query results according to a preset algorithm; the preset algorithm includes a Z-Score detection algorithm based on a statistical threshold; input the query question into a second target large model to obtain an abnormality identification algorithm output by the second target large model; identify second abnormal data in the multiple query results according to the abnormality identification algorithm; the abnormality identification algorithm includes an Isolation Forest technology and a Local Outlier Factor (LOF) technology; obtain grouping information in the query question; the grouping information includes at least one of an accident occurrence time, an accident occurrence location, an accident type, an accident road segment type, and an accident form; obtain an abnormality category saved for the grouping information; determine target information of the abnormality category corresponding to the first abnormal data and the second abnormal data; the abnormality category includes at least one of a time and a field; The processing module is specifically configured to determine a structured query language (SQL) statement corresponding to each sub-question through a natural language to structured query language (NL2SQL) large model; and perform a query in a database according to each obtained SQL statement to obtain corresponding query results. The processing module is further configured to train the NL2SQL large model by: obtaining a first sample question and a sample SQL statement saved for the first sample question; inputting the first sample question into the NL2SQL large model to obtain an output SQL statement output by the NL2SQL large model; determining a first sub-loss value according to a tree edit distance between the sample SQL statement and the output SQL statement and whether token syntax types at the same positions in the sample SQL statement and the output SQL statement are consistent; determining a second sub-loss value according to a similarity between the sample SQL statement and the output SQL statement and whether syntaxes of the sample SQL statement and the output SQL statement are consistent; determining a third sub-loss value according to a probability distribution of each token predicted by the NL2SQL large model and a probability distribution of each token in the sample SQL statement; determining a target loss value according to the first sub-loss value, the second sub-loss value, and the third sub-loss value; and fine-tuning parameters of the NL2SQL large model according to the target loss value.

6. An electronic device, comprising: The electronic device at least includes a processor and a memory, and the processor is configured to implement the steps of the traffic query method based on a large model according to any one of claims 1-4 when executing a computer program stored in the memory.

Citation Information

Patent Citations

  • Well engineering knowledge base-based question and answer method and related device

    CN118689970A

  • Network operation and maintenance analysis method and device and storage medium

    CN118916618A

  • Abnormality detection model selection method and system based on index portrait

    CN120724255A