Intelligent customer service question-answering method, device, equipment and medium based on large language model and knowledge graph
By building the knowledge graph in the target field and performing LoRA fine-tuning of the large language model, the problem that the large language model cannot understand the complex semantic relationship of the knowledge graph is solved, and more accurate user question answers are achieved.
Patent Information
- Application Number
- CN202411836067.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-13
AI Technical Summary
Large language models cannot fully understand the complex semantic relationships in the knowledge graph, resulting in the generated answers being inaccurate enough.
By constructing a knowledge graph in the target field and fine-tuning the preset large language model based on the knowledge graph, obtaining the keyword set of user questions, building query statements for searching, combining the fill content and user questions to generate problem text, and finally inputting the large language model to obtain more accurate answers.
The large language model is realized to answer user questions more accurately. Through the construction of knowledge graphs and fine-tuning of the model, the model's understanding of complex semantic relationships is enhanced and the accuracy of the answer is improved.
Smart Images

Figure CN119294536B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent reply, and in particular to an intelligent customer service question and answer method, device, equipment and medium based on a large language model and a knowledge graph. Background Art
[0002] A big language model is a type of deep learning model, usually based on the Transformer architecture. It is trained with large amounts of text data and can generate and understand natural language. Big language models can handle a variety of natural language processing tasks, such as text generation, translation, question answering, sentiment analysis, etc. A knowledge graph is a data structure used to represent real-world entities and their relationships. It usually stores data in the form of a graph, where nodes represent entities and edges represent relationships between entities. A knowledge graph can contain rich metadata and attribute information to describe the characteristics of entities and the nature of relationships.
[0003] Combining a large language model with a knowledge graph to answer user questions is a very promising approach, but there are also some challenges and potential problems. Specifically, a large language model may not be able to fully understand the complex semantic relationships in the knowledge graph, resulting in inaccurate generated answers. Therefore, there is an urgent need for a method that can provide more accurate answers to user questions. Summary of the invention
[0004] The present invention solves the technical problem in the prior art that the large language model cannot fully understand the complex semantic relationships in the knowledge graph, resulting in inaccurate generated answers, by providing an intelligent customer service question and answer method, device, equipment and medium based on a large language model and a knowledge graph, thereby achieving the technical effect that the large language model can answer user questions more accurately.
[0005] In a first aspect, the present invention provides an intelligent customer service question-answering method based on a large language model and a knowledge graph, the method comprising:
[0006] Build a knowledge graph for the target domain;
[0007] Based on the knowledge graph of the target domain, LoRA fine-tuning is performed on the preset large language model;
[0008] Obtaining a target question of a target user, and inputting the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes a plurality of keywords;
[0009] Construct several query statements based on the keyword set;
[0010] Search the knowledge graph of the target domain according to several query statements to obtain the filled content;
[0011] Combine the filler content with the target user's target question to construct the target user's question text;
[0012] The target user's question text is input into the preset large language model to obtain the target answer to the target question.
[0013] Furthermore, based on the knowledge graph of the target domain, the preset large language model is fine-tuned by LoRA, including:
[0014] Extract training data sets from the knowledge graph of the target domain;
[0015] Use the attention mechanism layer and / or feed-forward network layer in the preset large language model as the target layer and apply LoRA;
[0016] Initialize the weight of LoRA and determine the rank of LoRA;
[0017] Determine the target loss function and train the target layer of the preset large language model with the training data set;
[0018] When the preset training requirements are met, the latest neural network parameters are saved, and the preset large language model corresponding to the latest neural network parameters is used as the preset large language model after LoRA fine-tuning.
[0019] Furthermore, the formula of the objective loss function includes:
[0020]
[0021] in, and All are preset weights. is the number of samples in the training data set, is the sample category, For the The samples belong to The true label of the class sample category, where the true label includes 0 or 1, For the The samples belong to The probability of the class sample category, is the preset regularization coefficient, To preset the weight parameters in the large language model, To combat losses.
[0022] Further, combating losses includes:
[0023]
[0024] in, is the preset weight, is the discriminator, For the generator, For the input samples.
[0025] Furthermore, a knowledge graph of the target domain is constructed, including:
[0026] Extract data from data sources according to the target domain, including entity recognition, relationship extraction, and attribute extraction;
[0027] Determine the framework of the knowledge graph of the target domain;
[0028] Map the extracted entities to entity types in the framework and assign corresponding attribute values to each entity;
[0029] Map the relationships between several entities to the relationship types in the framework and assign corresponding attribute values to each relationship.
[0030] Furthermore, the preset training requirements are met, including:
[0031] The maximum number of training times is reached and the accuracy of the output of the preset large language model is higher than the preset threshold.
[0032] Furthermore, the formula for the accuracy of the output of the large language model is preset, including:
[0033]
[0034] in, is the accuracy of the output of the large language model, is the number of samples that correctly answer the question, is the number of samples that incorrectly answer the question, is the number of samples that did not answer the question.
[0035] In a second aspect, the present invention provides an intelligent customer service question-answering device based on a large language model and a knowledge graph, the device comprising:
[0036] Graph construction module, used to build the knowledge graph of the target domain;
[0037] The fine-tuning module is used to fine-tune the preset large language model based on the knowledge graph of the target domain;
[0038] A word set construction module is used to obtain a target question of a target user and input the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes a number of keywords;
[0039] A statement building module, used to build several query statements based on a keyword set;
[0040] The filling module is used to search the knowledge graph of the target domain according to several query statements to obtain the filling content;
[0041] A text generation module is used to combine the fill-in content with the target user's target question to construct the target user's question text;
[0042] The answer module is used to input the question text of the target user into a preset large language model to obtain a target answer to the target question.
[0043] In a third aspect, the present invention provides an electronic device, comprising:
[0044] processor;
[0045] a memory for storing processor-executable instructions;
[0046] Among them, the processor is configured to execute to implement the intelligent customer service question and answer method based on a large language model and a knowledge graph as provided in the first aspect.
[0047] In a fourth aspect, the present invention provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the intelligent customer service question and answer method based on a large language model and a knowledge graph as provided in the first aspect.
[0048] One or more technical solutions provided in the present invention have at least the following technical effects or advantages:
[0049] The present invention provides an intelligent customer service question-answering method based on a large language model and a knowledge graph, the method comprising: constructing a knowledge graph of a target domain; based on the knowledge graph of the target domain, performing LoRA fine-tuning on a preset large language model; obtaining a target question of a target user, and inputting the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes several keywords; constructing several query statements according to the keyword set; searching according to several query statements in the knowledge graph of the target domain to obtain filling content; combining the filling content with the target question of the target user to construct the question text of the target user; inputting the question text of the target user into the preset large language model to obtain the target answer to the target question. After constructing the knowledge graph of the target domain, the present invention uses the knowledge graph to perform LoRA fine-tuning on the preset large language model, which can better complete the training of the model, and the present invention can help the model better understand the problem by constructing the question text of the target user, which is conducive to the model accurately hitting the problem.
[0050] The loss function proposed in the present invention combines multiple loss terms, so that the model can achieve better comprehensive performance in classification accuracy, generalization ability, and robustness. Regularization loss helps prevent the model from overfitting on training data and improves performance on new data; adversarial loss can enhance the robustness of the model, making it perform better in the face of noise and abnormal data. By presetting weights, the impact of each loss term can be flexibly adjusted according to the needs of specific tasks, so that the large language model can be better adapted to specific tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1 A schematic diagram of the process flow of the intelligent customer service question and answer method based on a large language model and a knowledge graph provided by the present invention. DETAILED DESCRIPTION
[0053] The embodiment of the present invention solves the technical problem in the prior art that the large language model cannot fully understand the complex semantic relationships in the knowledge graph, resulting in inaccurate generated answers, by providing an intelligent customer service question and answer method based on a large language model and a knowledge graph.
[0054] The technical solution of the present invention is to solve the above technical problems, and the overall idea is as follows:
[0055] An intelligent customer service question-answering method based on a large language model and a knowledge graph, the method comprising: constructing a knowledge graph of a target domain; fine-tuning a preset large language model based on the knowledge graph of the target domain; obtaining a target question of a target user, and inputting the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes several keywords; constructing several query statements according to the keyword set; searching the knowledge graph of the target domain according to the several query statements to obtain filling content; combining the filling content with the target question of the target user to construct a question text of the target user; and inputting the question text of the target user into the preset large language model to obtain a target answer to the target question.
[0056] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0057] First of all, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0058] The present invention provides Figure 1 The intelligent customer service question-answering method based on a large language model and a knowledge graph includes steps S11-S17:
[0059] Step S11, construct a knowledge graph of the target domain.
[0060] Specifically, it includes: extracting data from the data source according to the target domain, including entity recognition, relationship extraction and attribute extraction; determining the framework of the knowledge graph of the target domain; mapping the extracted entities to the entity types in the framework, and assigning corresponding attribute values to each entity; mapping the relationships between the entities to the relationship types in the framework, and assigning corresponding attribute values to each relationship.
[0061] Knowledge graphs usually exist in multiple fields, and the knowledge graphs in each field are not the same, for example: medical and health, financial risk control, urban management, education, scientific research, and cultural heritage protection.
[0062] The target domain refers to the domain in which the user's questions are raised.
[0063] Data extraction is to extract the information needed to build a knowledge graph from the data source, and entity recognition is to identify objects with practical significance from the data source, such as names of people, places, and names of organizations. Relationship extraction refers to determining the associations between entities, for example, "Zhang San works at Peking University". Relationship extraction requires understanding the relationship types between entities based on the context, such as work relationships, geographical location relationships, etc. Attribute extraction refers to collecting specific information about entities, such as a person's age, the founding date of a company, etc.
[0064] After completing data extraction, you can define a knowledge graph framework suitable for this field, including:
[0065] Entity Types: Define the different types of entities you might encounter in your domain, such as people, places, organizations, etc.
[0066] Relationship Type: Defines the different types of relationships that can exist between entities, such as "belongs to", "is located in", "is written by", etc.
[0067] Attribute type: defines the attributes that an entity or relationship may have, such as the entity's date of birth, the validity period of a relationship, etc.
[0068] Map the extracted entities to the corresponding entity types according to the preset framework and assign specific attribute values to them. For example, if the extracted entity is "Zhang San", it can be mapped to the person type according to the framework and its name attribute can be set to "Zhang San".
[0069] Similarly, the relationships between entities are also mapped to the corresponding relationship types in the framework, and attribute values are specified for these relationships. For example, the relationship "Zhang San works at Peking University" can be mapped to the "works at" relationship type, and attribute values such as start time and end time can be set.
[0070] Step S12: Based on the knowledge graph of the target domain, LoRA fine-tune the preset large language model.
[0071] Specifically, it includes: extracting a training data set from the knowledge graph of the target domain; taking the attention mechanism layer and / or feedforward network layer in the preset large language model as the target layer, and applying LoRA; initializing the weight of LoRA and determining the rank of LoRA; determining the target loss function, and training the target layer of the preset large language model with the training data set; when the preset training requirements are met, saving the latest neural network parameters, and taking the preset large language model corresponding to the latest neural network parameters as the preset large language model after LoRA fine-tuning.
[0072] Extract training data sets from data sources in the target domain. The training data can contain information such as entities, relationships between entities, and attributes of entities. LoRA is an efficient model fine-tuning method that reduces computational cost and memory consumption by adjusting only a small number of parameters in the model (i.e., low-rank matrices).
[0073] Select target layer: Select the layer that needs to be fine-tuned from the preset large language model, usually the attention mechanism layer and / or the feedforward network layer; Add low-rank matrix: Add a low-rank matrix to the selected layer, and the matrix will be trained to meet the needs.
[0074] Initialize the weights of the low-rank matrix with random numbers. Select the rank of the low-rank matrix, which determines the size of the matrix and the capacity of the model. The choice of rank needs to balance the requirements of model performance and computing resources.
[0075] The selected loss function is used to guide model training, where the formula of the target loss function includes:
[0076]
[0077] in, and All are preset weights. is the number of samples in the training data set, is the sample category, For the The samples belong to The true label of the class sample category, where the true label includes 0 or 1, For the The samples belong to The probability of the class sample category, is the preset regularization coefficient, To preset the weight parameters in the large language model, To combat losses.
[0078] Combating losses, including:
[0079]
[0080] in, is the preset weight, is the discriminator, For the generator, For the input samples.
[0081] Use the extracted training dataset to train the target layer of the preset large language model. During the training process, only the weights of the low-rank matrix are updated, while the weights of other layers remain unchanged. This helps to reduce training time and resource consumption.
[0082] Set the training termination condition. When the training termination condition is met, stop the training. Meeting the preset training requirements specifically includes: reaching the maximum number of training times and the accuracy of the output of the preset large language model is higher than the preset threshold. The preset threshold can be determined based on the actual situation and will not be elaborated here.
[0083] The formula for the accuracy of the output of the preset large language model includes:
[0084]
[0085] in, is the accuracy of the output of the large language model, is the number of samples that correctly answer the question, is the number of samples that incorrectly answer the question, is the number of samples that did not answer the question.
[0086] It should be noted that for the loss function proposed by the present invention, by combining multiple loss terms, the model can achieve better comprehensive performance in terms of classification accuracy, generalization ability, and robustness. The regularization loss helps prevent the model from overfitting on the training data and improves its performance on new data; the adversarial loss can enhance the robustness of the model, making it perform better in the face of noise and abnormal data. By presetting weights, the influence of each loss term can be flexibly adjusted according to the requirements of specific tasks, enabling the large language model to better adapt to specific tasks.
[0087] Step S13: Obtain the target question of the target user, and input the target question into a preset large language model to extract the keyword set corresponding to the target question, where the keyword set contains several keywords.
[0088] To extract keywords from the user's question, the context understanding ability and attention mechanism of the large language model can be utilized. Specifically: Segment the user's question, break it down into individual words or phrases, and remove some common stop words (such as "of", "is", "in", etc.), which usually do not help in understanding the core content of the question. Convert the segmented words into vector representations, and input the word embeddings into the encoding layer of the model (such as the encoder of Transformer). The model will generate the context representation of each word according to the context. Utilize the attention mechanism of the model to find the words that are most important for understanding the question. Among them, the words with high attention scores can be keywords, and the words with scores greater than the score threshold are used as keywords.
[0089] Step S14: Construct several query statements according to the keyword set.
[0090] Specifically, it includes: Construct the query statements in the most basic form according to each keyword; Consider the synonyms, related concepts, and combined forms of the keywords to generate more query statements; Combine multiple keywords to form more complex query statements to cover more information sources.
[0091] Suppose the extracted keyword set is: [Python, Quick Sort, Algorithm];
[0092] According to each keyword, construct the basic query statements: Python: "Python programming"; Quick Sort: "Quick Sort algorithm"; Algorithm: "Algorithm introduction".
[0093] Consider the synonyms, related concepts, and combined forms of the keywords:
[0094] Python: "Python tutorial", "Python syntax", "Python library";
[0095] Quick Sort: "Quick Sort principle", "Quick Sort implementation", "Quick Sort optimization";
[0096] Algorithms: "Common Algorithms", "Algorithm Complexity", "Algorithm Design".
[0097] Combine the above keywords to form a more complex query statement.
[0098] Step S15, searching the knowledge graph of the target field according to several query statements to obtain the filled content.
[0099] Extract keyword sets from user questions and construct several query statements, which will be used for retrieval in the knowledge graph, including: using SPARQL query language for retrieval, extracting relevant entities, relationships and attributes based on the retrieval results, and forming a background introduction related to the target question.
[0100] Step S16, combining the filled content with the target user's target question to construct the target user's question text.
[0101] Combine the filler content with the user's target question to generate a complete question text. The text not only contains the user's question, but also provides background introduction and relevant details.
[0102] For example, the search results are as follows:
[0103] Entities: Python (Programming Language), Quick Sort (Sorting Algorithm), Algorithm (Computer Science Concept)
[0104] Relationship: Python > implementation > quick sort; quick sort > belongs to > algorithm;
[0105] Attributes: Python attributes: version, official documentation link; quick sort attributes: time complexity, space complexity; algorithm attributes: classification, application scenarios.
[0106] You can get the background introduction related to the target problem: Quick sort is an efficient sorting algorithm, which belongs to the divide-and-conquer method. Its basic idea is to separate the records to be sorted into two independent parts through a sorting process. If the keywords of one part of the records are smaller than the keywords of the other part, the two parts of the records can be sorted separately to achieve the order of the entire sequence; Python is a high-level programming language, widely used in data analysis, machine learning and other fields. Python's concise syntax and rich libraries make it the first choice for beginners and professionals.
[0107] Step S17, inputting the target user's question text into a preset large language model to obtain a target answer to the target question.
[0108] The target user's question text is input into the preset large language model. The text not only contains the user's question, but also provides background introduction and relevant details, which can help the preset large language model better answer the target user's target question.
[0109] In summary, the present invention provides an intelligent customer service question-answering method based on a large language model and a knowledge graph, the method comprising: constructing a knowledge graph of a target domain; based on the knowledge graph of the target domain, performing LoRA fine-tuning on a preset large language model; obtaining a target question of a target user, and inputting the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes several keywords; constructing several query statements according to the keyword set; searching in the knowledge graph of the target domain according to several query statements to obtain fill-in content; combining the fill-in content with the target question of the target user to construct the question text of the target user; inputting the question text of the target user into a preset large language model to obtain a target answer to the target question. After constructing the knowledge graph of the target domain, the present invention uses the knowledge graph to perform LoRA fine-tuning on the preset large language model, which can better complete the training of the model, and the present invention can help the model better understand the problem by constructing the question text of the target user, which is conducive to the model accurately hitting the problem.
[0110] The loss function proposed in the present invention combines multiple loss terms, so that the model can achieve better comprehensive performance in classification accuracy, generalization ability, and robustness. Regularization loss helps prevent the model from overfitting on training data and improves performance on new data; adversarial loss can enhance the robustness of the model, making it perform better in the face of noise and abnormal data. By presetting weights, the impact of each loss term can be flexibly adjusted according to the needs of specific tasks, so that the large language model can be better adapted to specific tasks.
[0111] Based on the same inventive concept, the present invention provides an intelligent customer service question-answering device based on a large language model and a knowledge graph, the device comprising:
[0112] Graph construction module, used to build the knowledge graph of the target domain;
[0113] The fine-tuning module is used to fine-tune the preset large language model based on the knowledge graph of the target domain;
[0114] A word set construction module is used to obtain a target question of a target user and input the target question into a preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes a number of keywords;
[0115] A statement building module, used to build several query statements based on a keyword set;
[0116] The filling module is used to search the knowledge graph of the target domain according to several query statements to obtain the filling content;
[0117] A text generation module is used to combine the fill-in content with the target user's target question to construct the target user's question text;
[0118] The answer module is used to input the question text of the target user into a preset large language model to obtain a target answer to the target question.
[0119] Based on the same inventive concept, the present invention also provides an electronic device, including:
[0120] processor;
[0121] a memory for storing processor-executable instructions;
[0122] Among them, the processor is configured to execute to implement the intelligent customer service question and answer method based on a large language model and a knowledge graph as provided above.
[0123] Based on the same inventive concept, the present application also provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by the processor of an electronic device, the electronic device can execute and implement the intelligent customer service question and answer method based on a large language model and a knowledge graph as provided above.
[0124] Since the electronic device introduced in this embodiment is an electronic device used to implement the information processing method in the embodiment of the present invention, based on the information processing method introduced in the embodiment of the present invention, a person skilled in the art can understand the specific implementation of the electronic device of this embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present invention is not described in detail here. As long as the electronic device used by a person skilled in the art to implement the information processing method in the embodiment of the present invention, it belongs to the scope of protection of the present invention.
[0125] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0126] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0129] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0130] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. An intelligent customer service question-answering method based on a large language model and knowledge graph, characterized in that: The method comprises: Build a knowledge graph for the target domain; Based on the knowledge graph of the target domain, the preset large language model is fine-tuned by LoRA, including: extracting a training data set from the knowledge graph of the target domain; taking the attention mechanism layer and / or the feedforward network layer in the preset large language model as the target layer, and applying LoRA; initializing the weight of LoRA and determining the rank of LoRA; determining the target loss function, and training the target layer of the preset large language model with the training data set; when the preset training requirements are met, saving the latest neural network parameters, and taking the preset large language model corresponding to the latest neural network parameters as the preset large language model after LoRA fine-tuning, wherein the formula of the target loss function includes: in, and All are preset weights. is the number of samples in the training data set, is the sample category, For the The samples belong to The true label of the class sample category, where the true label includes 0 or 1, For the The samples belong to The probability of the class sample category, is the preset regularization coefficient, To preset the weight parameters in the large language model, To combat losses; Obtaining a target question of a target user, and inputting the target question into the preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes a plurality of keywords; Constructing several query statements according to the keyword set; Searching the knowledge graph of the target domain according to several query statements to obtain filling content; Combining the filled content with the target question of the target user to construct the question text of the target user; The target user's question text is input into the preset large language model to obtain a target answer to the target question.
2. The intelligent customer service question-answering method based on a large language model and a knowledge graph as claimed in claim 1, characterized in that: Combating losses, including: in, is the preset weight, is the discriminator, For the generator, For the input samples.
3. The intelligent customer service question-answering method based on a large language model and a knowledge graph as claimed in claim 1, characterized in that: Build a knowledge graph in the target domain, including: According to the target domain, data is extracted from the data source, including entity recognition, relationship extraction and attribute extraction; Determine the framework of the knowledge graph of the target domain; Map the extracted entities to entity types in the framework and assign corresponding attribute values to each entity; Map the relationships between several entities to the relationship types in the framework and assign corresponding attribute values to each relationship.
4. The intelligent customer service question-answering method based on a large language model and a knowledge graph as claimed in claim 1, characterized in that: Meet pre-set training requirements, including: The maximum number of training times is reached and the accuracy of the output of the preset large language model is higher than a preset threshold.
5. The intelligent customer service question-answering method based on a large language model and a knowledge graph as claimed in claim 4, characterized in that: The formula for the accuracy of the output of the preset large language model includes: in, is the accuracy of the output of the large language model, is the number of samples that correctly answer the question, is the number of samples that incorrectly answer the question, is the number of samples that did not answer the question.
6. An intelligent customer service question-answering device based on a large language model and knowledge graph, characterized in that: The intelligent customer service question-answering method based on a large language model and a knowledge graph applied to any one of claims 1-5, the device comprising: Graph construction module, used to build the knowledge graph of the target domain; A fine-tuning module, used to perform LoRA fine-tuning on a preset large language model based on the knowledge graph of the target domain; A word set construction module, used to obtain a target question of a target user, and input the target question into the preset large language model to extract a keyword set corresponding to the target question, wherein the keyword set includes a plurality of keywords; A statement construction module, used to construct a number of query statements according to the keyword set; A filling module, used to search the knowledge graph of the target domain according to a number of query statements to obtain filling content; A text generation module, used to combine the filling content with the target question of the target user to construct the question text of the target user; The answering module is used to input the question text of the target user into the preset large language model to obtain a target answer to the target question.
7. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute to implement the intelligent customer service question and answer method based on a large language model and a knowledge graph as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to implement the intelligent customer service question-answering method based on a large language model and a knowledge graph as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Agricultural intelligent question and answer method and system supporting multi-mode and multi-round dialogues
CN117370506A
Security propaganda and education recommendation method and system based on demand portrait and content label
CN118797173A