Large model illusion suppression intelligent question answering system and method based on deep learning
By constructing a database schema and entity mapping relationship, generating task prompt word sequences, and utilizing an improved NASNet network for SQL query generation and consistency verification, the illusion phenomenon in intelligent question answering systems is resolved, and the accuracy and credibility of query results are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-11
- Publication Date
- 2026-03-24
AI Technical Summary
Existing deep learning-based large language models are prone to producing illusions in intelligent question-answering systems, generating answers that do not match the actual database information, thus affecting the accuracy and reliability of the system.
By collecting database structure information, constructing a database schema and configuring entity mapping relationships, generating task prompt word sequences, using an improved NASNet network to generate SQL queries, and performing legality and consistency checks to ensure that the generated query results are consistent with the user's intent.
It significantly improves the accuracy and reliability of query results, avoids query failures due to structural mismatches or syntax errors, and enhances the system's query understanding and consistency verification capabilities.
Smart Images

Figure CN121722786A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent question answering and artificial intelligence, and in particular to an intelligent question answering system and method for large-scale illusion suppression based on deep learning. Background Technology
[0002] With the rapid development of artificial intelligence technologies, especially deep learning and natural language processing, intelligent question-answering systems are increasingly being used in various fields, playing a crucial role in scenarios such as intelligent customer service, voice assistants, and automated knowledge retrieval. These systems utilize natural language processing to understand and generate answers to user queries. However, existing intelligent question-answering systems, particularly those based on large deep learning language models, still face a series of challenges and limitations in practical applications, especially the "illusion" problem, which affects the accuracy and reliability of the system's output. In large-model-based intelligent question-answering systems, "illusion" refers to the possibility that the model, based on its training data and reasoning mechanism, may generate answers that are inconsistent with reality. These answers may seem reasonable but are actually incorrect or inconsistent with information in the actual database. This phenomenon is particularly severe in database query or knowledge reasoning scenarios because the model may generate answers based on irrelevant or inaccurate training data, rather than reasoning based on actual data and explicit query instructions.
[0003] In existing technologies, many large deep learning-based models, when generating question answers, often rely too heavily on the model's prior knowledge and reasoning abilities, neglecting the actual verification of the query and the control of the legality of the generated content. Specifically, traditional intelligent question answering methods mainly rely on understanding the user's natural language query input and matching it with the corresponding database, often failing to effectively suppress the generation of "illusory" answers that do not conform to reality. This is because the model fails to fully consider the database structure, table field relationships, and syntactic legality during the reasoning process, resulting in deviations between the generated query statements or answers and the actual data in the database. Summary of the Invention
[0004] One objective of this invention is to propose a deep learning-based intelligent question-answering system and method for suppressing hallucinations in large models. This invention fully utilizes improved NASNet networks, large model inference, database structure awareness, and consistency verification techniques. Through the generation of accurate question-answering results using structured database information, task prompt word sequences, and consistency verification mechanisms, it possesses the advantages of reducing hallucination phenomena and improving the accuracy and reliability of query results.
[0005] A deep learning-based intelligent question answering method for large-scale hallucination suppression according to an embodiment of the present invention includes the following steps: Collect the database structure information, parse the table structure, field information and inter-table relationships in the database, construct the database schema, and configure entity mapping relationships based on the database schema; Based on the database schema and entity mapping relationship, configure prompt word information for large model inference to form a task prompt word sequence; The system receives natural language queries input by the user and obtains dialogue history information, system analysis and decision-making process information, and dialogue summary information corresponding to the natural language query to form a complete system input. By using the task prompt word sequence, an SQL generation input sequence is constructed from the complete system input, and the SQL generation input sequence is input into the large model of the improved NASNet network architecture to perform transformation and generate SQL query statements. The improvement of the improved NASNet network architecture lies in the built-in schema conditional convolution structure, which performs gated modulation on the convolution kernel weights. Perform validity checks on the SQL query statement and input the SQL query statement into the large model of the improved NASNet network architecture to generate natural language description information; The consistency of the natural language description information with the natural language query input by the user is checked to obtain the consistency check result; When the consistency check result is consistent, the output SQL query statement matches the user's intent. Figure 1 The consistency check result is inconsistent. When the consistency check result is inconsistent, a risk warning message is output to the user indicating that there is a deviation in the semantics of the query, thus forming a calculation prompt message. The SQL query statement is submitted to the database for execution, the query results are obtained, and the query results and calculation prompts are output as intelligent question answering results.
[0006] Optionally, the construction of the database schema and the configuration of the entity mapping relationship specifically include: Collect the database structure information, which includes table information, field information, and inter-table relationship information; Parse the table information to obtain the table names of each table in the database; Parse the field information corresponding to each table to obtain the set of fields contained in the table, and record the field name and data type of each field in the set of fields; Parse the field constraint information of each field in the field set and record the primary key constraint information, foreign key constraint information, NOT NULL constraint information, and uniqueness constraint information; Parse the relationship information between tables to obtain the source table, source field, target table, and target field, and record the relationship type between the tables; The database schema is constructed based on table information, field information, field constraint information, and inter-table relationship information, and entity mapping relationships are configured.
[0007] Optionally, the formation of the task prompt word sequence specifically includes: The database schema is processed into text to generate schema injection text, which includes table names, field names, and textual descriptions of relationships between tables; The entity mapping relationship is processed into text to generate mapping injection text, which includes a textual description of the correspondence between business entities or semantic entities and table names and field names. Based on the schema-injected text and mapping-injected text, the prompt word information of the large model inference is configured, and the prompt word information is serialized and combined to form a task prompt word sequence.
[0008] Optionally, the formation of the complete system input specifically includes: Receive natural language queries input by the user and preprocess the natural language queries; Obtain the dialogue history information corresponding to the natural language query, the dialogue history information including multi-round interaction records between the user and the system, the interaction records including the aforementioned query and its corresponding system response, and organize them into a historical dialogue data sequence; Obtain system analysis and decision-making process information corresponding to natural language queries. The decision-making process information includes intermediate state information and decision results during the reasoning process. The intermediate state information includes relevant data fragments, field values, and relationships between fields obtained from the database schema. Obtain dialogue summary information corresponding to the natural language query. The dialogue summary information includes key information from previous dialogues and a context summary. The context summary includes domain knowledge, question classification, and processing rules related to the current query. The preprocessed natural language query, historical dialogue information, decision process information, and dialogue summary information are integrated to form a complete system input.
[0009] Optionally, the generation of the SQL query statement specifically includes: The complete system input is serialized and encoded to form a query input sequence. Based on the task prompt word sequence, prompt word injection is performed on the query input sequence to construct the SQL generation input sequence. The SQL-generated input sequence is input into a large model of an improved NASNet network architecture. The improved NASNet network architecture includes a hierarchical network formed by alternating stacks of ordinary units and downsampling units. The improvement of the improved NASNet network architecture is as follows: a schema-conditional convolutional structure is set inside the ordinary unit. The schema-conditional convolutional structure generates a schema conditional vector based on the database schema, and performs gated modulation on the convolutional kernel weights in the ordinary unit according to the schema conditional vector. The SQL-generated input sequence is then convolved using the modulated convolutional kernel weights to obtain the output features of the ordinary unit. The output features of the ordinary unit are then scaled by the downsampling unit to obtain an intermediate feature representation. Based on intermediate feature representation, calculate table selection score and field selection score aligned with database schema to form schema selection constraints; Under schema selection constraints, the intermediate feature representation is constrained and decoded to generate a set of candidate SQL query statements. Beam search is then used to expand and retain the candidates. The beam search process involves calculating the generation probability of the next output tag at each decoding step, expanding to obtain candidate SQL prefix sequences, calculating the cumulative decoding score of the candidate SQL prefix sequences, and retaining a preset number of candidate SQL prefix sequences with the highest cumulative decoding scores at each decoding step to continue expanding until a terminator is generated to obtain the set of candidate SQL query statements. Select the candidate SQL query statement with the highest cumulative decoding score from the set of candidate SQL query statements and output it as the SQL query statement.
[0010] Optionally, the generation of the natural language description information specifically includes: The SQL query statement to be validated is parsed to obtain the parsing result of the SQL query statement to be validated. The parsing result includes statement type, keyword sequence, function call structure, bracket structure and statement terminator information. Based on the statement parsing results, perform syntax verification on the SQL query statement to be verified and output the syntax verification results; During syntax validation, based on the statement parsing results of the SQL query statement to be validated, the set of table identifiers and the set of field identifiers referenced in the SQL query statement to be validated are extracted. Based on the table identifier set, field identifier set, and database schema, perform a structure consistency check on the SQL query statement to be checked, and output the structure consistency check result. Generate a validity check result based on the syntax check result and the structural consistency check result; When the validity check result is passed, the SQL query statement to be checked is constructed into an SQL input sequence according to the preset input format, and the SQL input sequence is input into the large model of the improved NASNet network architecture to generate natural language description information.
[0011] Optionally, obtaining the consistency verification result specifically includes: Perform text normalization processing on the natural language query and natural language description information input by the user to obtain the natural language query text and natural language description text; Text encoding is performed on the natural language query text to obtain the semantic vector representation of the natural language query; text encoding is performed on the natural language description text to obtain the semantic vector representation of the natural language description. Semantic similarity scores are calculated based on the semantic vector representations of natural language queries and natural language descriptions. The semantic similarity score is compared with a preset consistency threshold to obtain a consistency determination result. The comparison process is as follows: when the semantic similarity score is greater than the consistency threshold, the natural language description text is determined to be consistent with the natural language query text; when the semantic similarity score is less than the consistency threshold, the natural language description text is determined to be inconsistent with the natural language query text. The consistency determination result is then output as the consistency verification result.
[0012] Optionally, when the consistency determination result is consistent, the system performs semantic element parsing on the SQL query statement to obtain a set of elements including the query object, filtering conditions, statistical indicators, and calculation methods. The system then fills the fields of the set of elements according to a preset confirmation prompt template to generate a confirmation prompt. When the consistency determination result is inconsistent, the system fills the fields of the set of elements according to a preset risk warning prompt template and adds intent deviation identification information to the prompt to generate a risk warning prompt. The system outputs the confirmation prompt and the risk warning prompt as calculation prompt information.
[0013] Optionally, the output of the intelligent question-and-answer result is to submit the SQL query statement that has passed the validity check to the database for query execution, the database returns the query result, the query result is processed and valid data is extracted, and at the same time, calculation prompt information is combined to generate the final intelligent question-and-answer result, which includes query data, data supplementary explanation, and risk warning.
[0014] According to an embodiment of the present invention, a large-model hallucination suppression intelligent question answering system based on deep learning includes: The database structure acquisition module is used to collect the structure information of the database, parse the table structure, field information and inter-table relationships, build the database schema, and configure entity mapping relationships; The task prompt word configuration module configures prompt word information for large model inference based on the database schema and entity mapping relationship, forming a task prompt word sequence; The system input processing module is used to receive natural language queries input by users and obtain relevant dialogue history information, decision process information and dialogue summary information to form a complete system input; The SQL query generation module is used to extract SQL query statements from system input based on task prompt word sequences and database schema. The SQL validation module is used to perform legality checks on SQL query statements and generate natural language description information. The consistency verification module is used to verify the consistency between the natural language description information and the natural language query input by the user, and generate the consistency verification result. The calculation prompt information generation module is used to generate corresponding calculation prompt information based on the consistency verification results. The query execution and result output module is used to submit SQL query statements to the database for execution, obtain query results, and combine the query results with calculation prompts to generate and output intelligent question-and-answer results.
[0015] The beneficial effects of this invention are: This invention proposes a deep learning-based large-model illusion suppression intelligent question answering system and method. Through technological innovation, it effectively overcomes the "illusion" problem in existing intelligent question answering systems, significantly improving the accuracy and reliability of query results. In existing technologies, many large-model-based question answering systems cannot effectively suppress the "illusion" phenomenon, leading to generated answers that are often inconsistent with the actual data in the database, affecting system reliability and user experience. This invention, by introducing deeply integrated database structure information, including table structure, field information, and inter-table relationships, ensures that the generated SQL query statements strictly follow the actual database structure, effectively avoiding query failures due to structure mismatches or syntax errors.
[0016] Another major improvement of this invention lies in the configuration of the task prompt word sequence. By optimizing the prompt information for large-scale model inference based on the database schema and entity mapping relationships, it ensures that the model can more accurately understand the user's query intent, thereby avoiding the generation of "illusionary" answers. This improvement significantly enhances the system's query understanding capability and avoids erroneous queries or inaccurate answers caused by insufficient model inference ability.
[0017] Furthermore, this invention introduces a consistency verification mechanism. By verifying the consistency between the natural language description information and the natural language query input by the user, it ensures that the generated query results match the user's actual query intent. This consistency verification can automatically identify deviations that occur during the query process, thereby correcting them before the query results are generated, further improving the accuracy and credibility of the answers.
[0018] In summary, this invention overcomes the shortcomings of existing intelligent question-answering systems by comprehensively applying database structure awareness, large model inference optimization, and consistency verification. It significantly improves the accuracy and reliability of the system, especially in scenarios involving complex database queries, and can better avoid the occurrence of "illusion" phenomena, providing higher-quality intelligent question-answering services. Attached Figure Description
[0019] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is an overall flowchart of a large-scale hallucination suppression intelligent question answering system and method based on deep learning proposed in this invention; Figure 2 This is a schematic diagram of the complete system input structure of the large-model hallucination suppression intelligent question answering system and method based on deep learning proposed in this invention; Figure 3 This is a schematic diagram of the SQL query statement structure for a large-model hallucination suppression intelligent question answering system and method based on deep learning proposed in this invention. Detailed Implementation
[0020] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0021] refer to Figures 1-3 A deep learning-based intelligent question answering method for large-scale hallucination suppression includes the following steps: Collect the database structure information, parse the table structure, field information and inter-table relationships in the database, construct the database schema, and configure entity mapping relationships based on the database schema; Based on the database schema and entity mapping relationship, configure prompt word information for large model inference to form a task prompt word sequence; The system receives natural language queries input by the user and obtains dialogue history information, system analysis and decision-making process information, and dialogue summary information corresponding to the natural language query to form a complete system input. By using the task prompt word sequence, an SQL generation input sequence is constructed from the complete system input, and the SQL generation input sequence is input into the large model of the improved NASNet network architecture to perform transformation and generate SQL query statements. The improvement of the improved NASNet network architecture lies in the built-in schema conditional convolution structure, which performs gated modulation on the convolution kernel weights. Perform validity checks on the SQL query statement and input the SQL query statement into the large model of the improved NASNet network architecture to generate natural language description information; The consistency of the natural language description information with the natural language query input by the user is checked to obtain the consistency check result; When the consistency check result is consistent, the output SQL query statement matches the user's intent. Figure 1 The consistency check result is inconsistent. When the consistency check result is inconsistent, a risk warning message is output to the user indicating that there is a deviation in the semantics of the query, thus forming a calculation prompt message. The SQL query statement is submitted to the database for execution, the query results are obtained, and the query results and calculation prompts are output as intelligent question answering results.
[0022] In this embodiment, the construction of the database schema and the configuration of the entity mapping relationship specifically include: Collect the database structure information, which includes table information, field information, and inter-table relationship information; Parse the table information to obtain the table names of each table in the database; The parsing process is as follows: the system obtains a list of all tables in the database by calling the metadata query interface built into the database system; the returned results are parsed to read the field values representing the table names, and the table names are uniquely identified by combining the schema name and the database name; Parse the field information corresponding to each table to obtain the set of fields contained in the table, and record the field name and data type of each field in the set of fields; The parsing process is as follows: the system reads the field names, data types and related descriptions of all fields in the target table by calling the metadata interface provided by the database; the field information is standardized, and the data types of fields in different database types are mapped to a unified type identifier; the system records the parsed field names and data types in a structured form to form a field set. Parse the field constraint information of each field in the field set and record the primary key constraint information, foreign key constraint information, NOT NULL constraint information, and uniqueness constraint information; The parsing process specifically involves: obtaining the table to which a field belongs, the field name, data type, and constraint identifier by accessing the database's system directory; performing structured parsing of the constraint definitions: recording primary key constraint information when a field appears in a primary key index or primary key constraint; recording foreign key constraint information and simultaneously recording the referenced table, referenced field, and association relationship when a field is defined as a required attribute in its field definition; and recording unique constraint information when a field has a unique index or unique constraint. The system then writes the parsed primary keys, foreign keys, non-null constraints, and unique constraints into the schema in a structured manner. Parse the relationship information between tables to obtain the source table, source field, target table, and target field, and record the relationship type between the tables; The parsing process is as follows: The system reads the inter-table relationship information from the database, which may originate from the database metadata. The system performs structured parsing on the inter-table relationship information: For each inter-table relationship, it extracts the name of the source table and the name of the source field, and further extracts the name of the target table and the name of the target field that establishes the relationship with it; the source field and the target field usually correspond to foreign key fields and primary key fields or unique key fields. The system determines and records the relationship type of the inter-table relationship based on relationship constraints or association rules; when there is an intermediate related table, the system identifies it as a many-to-many relationship and records the connection path of the intermediate table. The system stores the parsed source table, source field, target table, target field, and relationship type in a structured form in the database schema. The database schema is constructed based on table information, field information, field constraint information, and inter-table relationship information, and entity mapping relationships are configured. The configuration of the entity mapping relationship specifically involves: establishing a correspondence between semantic entities and table names and field names in the database schema to form a mapping relationship between entities and tables and between entities and fields, and storing the mapping relationship in the form of a dictionary table or a mapping file.
[0023] In this embodiment, the formation of the task prompt word sequence specifically includes: The database schema is processed into text to generate schema injection text, which includes table names, field names, and textual descriptions of relationships between tables; The entity mapping relationship is processed into text to generate mapping injection text, which includes a textual description of the correspondence between business entities or semantic entities and table names and field names. Based on the schema injection text and mapping injection text, the prompt word information for large model inference is configured. The prompt word information includes task instruction text, schema injection text, mapping injection text and generation constraint text. The prompt word information is serialized and combined to form a task prompt word sequence. The formation process involves the system embedding the schema-injected text and mapping-injected text into a context based on a preset inference prompt word template. Specifically, a task instruction segment is configured at the beginning of the sequence of the inference prompt word template to define the model's inference task as the conversion from natural language query to structured query language. Schema-injected text and mapping-injected text are sequentially inserted in the middle of the inference prompt word template. A generation rule segment and a constraint prompt segment are configured at the end of the inference prompt word template to limit the model output to meet preset SQL syntax rules and schema consistency constraints. The task instruction segment, schema injection segment, mapping injection segment, and constraint rule segment are concatenated to obtain prompt word information, and then serialized and combined to form a structured task prompt word sequence. The serialization and combination involves linearly concatenating the task instruction segment, schema injection segment, mapping injection segment, and constraint rule segment sequentially, and then uniformly formatting and encoding the concatenated text sequence.
[0024] In this embodiment, the formation of the complete system input specifically includes: The system receives natural language queries input by users and preprocesses the queries, including stop word removal, lexical reconstruction, word segmentation, and syntactic analysis, to generate standardized query text. Obtain the dialogue history information corresponding to the natural language query, the dialogue history information including multi-round interaction records between the user and the system, the interaction records including the aforementioned query and its corresponding system response, and organize them into a historical dialogue data sequence; Obtain system analysis and decision-making process information corresponding to natural language queries. The decision-making process information includes intermediate state information and decision results during the reasoning process. The intermediate state information includes relevant data fragments, field values, and relationships between fields obtained from the database schema. Obtain dialogue summary information corresponding to the natural language query. The dialogue summary information includes key information from previous dialogues and a context summary. The context summary includes domain knowledge, question classification, and processing rules related to the current query. The preprocessed natural language query, historical dialogue information, decision process information, and dialogue summary information are integrated to form a complete system input.
[0025] In this embodiment, the generation of the SQL query statement specifically includes: The complete system input is serialized and encoded to form a query input sequence. Based on the task prompt word sequence, prompt word injection is performed on the query input sequence to construct the SQL generation input sequence. The specific serialization encoding process is as follows: the system performs unified text normalization processing on the natural language query text, dialogue history information, decision process information, and dialogue summary information in the complete system input, and organizes them into a serialized format according to a preset input format, concatenating each part of the text sequentially to form a continuous input sequence; the input sequence is segmented and tokenized, converting the text into a word sequence, and the word sequence is mapped into a vector representation through an embedding encoding layer to obtain the query input sequence; The SQL-generated input sequence is input into a large model of an improved NASNet network architecture. The improved NASNet network architecture includes a hierarchical network formed by alternating stacks of ordinary units and downsampling units. The improvement of the improved NASNet network architecture is as follows: a schema-conditional convolutional structure is set inside the ordinary unit. The schema-conditional convolutional structure generates a schema conditional vector based on the database schema, and performs gated modulation on the convolutional kernel weights in the ordinary unit according to the schema conditional vector. The SQL-generated input sequence is then convolved using the modulated convolutional kernel weights to obtain the output features of the ordinary unit. The output features of the ordinary unit are then scaled by the downsampling unit to obtain an intermediate feature representation. The convolution operation is as follows: the input tags arranged sequentially in the SQL-generated input sequence are mapped to vector representations and formed into a one-dimensional feature sequence. A convolution window of preset length is set on the one-dimensional feature sequence of a regular unit, and it slides along the input tag sequence direction according to a preset stride. At each window position, the continuous vector segment covered by the convolution window is extracted as a local input feature. The convolution kernel weights are gated and modulated according to the schema condition vector to obtain modulated convolution kernel weights. The modulated convolution kernel weights are then multiplied and added element-wise with the local input features to obtain the convolution output value at the window position. The convolution output values obtained at each position of the convolution window are concatenated to form a convolution output sequence, and the convolution output sequence is subjected to nonlinear activation and normalization processing to obtain the output features of the regular unit. Based on intermediate feature representation, calculate table selection score and field selection score aligned with database schema to form schema selection constraints; The calculation process is as follows: The system performs similarity calculations between the intermediate feature representation and the table identifier embedding set and field identifier embedding set in the database schema, respectively. For each table identifier embedding, the system calculates the corresponding table matching score, and for each field identifier embedding, the system calculates the corresponding field matching score. The system then normalizes the table matching score set and the field matching score set to obtain the table selection score and the field selection score. Based on the table selection score, the system determines the range of table names that can be referenced in the candidate SQL query statement, and based on the field selection score, it determines the range of field names that can be referenced in the candidate SQL query statement, thus forming a schema selection constraint. Under schema selection constraints, the intermediate feature representation is constrained and decoded to generate a set of candidate SQL query statements. Beam search is then used to expand and retain the candidates. The beam search process involves calculating the generation probability of the next output tag at each decoding step, expanding to obtain candidate SQL prefix sequences, calculating the cumulative decoding score of the candidate SQL prefix sequences, and retaining a preset number of candidate SQL prefix sequences with the highest cumulative decoding scores at each decoding step to continue expanding until a terminator is generated to obtain the set of candidate SQL query statements. Select the candidate SQL query statement with the highest cumulative decoding score from the set of candidate SQL query statements and output it as the SQL query statement.
[0026] In this embodiment, the generation of the natural language description information specifically includes: The SQL query statement to be validated is parsed to obtain the parsing result of the SQL query statement to be validated. The parsing result includes statement type, keyword sequence, function call structure, bracket structure and statement terminator information. Based on the results of statement parsing, perform syntax validation on the SQL query statement to be validated; The syntax verification includes: verifying whether the keyword sequence meets the preset SQL syntax rules, verifying whether the bracket structure matches, verifying whether the function call format conforms to the preset function call rules, and verifying whether the statement terminator conforms to the preset terminator rules, and outputting the syntax verification results; During syntax validation, based on the statement parsing results of the SQL query statement to be validated, the set of table identifiers and the set of field identifiers referenced in the SQL query statement to be validated are extracted. Based on the table identifier set, field identifier set, and database schema, perform structural consistency verification on the SQL query statement to be verified. The structure consistency verification includes: determining whether each table identifier in the table identifier set exists in the table set of the database schema, determining whether each field identifier in the field identifier set exists in the field set of the database schema, and matching and verifying the inter-table connection relationship involved in the SQL query statement to be verified with the inter-table relationship information, and outputting the structure consistency verification result. Generate a validity check result based on the syntax check result and the structural consistency check result; The validity check result includes a valid validity check result that is valid only when the syntax check result is valid and the structural consistency check result is valid, and a valid validity check result that is invalid when the syntax check result is invalid or the structural consistency check result is invalid. When the validity check result is passed, the SQL query statement to be checked is constructed into an SQL input sequence according to the preset input format, and the SQL input sequence is input into the large model of the improved NASNet network architecture to generate natural language description information; The generation process is as follows: The system constructs an SQL input sequence from the valid SQL query statement according to a preset input format, and performs word segmentation and tokenization processing on the SQL input sequence, mapping SQL keywords, table identifiers, field identifiers, and conditional expressions into vector representations; subsequently, the SQL input sequence is input into a large model with an improved NASNet network architecture for natural language generation. The improved NASNet network architecture includes a hierarchical network formed by alternating stacks of ordinary units and downsampling units. The ordinary units are equipped with schema-conditional convolutional structures, generating schema conditional vectors based on the database schema and gating the convolutional kernel weights to perform convolutional feature extraction on the SQL input sequence, obtaining intermediate feature representations of SQL semantics; based on this, the system calculates table selection scores and field selection scores aligned with the database schema based on the intermediate feature representations, forming schema selection constraints, and uses beam search to perform constraint decoding under the schema selection constraints to generate a natural language output sequence. The natural language output sequence is then de-tokenized to obtain the corresponding natural language description information.
[0027] In this embodiment, obtaining the consistency verification result specifically includes: The natural language query and natural language description information input by the user are subjected to text normalization processing, which includes unifying spaces, punctuation marks and capitalization, to obtain natural language query text and natural language description text. Text encoding is performed on the natural language query text to obtain the semantic vector representation of the natural language query; text encoding is performed on the natural language description text to obtain the semantic vector representation of the natural language description. Semantic similarity scores are calculated based on the semantic vector representations of natural language queries and natural language descriptions. The semantic similarity score is compared with a preset consistency threshold to obtain a consistency determination result. The comparison process is as follows: when the semantic similarity score is greater than the consistency threshold, the natural language description text is determined to be consistent with the natural language query text; when the semantic similarity score is less than the consistency threshold, the natural language description text is determined to be inconsistent with the natural language query text. The consistency determination result is then output as the consistency verification result.
[0028] In this embodiment, when the consistency determination result is consistent, the system performs semantic element parsing on the SQL query statement to obtain an element set containing query objects, filtering conditions, statistical indicators, and calculation methods. The system then fills the fields of the element set according to a preset confirmation prompt template to generate a confirmation prompt. When the consistency determination result is inconsistent, the system fills the fields of the element set according to a preset risk warning prompt template and adds intent deviation identification information to the prompt to generate a risk warning prompt. The system outputs the confirmation prompt and the risk warning prompt as calculation prompt information.
[0029] In this embodiment, the output of the intelligent question-and-answer result is achieved by submitting the SQL query statement that has passed the validity check to the database for query execution, the database returning the query result, processing the query result and extracting valid data, and combining the result with calculation prompts to generate the final intelligent question-and-answer result. The intelligent question-and-answer result includes query data, supplementary data explanations, and risk warnings.
[0030] A deep learning-based intelligent question-answering system for large-scale hallucination suppression includes: The database structure acquisition module is used to collect the structure information of the database, parse the table structure, field information and inter-table relationships, build the database schema, and configure entity mapping relationships; The task prompt word configuration module configures prompt word information for large model inference based on the database schema and entity mapping relationship, forming a task prompt word sequence; The system input processing module is used to receive natural language queries input by users and obtain relevant dialogue history information, decision process information and dialogue summary information to form a complete system input; The SQL query generation module is used to extract SQL query statements from system input based on task prompt word sequences and database schema. The SQL validation module is used to perform legality checks on SQL query statements and generate natural language description information. The consistency verification module is used to verify the consistency between the natural language description information and the natural language query input by the user, and generate the consistency verification result. The calculation prompt information generation module is used to generate corresponding calculation prompt information based on the consistency verification results. The query execution and result output module is used to submit SQL query statements to the database for execution, obtain query results, and combine the query results with calculation prompts to generate and output intelligent question-and-answer results.
[0031] Example 1: Taking the intelligent customer service system of a certain e-commerce platform as an example, the platform maintains a business database for customer service inquiries. This database includes at least a product table, an inventory table, and a price table, with relationships established through product IDs. The product table records basic product attribute information, such as fields including: product ID (product_id), brand (brand), model (model), category (category), and specification (spec). The inventory table records inventory information, such as fields including: product ID (product_id), stock quantity (stock_qty), and warehouse region (warehouse_region). The price table records price information, such as fields including: product ID (product_id), selling price (sale_price), promotional price (promo_price), and effective time (effective_time). When the customer service system is deployed online, the above table structure and inter-table relationships are parsed to form a database schema. At the same time, entity mapping relationships are constructed based on historical question and answer corpora and business terminology. For example, "inventory / remaining stock / spot stock / are in stock" is mapped to the stock quantity field stock_qty, "price / how much / selling price" is mapped to sale_price, and "a certain brand of mobile phone" is mapped to the brand field and the optional category field of the product table. This allows the subsequent model to prioritize the tables and fields corresponding to the user's intent when generating query statements.
[0032] During operation, when a user enters a natural language query in the customer service window, "Are there any X brand mobile phones still in stock?", the system first organizes the question with the current conversation context: if the brand name, model, or specifications have appeared in the conversation before, it extracts key information related to the current question from the conversation history and summarizes it into a conversation summary; at the same time, it writes intermediate information used by the system for reasoning into a decision-making process fragment. Subsequently, the system concatenates "user's current question text + relevant conversation history fragments + decision-making process fragments + conversation summary" according to a preset template to form a complete system input, and concatenates the database schema text and entity mapping text in sequence to form a task prompt word sequence, which serves as the constraint input for this round of SQL generation.
[0033] The system serializes and encodes the natural language portion of the complete system input to obtain the query input sequence, and performs structured encoding on the tables, fields, and relationships between tables in the database schema to obtain the database structure representation. Then, the query input sequence, the database structure representation, and the task prompt word sequence are input together into a large model with an improved NASNet network architecture. The model first concatenates the query input sequence and the prompt word sequence in the structure-aware feature encoding module to form a contextual feature representation, and performs structured encoding on the database structure representation to obtain a structural feature representation. Then, the two types of features are fused to obtain a structure-aware intermediate feature representation. Next, in the adaptive feature selection and path search module, multiple candidate feature paths are constructed for this structure-aware intermediate feature representation. Different path branches are scored, and path selection weights are obtained using Gumbel-Softmax. The outputs of the path branches are then weighted and fused to form a path fusion feature. Finally, in the structured query generation module, a semantic representation aligned with the database schema is generated based on the path fusion feature, and constrained decoding is performed using beam search under schema constraints and SQL syntax constraints to output the SQL query statement. To address the above issues, in one embodiment, the SQL query statement generated by the model can be: SELECT i.stock_qty FROM product p JOIN inventory i ON p.product_id = i.product_id WHERE p.brand = 'a certain brand' AND p.category = 'mobile phone'; The system performs a validity check on the SQL statement. Specifically, the system parses the SQL to obtain the keyword sequence, JOIN structure, WHERE conditions, and field reference set. First, it performs syntax validation to confirm the completeness of the statement structure and the validity of the keyword order and bracket structure. Then, it performs schema consistency validation to confirm the existence of tables such as `product` and `inventory`, and the existence of fields `product_id`, `brand`, `category`, and `stock_qty`. It also confirms that the foreign key relationships in the JOIN conditions are consistent with the relationships defined in the schema. If the validation passes, the SQL statement is packaged into an SQL input sequence according to a preset format to proceed to the subsequent SQL2NL stage. If the validation fails, a regeneration or rollback strategy is triggered.
[0034] The system inputs the SQL input sequence to the structured language to natural language conversion module, generating natural language description information to express the actual meaning of the SQL query. In one embodiment, the generated natural language description information could be: "Query for products with brand name 'a certain brand' and category 'mobile phone', and return their inventory quantity in the inventory table." The system then normalizes the user's original query and the natural language description information into semantic vectors, calculates their semantic similarity score, and compares it with a preset consistency threshold to obtain a consistency verification result: if the similarity score is not lower than the threshold, it is determined to be consistent; otherwise, it is determined to be inconsistent.
[0035] Based on the consistency check results, the system generates calculation prompts and outputs them to the user along with the database query results. When the consistency check results are consistent, the system generates a first calculation prompt, which includes at least a "description of the query criteria." This prompt can directly use or rewrite the natural language description generated by the SQL query, for example: "The criteria for this result: filtered by brand = [brand name], category = mobile phone, and the inventory quantity is returned." The system can also add a consistency judgment identifier and a result confidence range calculated based on the similarity score and SQL decoding confidence level to the prompt, providing quantifiable information.
[0036] When the consistency check result is inconsistent, the system generates a second calculation prompt. This second prompt also includes a "description of the query scope" and additional risk warning information, such as: "Consistency check conclusion: inconsistent; the current result corresponds to the query scope of..., which may differ from the question description. Please confirm whether you need to add conditions such as model / specification / warehouse area / time range." In this case, the system can also generate field missing risk information based on the field reference set and entity mapping coverage. For example, if the user's original question contains "now" and the price table has an effective_time field but the SQL does not include time filtering, it will prompt "May be missing time range conditions"; if the user's question contains "promotional price" and the SQL selects sale_price, it will prompt "May be missing promotional price field selection." These prompts, together with the SQL query results, constitute the final question and answer output of the customer service system.
[0037] During the database execution phase, the system submits a valid SQL query to the database. After the database returns the query results, including inventory quantity, the customer service system combines the query results with calculation prompts to display to the user. For example, when the query returns stock_qty=25, the system outputs "Inventory Quantity: 25" and simultaneously displays the calculation prompt: "This result corresponds to the following criteria: Brand = [Brand Name], Category = Mobile Phone, returning inventory quantity; Consistency determination: Consistent; Credibility: High." If the consistency determination is inconsistent, the system outputs a corresponding risk warning and prompts the user to supplement the conditions and query again.
[0038] To verify the effectiveness of this invention, a comparative test can be conducted using the same dataset and user question set. This test compares the traditional system that relies solely on a large model to directly generate answers or directly generate and execute SQL with the system of this invention, which incorporates "legality verification + SQL consistency verification + calculation prompts." The SQL executability rate and the consistency between the SQL and user intent are statistically analyzed. Figure 1 The results of the experiment, including metrics such as consistency rate and user satisfaction, are shown in Table 1.
[0039] Table 1 Comparison of experimental results for deep learning-based large-model hallucination suppression intelligent question answering methods As shown in Table 1, the query accuracy of traditional intelligent question-answering systems is 82%, while the query accuracy of the intelligent question-answering system based on this invention is improved to 98%. This indicates that this invention, through structure-aware feature encoding, task prompt word sequence generation, and consistency verification mechanism, effectively improves the system's ability to obtain and generate accurate answers from the database, avoiding erroneous query results caused by hallucination phenomena.
[0040] In terms of syntax error rate, the traditional intelligent question-answering system has a syntax error rate of 12%, while the system based on this invention reduces the syntax error rate to 2%. This is because this invention introduces database structure awareness and legality verification during the SQL generation process, ensuring that the generated SQL query statements conform to the syntax and structure requirements of the database, thereby reducing query statement errors.
[0041] In terms of consistency verification failure rate, traditional systems have a 15% failure rate during the consistency verification process, while the failure rate of the system of this invention is reduced to 2%. By introducing consistency verification when generating natural language description information, this invention can effectively avoid generating answers that are inconsistent with user queries, thereby improving the reliability of queries.
[0042] In terms of user satisfaction, the satisfaction rate increased from 75% in the traditional system to 95% in the system of this invention. This improvement indicates that users have greater trust in the accuracy and reliability of the query results, especially when the query results match expectations, resulting in a significant improvement in user experience.
[0043] Although the present invention introduces a more complex structure awareness and consistency verification mechanism, the response time is only 0.2 seconds faster than the traditional system. This indicates that the system of the present invention does not have a significant impact on the response time in terms of performance. In summary, the intelligent question answering system based on the present invention not only improves the accuracy and consistency of queries, but also maintains a good response time, and has broad application prospects.
Claims
1. A deep learning-based intelligent question-answering method for large-scale hallucination suppression, characterized in that, Includes the following steps: Collect the database structure information, parse the table structure, field information and inter-table relationships in the database, construct the database schema, and configure entity mapping relationships based on the database schema; Based on the database schema and entity mapping relationship, configure prompt word information for large model inference to form a task prompt word sequence; The system receives natural language queries input by the user and obtains dialogue history information, system analysis and decision-making process information, and dialogue summary information corresponding to the natural language query to form a complete system input. By using the task prompt word sequence, an SQL generation input sequence is constructed from the complete system input, and the SQL generation input sequence is input into the large model of the improved NASNet network architecture to perform transformation and generate SQL query statements. The improvement of the improved NASNet network architecture lies in the built-in schema conditional convolution structure, which performs gated modulation on the convolution kernel weights. Perform validity checks on the SQL query statement and input the SQL query statement into the large model of the improved NASNet network architecture to generate natural language description information; The consistency of the natural language description information with the natural language query input by the user is checked to obtain the consistency check result; When the consistency check result is consistent, a confirmation message is output that the SQL query statement is consistent with the user's intent. When the consistency check result is inconsistent, a risk warning message is output to the user indicating that there is a deviation in the semantics of the query, thus forming a calculation prompt message. The SQL query statement is submitted to the database for execution, the query results are obtained, and the query results and calculation prompts are output as intelligent question answering results.
2. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The construction of the database schema and the configuration of entity mapping relationships specifically include: Collect the database structure information, which includes table information, field information, and inter-table relationship information; Parse the table information to obtain the table names of each table in the database; Parse the field information corresponding to each table to obtain the set of fields contained in the table, and record the field name and data type of each field in the set of fields; Parse the field constraint information of each field in the field set and record the primary key constraint information, foreign key constraint information, NOT NULL constraint information, and uniqueness constraint information; Parse the relationship information between tables to obtain the source table, source field, target table, and target field, and record the relationship type between the tables; The database schema is constructed based on table information, field information, field constraint information, and inter-table relationship information, and entity mapping relationships are configured.
3. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The formation of the task prompt word sequence specifically includes: The database schema is processed into text to generate schema injection text, which includes table names, field names, and textual descriptions of relationships between tables; The entity mapping relationship is processed into text to generate mapping injection text, which includes a textual description of the correspondence between business entities or semantic entities and table names and field names. Based on the schema-injected text and mapping-injected text, the prompt word information of the large model inference is configured, and the prompt word information is serialized and combined to form a task prompt word sequence.
4. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The formation of the complete system input specifically includes: Receive natural language queries input by the user and preprocess the natural language queries; Obtain the dialogue history information corresponding to the natural language query, the dialogue history information including multi-round interaction records between the user and the system, the interaction records including the aforementioned query and its corresponding system response, and organize them into a historical dialogue data sequence; Obtain system analysis and decision-making process information corresponding to natural language queries. The decision-making process information includes intermediate state information and decision results during the reasoning process. The intermediate state information includes relevant data fragments, field values, and relationships between fields obtained from the database schema. Obtain dialogue summary information corresponding to the natural language query. The dialogue summary information includes key information from previous dialogues and a context summary. The context summary includes domain knowledge, question classification, and processing rules related to the current query. The preprocessed natural language query, historical dialogue information, decision process information, and dialogue summary information are integrated to form a complete system input.
5. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The generation of the SQL query statement specifically includes: The complete system input is serialized and encoded to form a query input sequence. Based on the task prompt word sequence, prompt word injection is performed on the query input sequence to construct the SQL generation input sequence. The SQL-generated input sequence is input into a large model of an improved NASNet network architecture. The improved NASNet network architecture includes a hierarchical network formed by alternating stacks of ordinary units and downsampling units. The improvement of the improved NASNet network architecture is as follows: a schema-conditional convolutional structure is set inside the ordinary unit. The schema-conditional convolutional structure generates a schema conditional vector based on the database schema, and performs gated modulation on the convolutional kernel weights in the ordinary unit according to the schema conditional vector. The SQL-generated input sequence is then convolved using the modulated convolutional kernel weights to obtain the output features of the ordinary unit. The output features of the ordinary unit are then scaled by the downsampling unit to obtain an intermediate feature representation. Based on intermediate feature representation, calculate table selection score and field selection score aligned with database schema to form schema selection constraints; Under schema selection constraints, the intermediate feature representation is constrained and decoded to generate a set of candidate SQL query statements. Beam search is then used to expand and retain the candidates. The beam search process involves calculating the generation probability of the next output tag at each decoding step, expanding to obtain candidate SQL prefix sequences, calculating the cumulative decoding score of the candidate SQL prefix sequences, and retaining a preset number of candidate SQL prefix sequences with the highest cumulative decoding scores at each decoding step to continue expanding until a terminator is generated to obtain the set of candidate SQL query statements. Select the candidate SQL query statement with the highest cumulative decoding score from the set of candidate SQL query statements and output it as the SQL query statement.
6. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The generation of the natural language description information specifically includes: The SQL query statement to be validated is parsed to obtain the parsing result of the SQL query statement to be validated. The parsing result includes statement type, keyword sequence, function call structure, bracket structure and statement terminator information. Based on the statement parsing results, perform syntax verification on the SQL query statement to be verified and output the syntax verification results; During syntax validation, based on the statement parsing results of the SQL query statement to be validated, the set of table identifiers and the set of field identifiers referenced in the SQL query statement to be validated are extracted. Based on the table identifier set, field identifier set, and database schema, perform a structure consistency check on the SQL query statement to be checked, and output the structure consistency check result. Generate a validity check result based on the syntax check result and the structural consistency check result; When the validity check result is passed, the SQL query statement to be checked is constructed into an SQL input sequence according to the preset input format, and the SQL input sequence is input into the large model of the improved NASNet network architecture to generate natural language description information.
7. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The specific steps to obtain the consistency verification result include: Perform text normalization processing on the natural language query and natural language description information input by the user to obtain the natural language query text and natural language description text; Text encoding is performed on the natural language query text to obtain the semantic vector representation of the natural language query; text encoding is performed on the natural language description text to obtain the semantic vector representation of the natural language description. Semantic similarity scores are calculated based on the semantic vector representations of natural language queries and natural language descriptions. The semantic similarity score is compared with a preset consistency threshold to obtain a consistency determination result. The comparison process is as follows: when the semantic similarity score is greater than the consistency threshold, the natural language description text is determined to be consistent with the natural language query text; when the semantic similarity score is less than the consistency threshold, the natural language description text is determined to be inconsistent with the natural language query text. The consistency determination result is then output as the consistency verification result.
8. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, When the consistency determination result is consistent, the system performs semantic element parsing on the SQL query statement to obtain a set of elements including the query object, filtering conditions, statistical indicators, and calculation methods. The system then fills the fields of the set of elements according to a preset confirmation prompt template to generate a confirmation prompt. When the consistency determination result is inconsistent, the system fills the fields of the set of elements according to a preset risk warning prompt template and adds intent deviation identification information to the prompt to generate a risk warning prompt. The system outputs the confirmation prompt and the risk warning prompt as calculation prompt information.
9. The intelligent question-answering method for large-scale hallucination suppression based on deep learning according to claim 1, characterized in that, The intelligent question-and-answer result is generated by submitting a valid SQL query statement to the database for execution, the database returning the query result, processing the query result and extracting valid data, and combining the result with calculation prompts to generate the final intelligent question-and-answer result. The intelligent question-and-answer result includes query data, supplementary data explanations, and risk warnings.
10. A deep learning-based intelligent question-answering system for suppressing large-model hallucinations, comprising executing the deep learning-based intelligent question-answering method for suppressing large-model hallucinations as described in any one of claims 1 to 9, characterized in that, include: The database structure acquisition module is used to collect the structure information of the database, parse the table structure, field information and inter-table relationships, build the database schema, and configure entity mapping relationships; The task prompt word configuration module configures prompt word information for large model inference based on the database schema and entity mapping relationship, forming a task prompt word sequence; The system input processing module is used to receive natural language queries input by users and obtain relevant dialogue history information, decision process information and dialogue summary information to form a complete system input; The SQL query generation module is used to extract SQL query statements from system input based on task prompt word sequences and database schema. The SQL validation module is used to perform legality checks on SQL query statements and generate natural language description information. The consistency verification module is used to verify the consistency between the natural language description information and the natural language query input by the user, and generate the consistency verification result. The calculation prompt information generation module is used to generate corresponding calculation prompt information based on the consistency verification results. The query execution and result output module is used to submit SQL query statements to the database for execution, obtain query results, and combine the query results with calculation prompts to generate and output intelligent question-and-answer results.
Citation Information
Patent Citations
Ultrahigh-voltage line forest fire early warning method and device based on two-stage confirmation large model, computer equipment and medium
CN120374912A
Power field Text2SQL intelligent generation method based on prompt enhancement and progressive optimization
CN120407604A
Intelligent question-answering system optimization method and device based on knowledge graph
CN120804142A
Power plant operation and maintenance knowledge intelligent query method based on large language model and RAG technology
CN121029784A
Business database natural language question and answer processing method fused with large model technology
CN121350201A
Cited By
Anti-illusion NL2SQL method and device based on agent framework, equipment and medium
CN122086923A