Typhoon information question answering method and device based on large language model, equipment and medium
By using a combination of large language models and knowledge graphs in the Typhoon information Q&A system, the limitations of existing systems in handling complex queries and providing context-related answers are solved, and higher professionalism and overall performance are achieved.
Patent Information
- Application Number
- CN202510041218.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-05-09
AI Technical Summary
The existing question and answer system has limitations in handling complex queries and providing context-related answers, making it difficult to improve the professionalism and overall performance of typhoon meteorological problems.
The typhoon information question-and-answer method based on the large language model is used to pre-process and entity recognition by obtaining user questions, and the typhoon field big models and knowledge graphs are used for information retrieval and context understanding to generate professional and relevant answers.
It improves the professionalism of answering typhoon meteorological questions, reduces the hallucination questions of large language models, and improves the overall performance of typhoon questions.
Smart Images

Figure BDA0005237002980000082 
Figure BDA0005237002980000083 
Figure BDA0005237002980000085
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a typhoon information question-answering method, device, equipment and medium based on a large language model. Background Art
[0002] With the development of artificial intelligence technology, significant progress has been made in the field of natural language processing (NLP), especially in the construction of question-answering systems. Question-answering systems are designed to understand and answer questions raised by users and provide accurate and timely information feedback. In the field of typhoon meteorology, users can ask complex, multi-dimensional questions, and the system can understand and answer these questions to improve the public's knowledge and understanding of typhoons. In emergency situations, such as extreme typhoon weather events, rapid and accurate typhoon information acquisition is crucial for emergency response and disaster management. At the same time, typhoon meteorological information has an important impact on agriculture, transportation, energy, urban planning and other fields. Question-answering systems can promote decision-making in these fields. Therefore, building an efficient typhoon question-answering system is of great significance to improving information acquisition efficiency and decision-making quality.
[0003] However, existing question-answering systems mainly rely on simple keyword matching or rule-based methods to retrieve answers, which have limitations in handling complex queries and providing context-sensitive answers. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a typhoon information question and answer method, device, equipment and medium based on a large language model, which can improve the professionalism of answering model typhoon meteorological questions, reduce the illusion problem of LLM, and improve the overall performance of typhoon question answering.
[0005] The embodiment of the present application provides a typhoon information question-answering method based on a large language model, including:
[0006] Obtain the user's typhoon information question, preprocess and entity identify the user's question, and determine the entity label of the question; based on the typhoon field big model and the typhoon field knowledge graph, according to the entity label, guide the typhoon field knowledge graph to traverse to the next node with the highest correlation with the typhoon information question and store it in the target node queue; return the target node queue, and based on the attention mechanism, format the context information integrated into the target node queue into prompt information; based on the typhoon field big model, determine the answer to the typhoon information question according to the prompt information.
[0007] Optionally, the user's typhoon information question is preprocessed through the following steps: define multiple optimal tags for multiple word segments of the question, and obtain a tokenized sequence of the multiple optimal tags based on the Forward-DP Backward-A* algorithm; convert the tokenized sequence into a target vector; and weight the target vector using the probability calculated by the equation to determine the final vector.
[0008] Optionally, a typhoon field big model is constructed by the following steps: using a typhoon field data set and introducing a LoRA fine-tuning model to construct a typhoon field big model; wherein the typhoon field big model is fine-tuned by the following steps: performing multiple fine-tuning parameters; organizing multiple typhoon text data in the typhoon field data set according to a specific format to obtain multiple organized data; converting the multiple organized data into JSON format and inputting them into the base model of the typhoon field big model to fine-tune the typhoon field big model to obtain an adjusted typhoon field big model.
[0009] Optionally, based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, the step of guiding the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and storing it in the target node queue includes: using BERT for embedding, initializing the seed node and the retrieved related node queue, and for each seed node, adding its neighbor nodes to the candidate neighbor queue; when the retrieved node queue and the candidate neighbor queue are not empty, respectively taking out the earliest reasoning path and candidate neighbors from the two queues; using the knowledge graph traversal agent of the fine-tuned big model to sort the candidate neighbors to determine the next node to be visited; according to the sorting result of the big model, selecting multiple nodes with the highest ranking as the next nodes to be visited, and adding the newly visited nodes to the retrieved node queue, adding their neighbor nodes to the candidate neighbor queue, and calculating the retrieval node budget; if the retrieval node budget does not reach the preset retrieval node budget or the candidate neighbor queue is not empty, reinitializing the seed node until the preset retrieval node budget is reached or the candidate neighbor queue is empty.
[0010] Optionally, the target node queue is returned, and based on the attention mechanism, the step of formatting the integrated context information into prompt information includes: vectorizing the returned retrieved nodes through a word embedding layer; weighted summing up the embedding vector sets of all retrieved nodes according to the attention weight to obtain the final context vector; converting the context vector into an interpretable text fragment, and integrating it into a predefined prompt template to form prompt information.
[0011] Optionally, the step of determining the answer to the typhoon information question includes: generating an answer to the typhoon information question based on the language understanding and generation capabilities of the large model and in combination with contextual information in the prompt information.
[0012] In the second aspect, the present application also provides a typhoon information question and answer device based on a large language model, including: an entity label determination module, used to obtain a user's typhoon information question, and pre-process and entity identify the user's question to determine the entity label of the question; a node determination module, used to guide the typhoon field knowledge graph to traverse to the next node with the highest correlation with the typhoon information question based on the typhoon field large model and the typhoon field knowledge graph according to the entity label and store it in the target node queue; a prompt information determination module, used to return the target node queue, and based on the attention mechanism, format the context information integrated into the target node queue into prompt information; an answer determination module, used to determine the answer to the typhoon information question based on the typhoon field large model and the prompt information.
[0013] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0014] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0015] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0016] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0017] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0018] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0019] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0020] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0021] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0022] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0023] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0024] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0025] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0026] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0027] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0028] The typhoon information question-and-answer method, apparatus, device and medium based on a large language model provided in the embodiments of the present application can improve the professionalism of answering model typhoon meteorological questions, reduce the illusion problem of LLM, and improve the overall performance of answering typhoon questions.
[0029] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 A flowchart of a typhoon information question-answering method based on a large language model provided in an embodiment of the present application;
[0032] Figure 2 A flowchart of another typhoon information question-answering method based on a large language model provided in an embodiment of the present application;
[0033] Figure 3 A structural block diagram of a typhoon information question-and-answer device based on a large language model provided in an embodiment of the present application;
[0034] Figure 4 This is a diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0036] First, the application scenarios to which the present application is applicable are introduced. The present application can be applied in the field of natural language processing technology.
[0037] Research has found that with the development of artificial intelligence technology, the field of natural language processing (NLP) has made significant progress, especially in the construction of question-answering systems. The question-answering system aims to understand and answer questions raised by users and provide accurate and timely information feedback. In the field of typhoon meteorology, users can ask complex and multi-dimensional questions, and the system can understand and answer these questions to improve the public's awareness and understanding of typhoon knowledge; in emergency situations, such as extreme typhoon weather events, fast and accurate typhoon information acquisition is crucial for emergency response and disaster management; at the same time, typhoon meteorological information has an important impact on agriculture, transportation, energy, urban planning and other fields, and the question-answering system can promote decision-making in these fields. Therefore, building an efficient typhoon question-answering system is of great significance to improving information acquisition efficiency and decision-making quality.
[0038] However, existing question-answering systems mainly rely on simple keyword matching or rule-based methods to retrieve answers, which have limitations in handling complex queries and providing context-sensitive answers.
[0039] Based on this, the embodiments of the present application provide a typhoon information question and answer method, device, equipment and medium based on a large language model, which can improve the professionalism of answering model typhoon meteorological questions, reduce the illusion problem of LLM, and improve the overall performance of typhoon question answering.
[0040] In addition, the traditional question-answering system lacks deep integration of typhoon domain knowledge, which makes it impossible to fully understand and answer questions involving domain expertise. However, the fine-tuned Large Language Model (LLM) can more accurately retrieve the most relevant information to the question and understand the context and semantic requirements of the question during the knowledge graph (KG) retrieval process.
[0041] The combination of KG and LLM is currently a hot research direction in the field of artificial intelligence. This combination takes advantage of the structured knowledge storage capacity of KG and the powerful semantic understanding and generation capabilities of LLM, aiming to improve the system's ability to handle complex queries, enhance the accuracy and contextual understanding of the question-answering system, and optimize information retrieval and natural language generation tasks. By combining the entities, relationships, and attributes in KG with the context-awareness of LLM, a question-answering system that can understand and answer complex questions can be created. The current mainstream combination direction is to split the graph into small triplets and provide them to LLM for further training to improve its answering ability, but this does not solve the LLM's hallucination problem well and weakens the model's understanding of context. The method of using LLM to guide the traversal of KG and generate prompts can more effectively utilize the information in KG and improve the overall performance and user experience of the question-answering system.
[0042] See also Figure 1 , Figure 1 The flowchart of a typhoon information question-answering method based on a large language model provided in an embodiment of the present application is shown in FIG. Figure 1 As shown in , the typhoon information question-answering method based on a large language model provided in an embodiment of the present application includes:
[0043] S101. Obtain a user's typhoon information question, perform preprocessing and entity recognition on the user's question, and determine an entity tag for the question.
[0044] Specifically, the user's typhoon information question can be preprocessed through the following steps: define multiple optimal tags for multiple word segments of the question, and obtain a tokenized sequence of multiple optimal tags based on the Forward-DP Backward-A* algorithm; convert the tokenized sequence into a target vector; and weight the target vector using the probability calculated by the equation to determine the final vector.
[0045] As an example, see Figure 2, Figure 2 A flowchart of another method for obtaining a user's typhoon information question provided by an embodiment of the present application, preprocessing and entity recognition of the user's question, and determining the entity label of the question. Figure 2 As shown in , the present application can optimize word segmentation based on a method called OpTok architecture, which can generate multiple tokenized sentences as candidate sentences and convert them into a single vector using their probabilities during the training phase. Specifically, the best tags s1′,...,s1′ of the N best word segmentations of the sentence can be first defined. n ′,...,s N ′, and then use the Forward-DPBackward-A* algorithm to obtain the N best word segmentations. Secondly, convert the tokenized sequences into vectors as follows:
[0046]
[0047] Where g is a neural encoder that encodes the token sequence.
[0048] Finally, the final vector of the sentence is calculated by weighting the vectors of the candidate sentences using the probability calculated by the equation, as follows:
[0049]
[0050] In the formula, p is used to calculate s n ′Probability function of the state, a n Yes n ′, the probability weight, h s is the weighted average of all labeled vectors and satisfies the constraints The probability is normalized.
[0051] After the preprocessing is completed, the step of performing entity recognition on the segmented text includes: assuming that the segmented text sequence is x1, x2, ..., x n ,y1,y2,...,y n is the corresponding entity label, and the model predicts the probability P of the label sequence corresponding to a given observation sequence as:
[0052]
[0053] Where N is the length of the sequence, K is the number of feature templates, and λ k is the model parameter, F k (·) is the feature function and Z(x) is the normalization factor that ensures that the sum of the probabilities of all possible label sequences is 1.
[0054] Here, after obtaining the entity with the largest P, we input LLM and then conduct a subsequent similarity comparison with related entities in the KG.
[0055] S102. Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node that is most relevant to the typhoon information problem and store it in the target node queue.
[0056] Specifically, a typhoon field big model can be constructed by the following steps: using a typhoon field data set and introducing a LoRA fine-tuning model to construct a typhoon field big model; wherein, the typhoon field big model is fine-tuned by the following steps: performing multiple fine-tuning parameters; organizing multiple typhoon text data in the typhoon field data set according to a specific format to obtain multiple organized data; converting the multiple organized data into JSON format and inputting them into the base model of the typhoon field big model to fine-tune the typhoon field big model to obtain an adjusted typhoon field big model.
[0057] Specifically, based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, the steps of guiding the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and storing it in the target node queue include: using BERT for embedding, initializing the seed node and the retrieved related node queue, and for each seed node, adding its neighbor node to the candidate neighbor queue; when the retrieved node queue and the candidate neighbor queue are not empty, dequeuing the earliest reasoning path and candidate neighbor from the two queues respectively; using the knowledge graph traversal agent of the fine-tuned big model to sort the candidate neighbors to determine the next node to be visited; according to the sorting result of the big model, selecting multiple nodes with the highest ranking as the next nodes to be visited, and adding the newly visited node to the retrieved node queue, adding its neighbor node to the candidate neighbor queue, and calculating the retrieval node budget; if the retrieval node budget does not reach the preset retrieval node budget or the candidate neighbor queue is not empty, reinitializing the seed node until the preset retrieval node budget is reached or the candidate neighbor queue is empty.
[0058] As an example, when building a large model in the typhoon field, the LoRA layer can be introduced in the self-attention layer of the base model. It adjusts the weight of the model by introducing a low-rank matrix, further reducing the computing resources required for fine-tuning and making the fine-tuning process more efficient. The typhoon text data used for fine-tuning is organized in a specific format, such as [{"instruction":"","input":"","output":"","system":""}], where instruction is the user instruction, input is the input text block, output is the model answer, and system is the system prompt word.
[0059] Set the fine-tuning intrinsic dimension r, the scaling factor is twice r, the learning rate α, the batch size batch_size and the training cycle Epoch and other parameters, convert the organized data into JSON format and input it into the base model for fine-tuning to obtain the typhoon domain LLM (typhoon domain large model).
[0060] Specifically, a KG traversal agent based on fine-tuned LLM can be designed to guide KG traversal to the next node with the highest relevance to the question and store it in a queue. For a question q on a set of data sets D, a knowledge graph G = {V, E, X} is constructed, which contains a node set V, an edge set E, and a node feature set X. Suppose the graph traversal function guided by the fine-tuned LLM is f, the number of retrieved nodes is k, and the BERT search function is g.
[0061] Among them, BERT is used for embedding through the following formula to initialize the seed node and the retrieved related node queue. For each seed node, its neighbor nodes are added to the candidate neighbor queue:
[0062] Initialize seed node: V s =g(V,X,q),
[0063] Initialize the retrieved related node queue: P = [{v i}|v i ∈V s ],
[0064] Initialize candidate neighbor queue: C = [N i |v i ∈V s ],
[0065] Initialize the retrieved node counter:
[0066] Where V s is the initialization seed channel, P is the inference path queue. For each seeding channel v i ∈V s , its adjacent channel node N i Add to the candidate neighbor queue C.
[0067] As an example, given a question q, the LLM-based graph traversal agent reasoned about the retrieved nodes Then generate the next node s j+1 as follows:
[0068]
[0069] In the formula, Concatenate the information of previously retrieved nodes. For the selection of graph traversal function f(·), the Roberta-base encoder model is used, the corresponding g(·) is another encoder model, and φ(·) is the inner product measuring the embedding similarity.
[0070] This approach alleviates the hallucination problem of LLM and enhances reasoning capabilities by integrating the commonsense knowledge originally encoded in the parameters with the enhanced reasoning capabilities inherited from instruction tuning by predicting the next relevant node based on the already acquired nodes.
[0071] As an example, during the query process, the graph nodes can be vectorized, and the value of the dimension t is the number of times the term appears in the graph. The graph d can be described in the following vector form:
[0072]
[0073] As with the graph, the query of question q can be represented as the following vector form:
[0074]
[0075] In the formula, w di and w qi (0≤i≤k) is a floating point number representing the frequency of each term in the dataset.
[0076] According to the cosine similarity function, the similarity between two vectors can be defined as:
[0077]
[0078] The node with the highest similarity ranking is selected as the next node to be visited, and the remaining m-1 nodes are added to the candidate neighbor queue.
[0079] Specifically, iteratively dequeue the earliest enqueued reasoning path / candidate neighbor P from the reasoning path queue P and the candidate neighbor queue C i / C i , and use the fine-tuned LLM-based graph traversal agent according to Eq. C i Sort the neighbors of the queue in C according to their ranking. i The m highest-ranked paragraph nodes are selected as the nodes to be visited next, and the candidate neighbor queue and reasoning path queue are updated accordingly. The above process terminates when the candidate neighbor queue becomes empty or the preset retrieval paragraph budget n is reached.
[0080] S103: Return the target node queue, and based on the attention mechanism, format the context information integrated with the target node queue into prompt information.
[0081] Specifically, the target node queue is returned, and based on the attention mechanism, the steps of formatting the integrated context information into prompt information include: vectorizing the returned retrieved nodes through a word embedding layer; weighted summing up the embedding vector sets of all retrieved nodes according to the attention weight to obtain the final context vector; converting the context vector into an interpretable text fragment, and integrating it into a predefined prompt template to form prompt information.
[0082] S104. Based on the typhoon field large model and according to the prompt information, determine the answer to the typhoon information question.
[0083] Specifically, the step of determining the answer to the typhoon information question includes: generating an answer to the typhoon information question based on the language understanding and generation capabilities of the large model and combining the context information in the prompt information.
[0084] As an example, we can first vectorize the returned retrieved node (the next node in the target queue that is most relevant to the question) through a word embedding layer:
[0085] e i =Embedding(n i ),
[0086] In the formula, e i is node n i is the embedding vector of , and Embedding(·) is the embedding function.
[0087] Among them, the attention weight α can be expressed as:
[0088]
[0089] V={e1,e2,...,e N},
[0090] Q=Embedding(q),
[0091] Where Q is the query vector, K is the key vector set, and V is the embedding vector set of all search nodes. q is the question, T is the temperature parameter, and d k is the dimension of the key vector, Used to scale dot products to prevent the vanishing gradient problem. The softmax(·) function ensures that the sum of the output weights is 1, expressed as a probability distribution.
[0092] According to the attention weight α, the embedding vector set V of all retrieval nodes is weighted and summed to obtain the final context vector C:
[0093]
[0094] The context vector C is converted into an interpretable text fragment and integrated into the predefined prompt template to form the final prompt information.
[0095] Finally, the language comprehension and generation capabilities of the LLM are used to combine the contextual information in the prompt to generate answers to the questions.
[0096] The typhoon question-and-answer method, device, equipment, medium and product provided in the embodiments of the present application are based on a large model of the typhoon field and a knowledge graph of the typhoon field, determine prompt information, and generate answers through the prompt information, which can improve the professionalism of answering model typhoon meteorological questions, reduce the illusion problem of LLM, and improve the overall performance of typhoon question-and-answer.
[0097] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0098] Based on the same inventive concept, the embodiment of the present application also provides a typhoon question-answering control device for implementing the typhoon question-answering method involved in the above-mentioned typhoon question. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more typhoon question-answering devices provided below can refer to the limitations of the typhoon question-answering method above, and will not be repeated here.
[0099] Please refer to Figure 3 In an exemplary embodiment, a typhoon question-answering device is provided, comprising:
[0100] The entity tag determination module 10 is used to obtain the typhoon information question of the user, perform preprocessing and entity recognition on the user's question, and determine the entity tag of the question;
[0101] A node determination module 20 is used to guide the typhoon field knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem based on the typhoon field big model and the typhoon field knowledge graph and according to the entity label, and store it in the target node queue;
[0102] A prompt information determination module 30 is used to return the target node queue and format the context information integrated with the target node queue into prompt information based on an attention mechanism;
[0103] The answer determination module 40 is used to determine the answer to the typhoon information question based on the typhoon field model and the prompt information.
[0104] Each module in the above-mentioned typhoon information question-answering device based on a large language model can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0105] In an exemplary embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a question-and-answer method for typhoon problems is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0106] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0108] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0109] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0110] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0111] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0112] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0113] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0114] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0115] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0116] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0117] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0118] Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question;
[0119] Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue;
[0120] Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism;
[0121] Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
[0122] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0123] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0124] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A typhoon information question-answering method based on a large language model, characterized in that: The method comprises: Obtaining a user's typhoon information question, and performing preprocessing and entity recognition on the user's question to determine an entity tag for the question; Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, guide the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem and store it in the target node queue; Returning the target node queue, and formatting the context information integrated from the target node queue into prompt information based on the attention mechanism; Based on the typhoon field large model, the answer to the typhoon information question is determined according to the prompt information.
2. The method according to claim 1, characterized in that: The following steps are used to pre-process the user's typhoon information: Define multiple optimal tags for multiple word segmentations of the problem, and obtain the tokenized sequences of multiple optimal tags based on the Forward-DP Backward-A* algorithm; converting the tokenized sequence into a target vector; The target vector is weighted using the probability calculated by Eq. to determine the final vector.
3. The method according to claim 1, characterized in that: The following steps are used to construct a large typhoon domain model: Use the typhoon data set and introduce the LoRA fine-tuning model to build a large typhoon model; Among them, the typhoon field large model is fine-tuned through the following steps: Perform multiple fine-tuning parameters; Organizing a plurality of typhoon text data in a typhoon field data set according to a specific format to obtain a plurality of organized data; The multiple organizational data are converted into JSON format and input into the base model of the typhoon field large model to fine-tune the typhoon field large model to obtain the adjusted typhoon field large model.
4. The method according to claim 1, characterized in that: Based on the typhoon domain big model and the typhoon domain knowledge graph, according to the entity label, the steps of guiding the typhoon domain knowledge graph to traverse to the next node with the highest correlation with the typhoon information question and storing it in the target node queue include: Use BERT for embedding, initialize the seed nodes and the retrieved related node queues, and for each seed node, add its neighbor nodes to the candidate neighbor queue; When the retrieved node queue and candidate neighbor queue are not empty, the earliest reasoning path and candidate neighbor are dequeued from the two queues respectively; Use a knowledge graph traversal agent with a fine-tuned large model to rank candidate neighbors to determine the next node to visit; According to the sorting results of the large model, select the highest-ranked nodes as the next nodes to be visited, add the newly visited nodes to the retrieved node queue, add their neighbor nodes to the candidate neighbor queue, and calculate the retrieval node budget; If the retrieval node budget amount does not reach the preset retrieval node budget amount or the candidate neighbor queue is not empty, the seed node is reinitialized until the preset retrieval node budget amount is reached or the candidate neighbor queue is empty.
5. The method according to claim 1, characterized in that: Returning the target node queue, the steps of formatting the integrated context information into prompt information based on the attention mechanism include: Vectorize the returned retrieved nodes through the word embedding layer; The embedding vector sets of all retrieval nodes are weighted and summed according to the attention weights to obtain the final context vector; The context vector is converted into an interpretable text snippet and integrated into the predefined prompt template to form the prompt information.
6. The method according to claim 1, characterized in that: The step of determining the answer to the typhoon information question according to the prompt information includes: Based on the language understanding and generation capabilities of the large model, combined with the contextual information in the prompt information, answers to typhoon information questions are generated.
7. A typhoon information question-answering device based on a large language model, characterized in that: The device comprises: An entity tag determination module is used to obtain a user's typhoon information question, perform preprocessing and entity recognition on the user's question, and determine the entity tag of the question; A node determination module, for guiding the typhoon field knowledge graph to traverse to the next node with the highest correlation with the typhoon information problem based on the typhoon field big model and the typhoon field knowledge graph and according to the entity label, and storing the node in the target node queue; A prompt information determination module, used for returning the target node queue and formatting the context information integrated with the target node queue into prompt information based on an attention mechanism; The answer determination module is used to determine the answer to the typhoon information question based on the typhoon field large model and the prompt information.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Multi-round question and answer method and system based on knowledge graph
CN117271799A
Intelligent question and answer method, system and server based on knowledge graph and large language model
CN118446320A
Cited By
Knowledge graph retrieval reasoning method and system based on big language model enhancement
CN120123487A