Query statement splitting method and device, equipment, medium and product
By splitting the text to be queried into a natural sub-problem set, the difficulty of understanding of large language models when processing complex queries is solved, and the accurate understanding of user query intentions and semantics is achieved, and the system's processing ability and the accuracy of query answers is improved.
Patent Information
- Application Number
- CN202411941013.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-28
Smart Images

Figure CN119719325A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a query statement splitting method, device, equipment, medium and product. Background Art
[0002] The Retrieval-Augmented Generation (RAG) system based on the Knowledge Graph (KG) is a natural language processing technology that combines retrieval and generation. It aims to reduce the illusion of large language models and improve the quality of generation by retrieving information from relevant knowledge graphs. In the retrieval stage, the RAG system needs to fully understand the user's query in natural language and convert it into an executable database query statement. Natural language queries are usually more complex and uncertain because they contain rich semantics and diverse expressions.
[0003] In order to solve the above problems, the existing technology usually performs entity recognition and topic pruning on the user's natural language query input through Think on Graph (ToG). In the process of gradually solving the query problem, the user's input problem is regarded as a whole, and the content with reasoning value is gradually locked, and the accuracy of the reasoning path is ensured.
[0004] However, when performing key operations on knowledge graphs, such as topic pruning and relationship pruning, ToG 2.0 mainly relies on the intrinsic knowledge base of a large language model rather than the actual semantic connection between entities and nodes. This limits the system's ability to handle complex queries to a certain extent. Summary of the invention
[0005] The present invention provides a query statement splitting method, device, equipment, medium and product to accurately understand the intention and semantics of user queries.
[0006] According to a first aspect of the present invention, a query statement splitting method is provided, comprising:
[0007] Obtain the text to be queried, pre-built prompt projects, and knowledge graphs based on graph databases;
[0008] Inputting the text to be queried into a large language model;
[0009] The large language model is used to split the text to be queried into a natural sub-question set based on the prompt project and the knowledge graph in a primitive interpretation manner to obtain an output result of the large language model.
[0010] According to a second aspect of the present invention, there is provided a query statement splitting device, comprising:
[0011] Information acquisition module, used to obtain the text to be queried, pre-built prompt projects, and knowledge graphs based on graph databases;
[0012] A sentence input module, used for inputting the text to be queried into a large language model;
[0013] A result determination module is used to split the text to be queried into a set of natural sub-questions in a primitive interpretation manner through the large language model based on the prompt project and the knowledge graph to obtain the output result of the large language model.
[0014] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the query statement splitting method described in any embodiment of the present invention.
[0018] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the query statement splitting method described in any embodiment of the present invention when executed.
[0019] According to a fifth aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the query statement splitting method of any embodiment of the present invention is implemented.
[0020] The technical solution of the embodiment of the present invention is to obtain the text to be queried, the pre-constructed prompt project and the knowledge graph based on the graph database; input the text to be queried into the large language model; and split the text to be queried into a set of natural sub-problems in a primitive interpretation manner based on the prompt project and the knowledge graph by the large language model to obtain the output result of the large language model. By defining the primitive pre-constructed prompt project, the large prediction model is guided to first convert the primitive into a natural language interpretation, and the complex problem corresponding to the text to be queried is broken down into sub-problems by the primitive interpretation. The problem of the difficulty of the large language model in understanding the primitive is solved, and the accurate understanding of the intention and semantics of the user's query is achieved to ensure the accuracy of the splitting of the query text problem, thereby providing a basis for the subsequent generation of accurate query answers.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 is a flowchart of a query statement splitting method provided according to Embodiment 1 of the present invention;
[0024] Figure 2 This is an example flow chart of a query statement splitting method provided according to Embodiment 1 of the present invention;
[0025] Figure 3 is a structural diagram of a query statement device provided according to Embodiment 2 of the present invention;
[0026] Figure 4 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment 1
[0030] Figure 1 A flowchart of a query statement splitting method is provided for the first embodiment of the present invention. This embodiment is applicable to the problem splitting of the query text. The method can be executed by a query statement splitting device. The query statement splitting device can be implemented in the form of hardware and / or software. The query statement splitting device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0031] S110, obtaining the text to be queried, the pre-built prompt project, and the knowledge graph based on the graph database.
[0032] In this embodiment, the text to be queried can be understood as the question to be queried input by the user. The prompt engineering can be understood as guiding the large language model to generate a specific output result.
[0033] In this embodiment, the knowledge graph is a structured semantic knowledge base that stores information related to real-world entities (such as people, places, organizations, etc.) and various relationships between entities in the form of a graph. The basic structure of the knowledge graph is a graph, in which nodes represent entities and edges represent relationships between entities. An entity is the basic unit in the knowledge graph, representing a specific object or concept in the real world; an entity can have attributes, which are data that describe the characteristics of an entity. Relationships describe various connections between entities and can be unidirectional or bidirectional. Knowledge graphs are widely used in search engines, recommendation systems, natural language processing, intelligent question and answer, and other fields. As a database with a graph as its basic structure, its core advantage is that it can represent and process complex relational data in an intuitive and flexible way, providing strong data support for various intelligent applications.
[0034] In this embodiment, the graph database is a database that uses a graph structure for semantic query. It represents and stores data through nodes, edges, and attributes. The main function of the graph database is to manage graph data, support efficient node and edge query and update, and usually add support for transactions to ensure normal operation under concurrent operations. The knowledge graph query language is a language used to query and operate the knowledge graph. The mainstream graph database query languages include Cypher, Gremlin, and SPARQL. The graph database can be used as the underlying storage and query engine of the knowledge graph, providing high-performance storage and query functions for the knowledge graph.
[0035] Specifically, the processor can obtain the query text input by the user, as well as the prompt project constructed to understand the intention contained in the query text. The processor can also obtain the user's knowledge graph based on the graph database.
[0036] S120: Input the text to be queried into the large language model.
[0037] In this embodiment, the large language model can be understood as an artificial intelligence technology based on deep learning.
[0038] Specifically, the processor may take the text to be queried as input and input it into the large language model.
[0039] S130. Split the query text into natural sub-question sets in a primitive language interpretation manner based on the prompt engineering and knowledge graph through the large language model to obtain the output result of the large language model.
[0040] In this embodiment, the primitive interpretation method can be understood as a method of converting between the primitive and the natural language. The natural sub-problem set can be understood as a set of sub-problems in the form of multiple natural languages.
[0041] Specifically, the processor can use the large language model based on prompt engineering and knowledge graph, and guide the large language model through prompt engineering to convert the query text into primitive sentences in a primitive interpretation manner, and then interpret it through natural language to split the query text into a natural sub-problem set to obtain the output result of the large language model.
[0042] The technical solution of the embodiment of the present invention obtains the text to be queried, the pre-built prompt project and the knowledge graph based on the graph database; inputs the text to be queried into the large language model; and splits the text to be queried into a set of natural sub-problems in a primitive interpretation manner based on the prompt project and the knowledge graph through the large language model to obtain the output result of the large language model. By defining the primitive pre-built prompt project, the large prediction model is guided to first convert the primitive into a natural language interpretation, and the complex problem corresponding to the text to be queried is broken down into sub-problems through the primitive interpretation. The problem of the large language model's difficulty in understanding the primitive is solved, and the accurate understanding of the user's query intent and semantics is achieved to ensure the accuracy of the splitting of the query text problem, thereby providing a basis for the subsequent generation of accurate query answers.
[0043] Further, based on the above embodiment, the steps of splitting the query text into natural sub-question sets in a primitive interpretation manner based on the prompt engineering and knowledge graph through the large language model to obtain the output result of the large language model can be refined as follows:
[0044] a1. Use a large language model to determine entities in the knowledge graph based on the query text to obtain the target entity corresponding to the query text.
[0045] In this embodiment, the target entity can be understood as the basis for performing a graph database query corresponding to the text to be queried.
[0046] Specifically, the large language model can first identify the entities existing in the query text, and then determine the candidate entities corresponding to the identified entities in the knowledge graph based on the graph database, and finally rearrange the candidate entities to obtain the target entity corresponding to the query text.
[0047] Among them, on the basis of the above embodiment, the text to be queried can be input into the large language model, and the entity can be determined based on the text to be queried in the knowledge graph to obtain the target entity corresponding to the text to be queried, including:
[0048] The large language model is used to perform named entity recognition on the query text to determine the initial entities included in the query text; the embedding model and knowledge graph are used to determine the set of candidate entities corresponding to the entities; the large language model is used to rearrange the candidate entity set to determine the target entity.
[0049] In this embodiment, the initial entity can be understood as the entity contained in the query text. The embedding model can be understood as a model for converting entity names into vector form. The candidate entity set can be understood as a set of candidate entities that are semantically closest to the initial entity.
[0050] Specifically, the entity names contained in the text to be queried may differ from the entity names stored in the graph database, such as variant forms such as abbreviations, abbreviations, or full-width characters. These differences bring complexity to the accurate identification and matching of entities. The present invention can utilize the advanced capabilities of the large language model to perform in-depth named entity recognition on the query text. This process involves parsing the query text to identify and extract entities with specific meanings, such as names of people, places, and organizations, and determine their types. After named entity recognition, the processor can further perform semantic matching based on vector similarity on these identified initial entities. First, when constructing a graph database, the processor can pre-calculate the semantic vectors of all entity names in the graph database through an embedding model to construct an entity name vector database. When actually querying the text to be queried, the processor can screen out multiple candidate entities that are most semantically similar to form a candidate entity set by calculating the cosine similarity of the semantic vector of the initial entity and all vectors in the entity name vector database. The processor can use a large language model to rerank the candidate entity set. This step is based on a pre-trained large language model and takes into account the entity's contextual information, relevance, and match with the query to ensure that the selected entity is semantically most consistent with the queried text. The reranking process determines one or more best matching target entities, which will serve as the basis for graph database queries.
[0051] In the process of practice, the following problems were found:
[0052] It is difficult for a large language model to understand the pointing relationship in a primitive statement (Cypher statements are used as an example later). A large language model has hallucinations when directly generating Cypher statements for primitives. The Cypher statements for primitives directly generated by a large language model do not conform to grammatical specifications and have low controllability.
[0053] The reason is that in the training data of the large language model, the amount of Cypher statements is less than that of common programming languages such as Python. The large language model performs well when processing patterns that have appeared in the training data, but may not be able to accurately generate or understand Cypher statements when encountering new or uncommon patterns. Cypher statements contain elements such as nodes, relationships, and arrow directions, and the large language model uses a tokenizer-based design principle that is suitable for continuous text with semantics, but not for symbol sequences of the type "(a)-[f]->(b)", so it is difficult to understand the semantics of these elements and their combinations. Therefore, a series of methods for converting primitives into natural language interpretations were designed through prompt engineering, which transforms the large language model from an uncontrollable process of directly splitting and generating primitives to a controllable process of selecting from natural language interpretations.
[0054] b1. Determine the meta-information of the target entity and convert it into a primitive query statement.
[0055] In this embodiment, meta information can be understood as information describing the characteristics and attributes of the target entity itself, which is used to provide additional context, structure, semantics and other details about the data or object. The primitive query statement can be understood as a query statement converted into a primitive form.
[0056] Specifically, the prompting project may include a data source description, through which the meta information of the target entity is determined and converted into a primitive query statement.
[0057] Exemplarily, the prompt project includes a data source definition, which describes the concepts in the graph database through natural language so that the large language model can obtain meta information when searching for related concepts. The definition of this part can be:
[0058] 1. Entity: There are only N1 entity types in the graph: entity type A, entity type B,...
[0059] For each entity type, there are respective properties as follows:
[0060] Entity type A: attribute AX, attribute AY...
[0061] Entity type B: attribute BX, attribute BY...
[0062] 2. Relationships: There are several fixed relationships between the points in the graph. These relationships only include the following N2 types:
[0063] (a: entity type A)-[f: relationship F]->(b: entity type B)
[0064] (b: entity type B)-[g: relationship G]->(a: entity type A) ...
[0066] For example, entity type A is a company, and its attributes include company name and stock code, etc. Entity type B is an industry, and its attributes include industry name, etc.
[0067] c1. Perform natural sentence interpretation on each element included in the primitive query sentence to obtain a set of intermediate sub-questions.
[0068] In this embodiment, the elements can be understood as the elements used to describe different elements in the primitive query statement, such as entities and relationships. The natural language interpretation can be understood as the way of converting into natural language. The intermediate sub-problem set can be understood as the set of sub-problems after splitting.
[0069] Specifically, the prompt engineering can be used to guide the large language model to perform natural sentence interpretation on each element included in the primitive query sentence to obtain an intermediate sub-question set.
[0070] Among them, based on the above embodiment, the steps of performing natural sentence interpretation on each element included in the primitive query sentence to obtain the intermediate sub-question set can be refined as follows:
[0071] c11. Perform natural language conversion on the relational elements included in the original query sentence to obtain relational phrases.
[0072] In this embodiment, the relation element can be understood as an element used to indicate the relationship between two entities, for example, the primitive query sentence is: (a: company)-[f: purchase]->(b: company), where f represents the relationship. The relation phrase can be understood as a noun phrase that represents the relationship in natural language.
[0073] Specifically, the prompting project can include primitive descriptions, and all primitives can be converted into natural language explanations by providing noun phrases and manual definitions through primitive descriptions. In this section, it can be explained to the large prediction model that the natural explanations corresponding to all primitives can be queried, and the large language model can be guided to use the primitives to split the original question. The large language model determines the corresponding noun phrases included in the primitive query sentence through the relational elements included in the primitive query sentence, and performs natural language conversion to obtain the relational phrases.
[0074] Exemplarily, in the prompt project, the definition of noun phrases can be set first. For example, the primitive query statements (a)-[f]->(b) and (a)<-[f]-(b) can be converted into natural language interpretations. For single-hop relationships, a cached function call large language model can be predefined to convert the relationship into a noun phrase. Specifically, the name of entity type a, the name of relationship f, and the name of entity type b can be provided. Through the prompt project, the large language model converts (a)-[f]->(b) into: a is b's (X), b is a's (Y), where X and Y are pre-set relationship phrases. Taking (a: company)-[f: procurement]->(b: company) as an example, the large language model converts it into: a is b's customer; b is a's supplier.
[0075] Furthermore, this method is applicable to the noun interpretation of multi-hop relations. For example, a primitive query sentence with a multi-hop relationship: (a: company)-[f: procurement]->(b: company)<-[g: shareholding]-(c: company) can be transformed into a shareholder company of a supplier based on the connection of noun phrases.
[0076] In this way, the model's ability to understand natural language explanations constructed using noun phrases is significantly higher than its ability to understand primitive query statements, which can effectively reduce the difficulty of large language models understanding primitive query statements.
[0077] c12. Perform pseudo-edge correction on the edge elements included in the original query statement to determine the target phrase.
[0078] In this embodiment, the edge element can be understood as an element in the graph database that represents a possible relationship between the two. The target phrase can be understood as a noun phrase that represents a hidden relationship in natural language.
[0079] Specifically, the large language model is used to determine, based on the primitive query statement, in the predefined primitive statement and the pseudo-edge realized by the statement, the edge element of the primitive query statement is pseudo-edge modified, and the noun phrase of the pseudo-edge realized by the statement is used as the target phrase.
[0080] Exemplarily, a pseudo-edge definition can also be set in the prompt project. In actual application, users may need to query the association relationships implied by real concepts in the graph database. For example, a company's competitors may be other companies in the same industry as the company, or companies with the same products as the company. Therefore, the concept of pseudo-edge is defined. Pseudo-edge can be understood as an edge that does not exist directly in the graph database but is realized through predefined database operation statements. User-defined pseudo-edges consist of two parts: a primitive query statement and a corresponding noun phrase.
[0081] For example, competitor relationships can be defined using the following database operation statements:
[0082] MATCH(a:company)-[f1:company_industry]->(b1:industry)<-[g1:company_industry]-(c1:company)where a.__uid in{}RETURN c1
[0083] UNION
[0084] MATCH (a:company)-[f2:company_product]->(b2:product)<-[g2:company_product]-(c2:company)where a.__uid in{}RETURN c2
[0085] The target phrase of a competitor relationship can be defined as: a is a competitor of b, and b is a competitor of a.
[0086] c13. Perform relationship calculation on the entity elements included in the primitive query statement based on the user-defined function to determine additional phrases.
[0087] In this embodiment, the user-defined function can be understood as a function for calculating the required relationship. The entity element can be understood as an element that represents the entity. The additional phrase can be understood as a noun phrase obtained by function calculation.
[0088] Specifically, since the relationship between entities may need to be calculated, the functions and noun phrases of this part can be defined through user-defined functions. The large language model can perform relationship calculations on the entity elements included in the primitive query statement based on the user-defined functions, and determine the corresponding noun phrases as additional phrases based on the calculation results to describe the relationship between the two entity elements.
[0089] For example, in a knowledge graph consisting of {entity: company, entity: person, relationship: shareholding}, the actual controller can be defined as "a controlling shareholder of a listed company who holds more than 50% of the shares". Usually, to calculate the actual controller of a company, it is necessary to query the direct shareholders and indirect shareholders of the company, and calculate the shareholding ratio through iteration. For situations similar to this that require calculation, a user-defined function (User Defined Function) of the graph database where the knowledge graph is located can be provided. In the query decomposition process, in addition to defining the function process, the user-defined function also needs to additionally define the noun phrase between the two entity elements. For example, the noun phrase in the above example can be defined as: a is the actual controller of b. b is the actual holding company of a.
[0090] c14. Determine the intermediate sub-question set based on entity elements, relationship phrases, target phrases and additional phrases.
[0091] Specifically, the large language model can be used to combine entity elements, relational phrases, target phrases and additional phrases to determine intermediate sub-problems and obtain an intermediate sub-problem set.
[0092] For example, in the prompt project, guidance can be provided for natural sentence interpretation by presetting primitive definitions, noun phrase definitions, pseudo-edge definitions, and user-defined functions. Based on the user's query requirements and the basic characteristics of the graph database, the following primitives can be predefined, and their descriptions and corresponding database operation statements (taking Cypher as an example) are as follows:
[0093] (1) Primitive name: Given a starting entity, query the end entity based on a certain edge
[0094] Corresponding primitive statement: MATCH(a:A)-[f:F]->(b:B)where a.__uid in{}RETURN b;
[0095] (2) Primitive name: Given a destination entity, query the start entity based on a certain edge
[0096] Corresponding statement: MATCH(a:A)<-[f:F]-(b:B)where a.__uid in{}RETURN b;
[0097] (3) Primitive name: Given a starting point entity, use a user-defined function to query the end point entity based on a certain pseudo edge.
[0098] Corresponding statements: statements predefined by developers.
[0099] (4) Primitive name: User-defined function
[0100] Corresponding statement: User-Defined Function (UDF).
[0101] (5) Primitive name: Given entity a and entity b, query all paths between the entities
[0102] Corresponding statement: MATCH p=(a:A)-[f*1..N]-(b:B)where a.__uid={}and b.__uid={}RETURN p;
[0103] (6) Primitive name: Given entity a and entity b, query the shortest path between the entities
[0104] Corresponding statement: SEARCH p = shortestPath((a),(b),(passNodes),[passEdges],true,N)where a.__uid = {}and b.__uid = {}RETURN p;
[0105] The above example defines 6 primitives, of which (1)-(4) can be converted into natural language interpretations through the noun phrase method in c11-c13. The natural primitive interpretations of primitives (5) and (6) can be manually defined as follows:
[0106] (5) Primitive name: Given entity a and entity b, query all paths between the entities
[0107] Natural language explanation: query all relations between a and b.
[0108] Corresponding statement: MATCH p=(a:A)-[f*1..N]-(b:B)where a.__uid={}and b.__uid={}RETURN p;
[0109] (6) Primitive name: Given entity a and entity b, query the shortest path between the entities
[0110] Natural language explanation: query the direct relationship between a and b.
[0111] Corresponding statement: SEARCH p = shortestPath((a),(b),(passNodes),[passEdges],true,N)where a.__uid = {}and b.__uid = {}RETURN p;
[0112] d1. Determine the iterative query relationship between the intermediate subproblems in the intermediate subproblem set to form a natural subproblem set.
[0113] In this embodiment, the iterative query relationship can be understood as a relationship used to characterize the query sequence between sub-problems. For example, if the output of a sub-problem can be used as the input of a subsequent sub-problem, then an iterative query relationship exists between the two sub-problems.
[0114] Specifically, the iterative query relationship between the intermediate subproblems in the intermediate subproblem set is determined to form a natural subproblem set.
[0115] e1. The formation process of the natural sub-problem set and the natural sub-problem set are integrated through the large language model to obtain the output result.
[0116] In this embodiment, the formation process is used to characterize the process of problem splitting by a large language model.
[0117] Specifically, the formation process of the natural sub-problem set and the natural sub-problem set are integrated through the large language model and used as the output result.
[0118] For example, the decomposition effect can be demonstrated through several specific query texts. Table 1 is an example of the question decomposition effect. The left column is the query text input by the user, and the right column is the decomposition result output by the large language model:
[0119] Table 1 Example of problem decomposition effect
[0120]
[0121]
[0122] Among them, the steps of determining the iterative query relationship between the intermediate subproblems in the intermediate subproblem set and forming a natural subproblem set can be refined as follows:
[0123] Determine the iterative query relationship between the intermediate subproblems in the intermediate subproblem set. If the first intermediate subproblem exists as the input of the second intermediate subproblem, perform symbol replacement on the first intermediate subproblem in the second intermediate subproblem to obtain the third intermediate subproblem. According to the first intermediate subproblem, the third intermediate subproblem and other intermediate subproblems, a natural subproblem set is formed in the order of subproblems.
[0124] In this embodiment, the first intermediate subproblem and the second intermediate subproblem are subproblems in which two queries are performed sequentially, and the output of the first intermediate subproblem is used as the input of the second intermediate subproblem. The third intermediate subproblem can be understood as the second intermediate subproblem after symbol replacement. The subproblem order can be understood as the sequential order of queries between subproblems. Other intermediate subproblems can be understood as independent intermediate subproblems, which have no query correlation with any intermediate subproblem.
[0125] Specifically, determine the iterative query relationship between the intermediate subproblems in the intermediate subproblem set. If there is a first intermediate subproblem as the input of the second intermediate subproblem, perform symbol replacement on the first intermediate subproblem in the second intermediate subproblem to obtain the third intermediate subproblem. The large language model can form a natural subproblem set in the order of subproblems based on the first intermediate subproblem, the third intermediate subproblem and other intermediate subproblems.
[0126] The technical solution of the embodiment of the present invention, through such a setting, aims at the problem that it is difficult for a large language model to understand primitive sentences, by presetting primitive definitions, noun phrase definitions, pseudo-edge definitions and user-defined functions, etc., to construct a prompt project, and guide the large language model to convert the primitive into a natural language interpretation through the prompt project, so as to solve the problem that the large language model has difficulty understanding the primitive, and realize the accurate understanding of the intention and semantics of the user query, so as to split the problem in this way and ensure the accuracy of the splitting of the query text problem. Other intermediate sub-problems are distinguished from sub-problems with iterative query relationships to realize parallel query of other intermediate sub-problems during the query process. When solving a specific sub-problem, only a simple replacement is required without relying on context semantics, and it can be completed through the corresponding primitive in the database operation statement. Therefore, it has more advantages in dealing with multi-hop dependency problems. Enhance the accuracy and efficiency of the RAG system based on the knowledge graph when dealing with such complex queries. By introducing a multi-step reasoning disassembly and aggregation mechanism, the present invention will enhance the system's ability to identify and utilize multi-hop dependency information in the graph database, reduce the dependence on the inherent knowledge of the large language model, and thus provide more accurate information retrieval and decision support when solving multi-hop tasks.
[0127] Optionally, after the large language model is used to split the query text into natural sub-question sets based on the prompt engineering and the knowledge graph in a primitive interpretation manner to obtain the output result of the large language model, the method further includes:
[0128] According to the dependency relationship between the natural sub-problems in the natural sub-problem sets, a directed acyclic graph is constructed, and a query execution plan is constructed through the directed acyclic graph.
[0129] In this embodiment, the dependency relationship can be understood as a natural sub-problem that requires the answer of another natural sub-problem to be solved. A directed acyclic graph (DAG) is a graph structure composed of vertices and directed edges. The vertices can represent the tasks that need to be executed, and the edges represent the dependencies between the tasks. Through algorithms such as topological sorting, the execution order of the tasks can be determined to satisfy all dependencies and minimize the execution time. The query execution plan can be understood as a task list consisting of solvable tasks.
[0130] Specifically, the processor or large language model can regard natural subproblems as points and dependencies as directed edges, and then a directed acyclic graph (DAG) can be constructed, which is defined as follows:
[0131] Let Q be the question, P be the answer to the question, and prompt be constructed by the process described above. Let S = LLM(Q|prompt) = {s1, s2, ..., s n} represents a set of natural subproblems. Let G = (V, E) represent a directed acyclic graph, where V is the set of nodes and E is the set of edges. Any node v∈V corresponds to a subproblem s∈S. Any directed edge e={s i ,s j}∈E represents s i The solution is based on s j .
[0132] Specifically, the processor or the large language model may construct a query execution plan through a directed acyclic graph, and the modules for constructing the query execution plan may be:
[0133] Define function F to represent the solvability of a node; define function G to represent whether a node has been solved. Obviously, a node is solvable if and only if the starting nodes of all edges ending at this node have been solved, as shown below:
[0134]
[0135] Among them, pred(v) represents all the predecessor nodes of the node.
[0136] In each poll, this module calculates the solvability of all unsolved nodes. For solvable but unsolved nodes, add them to the task queue. Secondly, replace the ||Answerx|| special symbol in the sub-question text corresponding to the node. Finally, solve all tasks in the task queue in parallel.
[0137] The technical solution of the embodiment of the present invention, through the decomposition and processing of natural language queries based on the construction of directed acyclic graphs, further simulates the human thought process to handle complex problems compared to the traditional thought chain, and realizes natural language processing capabilities that are closer to the human way of thinking. By constructing a query execution plan, while splitting the query, the topological structure between sub-questions is clearly defined.
[0138] For example, a specific example is used to illustrate the problem splitting and query task construction process of this method. Figure 2 This is an example flow chart of a query statement splitting method provided in the first embodiment of the present invention, such as Figure 2 As shown, this step may include:
[0139] S201, obtaining the text to be queried, the pre-built prompt project, and the knowledge graph based on the graph database;
[0140] S202, inputting the text to be queried into the large language model;
[0141] S203, performing named entity recognition on the query text through the large language model to determine the initial entity included in the query text; determining the candidate entity set corresponding to the entity through the embedding model and the knowledge graph; re-arranging the candidate entity set through the large language model to determine the target entity;
[0142] S204, determine whether there is a target entity; if yes, jump to step S205, if no, end;
[0143] S205, guiding the large language model through a prompting project including data source definition, primitive definition, noun phrase definition, pseudo-edge definition, user-defined function and path primitive, querying the natural explanations corresponding to all primitives, and performing problem decomposition on the query text;
[0144] S206, guiding the large language model through a prompting project including data source definition, primitive definition, noun phrase definition, pseudo-edge definition, user-defined function and path primitive, querying the natural explanations corresponding to all primitives, decomposing the query text, and obtaining a natural sub-problem set;
[0145] S207. Construct a directed acyclic graph based on a set of natural subproblems;
[0146] S208. Construct an execution query plan according to the directed acyclic graph.
[0147] For example, in order to make the construction of the prompt project clearer, a specific example is used to show the construction of the prompt project:
[0148] (1) Role definition and task description
[0149] Setting clear roles and tasks for large language models can significantly improve their ability to understand and solve problems. In this task, the processor can set the model as an "expert in understanding complex problems" and briefly describe the tasks it needs to complete. For example:
[0150] “You are an expert at understanding complex problems. Now you need to break the input problem into sub-problems.”
[0151] (2) Data source description (see the data source definition section in the example in step b1 above for details)
[0152] (3) Primitive description (see the primitive definition, noun phrase definition, pseudo-edge definition, and user-defined function in the examples of steps c11-c13 above for details)
[0153] All primitives can be converted into natural language explanations through noun phrases and manual definitions. In this section, we explain to the model that we can query the natural explanations corresponding to all primitives and guide the model to split the original question using primitives.
[0154] (4) Iterative query description
[0155] The prompt emphasizes the correlation between sub-questions, guiding the large language model to use the output of a sub-question as the input of subsequent sub-questions when breaking down the problem, forming an iterative query relationship to complete the multi-hop query task. This design enables the model to handle more complex query requirements. Therefore, this part of the prompt is defined as follows:
[0156] "The subtasks are ordered, that is, the answers to the previous subtasks can be used as inputs for the subtasks. The answers to the split subtasks can be combined to answer the original question. If you need the answer to a subtask as input for another subtask, please use `||Answerx||` to indicate it, where `x` is the number of the answer you need.".
[0157] (5) Output rule description
[0158] Here, the processor defines the output of the large language model as including two parts: thinking and output. First, the processor lets the large language model <think> and< / think>The processor outputs its thinking process in the label. Experiments have shown that this can not only greatly improve the accuracy of the large language model's splitting problem, but also improve the interpretability of its decision-making. When the splitting problem is wrong, developers can observe its thinking process and find out the shortcomings of its thinking logic, so as to modify the prompt. After that, the processor allows the large language model to <output> and< / output> In the label, output the sub-problems it splits into.
[0159] (6) Examples
[0160] Experiments have shown that providing practical examples in prompt engineering can significantly improve the model's understanding of prompts and the execution of instructions. Therefore, specific examples are added to the prompts to show how to decompose a complex query into multiple primitive-based sub-questions.
[0161] Furthermore, we can use two examples, namely noun phrase prompts and question decomposition prompts, to describe the prompting project in detail:
[0162] Example 1: Noun phrase prompt
[0163] ===PROMPT===
[0164] You are an expert in understanding the relationships between entities. Now, you need to describe the relationship between two entities using noun phrases.
[0165] The rules are as follows:
[0166] 1. The input contains three items, representing entity a, relationship, and entity b. Among them, the relationship points from entity a to entity b.
[0167] 2. Your output contains <think>and <output>Two parts.
[0168] 3. You need to <think>Think carefully, cautiously, and step by step about how to express the relationship between entity a and entity b using a concise and easy-to-understand noun phrase.
[0169] 4. <output>The output contains only two lines, the first line is "a is b's ()", the second line is "b is a's ()", according to the results, fill in the noun phrases in the brackets.
[0170] #For example:
[0171] enter:
[0172] Cow eating grass
[0173] Output:
[0174] <think>
[0175] a refers to cow, b refers to grass, and according to the description "eat" in the relationship f, a can be understood as b's (consumer) and b can be understood as a's (food).
[0176] < / think>
[0177] <output>
[0178] Cows are consumers of grass
[0179] Grass is for cows (food)
[0180] < / output>
[0181] #The following officially begins:
[0182] enter:
[0183] {edge}
[0184] Output:
[0185] =============
[0186] Example 2 Problem Analysis prompt
[0187] ===PROMPT===
[0188] You are an expert in graph databases and logic. Your task is to break down a problem into sub-problems, each sub-problem corresponds to a query.
[0189] {graph_description}
[0190] For sub-questions, you have the following query methods. The name and description of each query method are as follows:
[0191] {pseudo_func_prompt}
[0192] ##edge_basic
[0193] You can use this query method to perform the following queries in the graph database:
[0194] {edge_basic_prompt}
[0195] rule:
[0196] 1. You can only select one entity type at a time
[0197] 2. You can only select one entity relationship at a time
[0198] ##path_func
[0199] You can use this query method to perform the following queries in the graph database:
[0200] 1. Query the shortest path between two entities
[0201] a. Query the shortest path between ["Person:Tom"] and ["Person:Jerry"]
[0202] 2. Query all paths between two entities
[0203] a. Query all paths between ["Person:Tom"] and ["Person:Jerry"]
[0204] rule:
[0205] 1. You need to ensure that the two entities are known, but you do not need to ensure that the relationship between the two entities is known.
[0206]
[0207] You need to ensure that:
[0208] 1. Each subtask corresponds to a function
[0209] 2. The subtasks are ordered, i.e. the answers to the previous subtasks can be used as inputs to the subtasks
[0210] 3. The answers to the split subtasks can be combined to answer the original question
[0211] 4. The subtask does not include logical reasoning, only the above <function>Query method in
[0212] 5. If you think the problem cannot be solved by the existing graph database information, directly output why it cannot be solved and why
[0213] 6. Please be careful, cautious, and think step by step
[0214] For the given task, some entities have been extracted in the format of ["entity type:entity name"], such as ["Person:Tom"]. You should assume that these entities are absolutely correct and keep their original format when using them for input, such as querying entities ["Person:Tom"].
[0215] Your final output should meet the following specifications:
[0216] 1. You should first output a <think>Tags are used to describe your splitting ideas. After describing the splitting ideas, output your split subtasks and corresponding query statements;
[0217] 2. The output of your split subtask should be <output> and< / output> Label package;
[0218] 3. <output>The content in the tag only contains the subtasks you split, with each subtask occupying one line;
[0219] 4. The format of the subtask should conform to the following specifications:
[0220] a. Number the sub-problems in numbers, and the numbers should be consistent with the order of the sub-tasks you split; b. If you need the answer to a sub-task as the input of another sub-task, please use ||Answerx|| to indicate it, where x is the number of the answer you need; c. The format of the sub-task is a Python tuple, which contains three elements: the sequence number, the query method used by the sub-task, and the specific description of the task; d. The description of the sub-task should conform to the input format of the query method.
[0221] The final output is as follows:
[0222] <think>
[0223] Enter your thought process here
[0224] < / think>
[0225] <output>
[0226] (1,\'func_name_1\',\'sub question description 1\')
[0227] (2,\'func_name_2\',\'sub question description 2\')
[0228] (3,\'func_name_3\',\'sub question description 3\')
[0229] < / output>
[0230] The question you need to split is: {question}
[0231] Embodiment 3
[0232] Figure 3 This is a schematic diagram of the structure of a query statement splitting device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:
[0233] The information acquisition module 31 is used to obtain the text to be queried, the pre-built prompt project and the knowledge graph based on the graph database;
[0234] A sentence input module 32, used for inputting the text to be queried into a large language model;
[0235] The result determination module 33 is used to split the query text into natural sub-question sets in a primitive interpretation manner based on the prompt project and the knowledge graph through the large language model to obtain the output result of the large language model.
[0236] Furthermore, the result determination module 33 includes:
[0237] A first determination unit is used to perform entity determination in the knowledge graph based on the text to be queried by using the large language model to obtain a target entity corresponding to the text to be queried;
[0238] A second determining unit, configured to determine the meta information of the target entity and convert it into a primitive query statement;
[0239] A third determining unit is used to perform natural sentence interpretation on each element included in the primitive query sentence to obtain an intermediate sub-question set;
[0240] A fourth determining unit is used to determine the iterative query relationship between the intermediate subproblems in the intermediate subproblem set to form a natural subproblem set;
[0241] The fifth determining unit is used to integrate the formation process of the natural sub-problem set and the natural sub-problem set through the large language model to obtain an output result.
[0242] Wherein, the first determining unit is specifically used for:
[0243] Performing named entity recognition on the query text by using the large language model to determine the initial entities included in the query text;
[0244] Determine a candidate entity set corresponding to the entity through the embedding model and the knowledge graph;
[0245] The candidate entity set is rearranged by using the large language model to determine a target entity.
[0246] The third determining unit is specifically used for:
[0247] Performing natural language conversion on the relational elements included in the primitive query sentence to obtain a relational phrase;
[0248] Performing pseudo-edge correction on edge elements included in the primitive query sentence to determine a target phrase;
[0249] performing relationship calculation on entity elements included in the primitive query statement based on a user-defined function to determine additional phrases;
[0250] An intermediate sub-question set is determined according to the entity element, the relation phrase, the target phrase, and the additional phrase.
[0251] The fourth determining unit is specifically configured to:
[0252] Determine an iterative query relationship between the intermediate subproblems in the intermediate subproblem set, and if there is a first intermediate subproblem as an input of a second intermediate subproblem, perform symbol replacement on the first intermediate subproblem in the second intermediate subproblem to obtain a third intermediate subproblem;
[0253] According to the first intermediate subproblem, the third intermediate subproblem and other intermediate subproblems, a natural subproblem set is formed in the order of subproblems.
[0254] Optionally, the device further comprises:
[0255] The plan construction module is used to construct a directed acyclic graph according to the dependency relationship between the natural sub-problems in the natural sub-problem sets, and to construct a query execution plan through the directed acyclic graph.
[0256] The query statement splitting device provided in the embodiment of the present invention can execute the query statement splitting method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0257] Embodiment 4
[0258] Figure 4 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0259] like Figure 4 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0260] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0261] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as the query statement splitting method.
[0262] In some embodiments, the query statement splitting method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the query statement splitting method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the query statement splitting method in any other appropriate manner (e.g., by means of firmware).
[0263] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0264] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0265] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0266] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0267] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0268] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0269] In one embodiment, the embodiment of the present invention further includes a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the query statement splitting method of any embodiment of the present invention is implemented.
[0270] The computer program product may be implemented by writing computer program code for performing the operations of the present invention in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0271] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0272] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.< / output> < / think> < / function> < / output> < / think> < / output> < / think>
Claims
1. A query statement splitting method, characterized in that: include: Obtain the text to be queried, pre-built prompt projects, and knowledge graphs based on graph databases; Inputting the text to be queried into a large language model; The large language model is used to split the text to be queried into a natural sub-question set based on the prompt project and the knowledge graph in a primitive interpretation manner to obtain an output result of the large language model.
2. The method according to claim 1, characterized in that The step of dividing the query text into natural sub-question sets in a primitive interpretation manner based on the prompt engineering and the knowledge graph by the large language model to obtain the output result of the large language model includes: Determine an entity in the knowledge graph based on the text to be queried by the large language model, and obtain a target entity corresponding to the text to be queried; Determine the meta information of the target entity and convert it into a primitive query statement; Performing natural sentence interpretation on each element included in the primitive query sentence to obtain an intermediate sub-question set; Determine the iterative query relationship between the intermediate subproblems in the intermediate subproblem set to form a natural subproblem set; The formation process of the natural sub-problem set and the natural sub-problem set are integrated through the large language model to obtain an output result.
3. The method according to claim 2, characterized in that The step of inputting the text to be queried into the large language model, determining entities in the knowledge graph based on the text to be queried, and obtaining a target entity corresponding to the text to be queried includes: Performing named entity recognition on the query text by using the large language model to determine the initial entities included in the query text; Determine a candidate entity set corresponding to the entity through the embedding model and the knowledge graph; The candidate entity set is rearranged by using the large language model to determine a target entity.
4. The method according to claim 2, characterized in that: The natural statement interpretation is performed on each element included in the primitive query statement to obtain an intermediate sub-question set, including: Performing natural language conversion on the relational elements included in the primitive query sentence to obtain a relational phrase; Performing pseudo-edge correction on edge elements included in the primitive query sentence to determine a target phrase; performing relationship calculation on entity elements included in the primitive query statement based on a user-defined function to determine additional phrases; An intermediate sub-question set is determined according to the entity element, the relation phrase, the target phrase, and the additional phrase.
5. The method according to claim 2, characterized in that: Determining the iterative query relationship between the intermediate subproblems in the intermediate subproblem set to form a natural subproblem set includes: Determine an iterative query relationship between the intermediate subproblems in the intermediate subproblem set, and if there is a first intermediate subproblem as an input of a second intermediate subproblem, perform symbol replacement on the first intermediate subproblem in the second intermediate subproblem to obtain a third intermediate subproblem; According to the first intermediate subproblem, the third intermediate subproblem and other intermediate subproblems, a natural subproblem set is formed in the order of subproblems.
6. The method according to claim 1, characterized in that After the large language model is used to split the query text into natural sub-question sets based on the prompt project and the knowledge graph in a primitive interpretation manner to obtain the output result of the large language model, the method further includes: A directed acyclic graph is constructed according to the dependency relationship between the natural sub-problems in the natural sub-problem sets, and a query execution plan is constructed through the directed acyclic graph.
7. A query statement splitting device, characterized in that: include: Information acquisition module, used to obtain the text to be queried, pre-built prompt projects, and knowledge graphs based on graph databases; A sentence input module, used for inputting the text to be queried into a large language model; A result determination module is used to split the text to be queried into a set of natural sub-questions in a primitive interpretation manner through the large language model based on the prompt project and the knowledge graph to obtain the output result of the large language model.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the query statement splitting method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the query statement splitting method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the query statement splitting method according to any one of claims 1 to 6.
Citation Information
Cited By
Intelligent interaction method and system based on legal consultation
CN120821838A
Product maintenance method, system, medium, equipment and program product
CN121636542A
Answer generation device, answer generation method, and answer generation program
JP7925147B1