Output control method and device of large language model and readable storage medium

By introducing a domain knowledge base in electronic devices to control the output of large language models, the problem of low accuracy in generating unreasonable text and domain-specific answers is solved, and the accuracy and accuracy of the output is improved.

CN119599028APending Publication Date: 2025-03-11SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311156850.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-06
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

Large language models may produce unreasonable content when generating text, and when facing specific domain tasks, the accuracy of generating answers is low, resulting in a decrease in the accuracy of electronic device output.

Method used

By introducing a domain knowledge base of preset fields into electronic devices, we can judge the correlation between the target problem and the preset fields. When the target question is not related to the preset domain, the answer from the large language model is used as the output; when related, the target answer is determined based on the domain knowledge base, thereby improving the accuracy of the output.

Benefits of technology

By controlling the output of large language model, the accuracy of generated text and the accuracy of electronic device output are improved, especially when facing specific domain tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599028A_ABST
    Figure CN119599028A_ABST
Patent Text Reader

Abstract

The invention provides an output control method and device of a large language model and a readable storage medium, relates to the technical field of natural language processing, and can improve the accuracy of text generation of the large language model so as to improve the output accuracy of electronic equipment. The method is applied to the electronic equipment, the electronic equipment comprises a large language model and a field knowledge base of a preset field, and the method comprises the steps that a to-be-searched target question is obtained; when the target question is not related to the preset field, determining a model answer of the large language model to the target question as a target answer; when the target question is related to the preset field, determining a target answer corresponding to the target question based on the field knowledge base; and outputting the target answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to an output control method, device and readable storage medium for a large language model. Background Art

[0002] With the development of artificial intelligence, large language models (LLMs) are widely used in human-computer interaction. Among them, large language models are deep learning models used to generate natural language texts. They usually use neural networks to learn the structure and rules of language and use this knowledge to generate new texts.

[0003] At present, large language models have achieved many results in the field of natural language processing, such as text generation, machine translation, question-answering systems, etc. Compared with models with small parameters, large language models have obvious advantages in natural language understanding and reasoning, but there are also some problems and limitations, such as the possibility of generating some unreasonable texts, or performing poorly in the face of tasks in certain fields, which will reduce the accuracy of the text generated by the large language model, thereby reducing the accuracy of the output of electronic devices. Summary of the invention

[0004] The embodiments of the present application provide a method, device and readable storage medium for controlling the output of a large language model, which can improve the accuracy of text generated by the large language model, thereby improving the accuracy of the output of the electronic device.

[0005] In order to achieve the above-mentioned objectives, in a first aspect, an embodiment of the present application provides an output control method of a large language model, which is applied to an electronic device, wherein the electronic device includes a large language model and a domain knowledge base of a preset domain, and the method includes: obtaining a target question to be searched; when the target question is not related to the preset domain, determining a model answer of the large language model to the target question as the target answer; when the target question is related to the preset domain, determining a target answer corresponding to the target question based on the domain knowledge base; and outputting the target answer.

[0006] The output control method of the large language model provided in the embodiment of the present application is that when the electronic device obtains the target question to be searched, it will judge the relevance between the target question and the preset field. When it is determined that the target question is not relevant to the preset field, the answer determined by the large language model is output as the target answer; when it is determined that the target question is relevant to the preset field, based on the domain knowledge base, the answer determined by the domain knowledge base is output as the target answer. Thus, the output of the large language model can be controlled to improve the accuracy of the output of the large language model, thereby improving the accuracy of the output of the electronic device.

[0007] In a second aspect, an embodiment of the present application provides an output control device of a large language model, which is applied to an electronic device. The electronic device includes a large language model and a domain knowledge base of a preset domain. The control device includes: an acquisition unit: used to acquire a target question to be searched; a determination unit: used to determine the model answer of the large language model to the target question as the target answer when the target question is not related to the preset domain; when the target question is related to the preset domain, determine the target answer corresponding to the target question based on the domain knowledge base; an output unit: used to output the target answer.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the output control method in the first aspect as described above.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on an electronic device, the electronic device executes the output control method in the first aspect above.

[0010] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the steps of the method described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 1 ;

[0012] Figure 2 An index of a domain knowledge base provided in an embodiment of the present application Figure 1 ;

[0013] Figure 3 An index of a domain knowledge base provided in an embodiment of the present application Figure 2 ;

[0014] Figure 4 A flowchart of an output control method for a large language model provided in an embodiment of the present application;

[0015] Figure 5 A question-and-answer flow chart of another large language model output control method provided in an embodiment of the present application;

[0016] Figure 6 A schematic diagram of the structure of an output control device for a large language model provided in an embodiment of the present application;

[0017] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0019] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections. And the terms used in this specification of the application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of the application and the appended claims, unless the context clearly indicates otherwise, the singular forms of "one", "an" and "the" are intended to include plural forms. The terms "first", "second", "third", etc. are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0020] The output control method of the large language model provided in the embodiment of the present application can be applied to electronic devices, wherein the electronic device can be a mobile terminal or a non-mobile terminal. For example, the mobile terminal can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, etc., and the non-mobile terminal can be a personal computer (personal computer, PC), a television (television, TV) or a self-service integrated machine, etc., and the embodiment of the present application does not limit this.

[0021] It is understandable that the user can input the target question to the electronic device through the interactive interface of the electronic device, so that the electronic device outputs the answer corresponding to the question through the large language model stored internally.

[0022] However, large language models may inherit and amplify some biased content in the training data, which may cause large language models to generate some unreasonable text. In addition, the domain depth of the knowledge base of large language models is limited, so when faced with some vertical field questions, the large language model will generate answers with low accuracy, thereby reducing the accuracy of electronic device output.

[0023] To this end, the present application provides an output control method for a large language model, which can improve the accuracy of text generated by the large language model, thereby improving the accuracy of the output of the electronic device.

[0024] First, the structure of an electronic device to which the output control method of a large language model provided in an embodiment of the present application is applicable is exemplarily described. Figure 1 As shown, the electronic device includes: a large language model and a domain knowledge base of a preset domain.

[0025] Among them, the large language model is a model for general fields, focusing on building common sense knowledge in various fields. After receiving the target question, the large language model will convert the input target question into a vector sequence, and process it through a multi-layer neural network to finally generate a model answer.

[0026] A domain knowledge base (also called an industry knowledge base or vertical domain knowledge base) is a knowledge base for a specific field. It focuses on building professional knowledge in different fields, industries, and enterprises to provide professional knowledge services in a specific field.

[0027] In the embodiment of the present application, the domain knowledge base can be a knowledge base of any field, industry or enterprise. For example, the domain knowledge base can be a knowledge base for government policy construction, a catering field knowledge base or an entertainment field knowledge base. The embodiment of the present application does not limit this.

[0028] In some embodiments, the domain knowledge base includes a keyword base, a question base, and an answer base.

[0029] The keyword library includes multiple keywords related to the preset field.

[0030] Since some keywords are directly related to the preset field or specific usage scenarios, a keyword library containing multiple keywords related to the preset field can be constructed, so that when the electronic device obtains the target question and the model answer (that is, the text generated by the large language model) and segmentes the target question and the model answer, the segmentation results are traversed and identified in the keyword library to quickly determine whether the target question is a field-related question.

[0031] Exemplarily, when the domain knowledge base is constructed as a knowledge base for government policies, the keyword library may be a library including multiple keywords related to government policies. For example, the keyword library includes keywords such as "business A, policy A, government, department A" and the like.

[0032] In another embodiment, since the target question input by the user or the model answer may contain sensitive words, in order to avoid the electronic device answering the target question with sensitive words or outputting the model answer containing sensitive words, the keyword library can also be a library constructed by multiple sensitive words in a preset field. Thus, when the electronic device detects that the target question input by the user or the model answer contains sensitive words, the electronic device can directly refuse to answer the target question or refuse to output the model answer.

[0033] In an embodiment of the present application, a keyword library may be constructed by using a set collection to store keywords to improve recognition efficiency in the keyword library, and the recognition result is presented in a Boolean type, that is, when a keyword matching the segmentation is identified in the keyword library, yes is presented; when a keyword matching the segmentation is not identified in the keyword library, no is presented.

[0034] It should be noted that the above-mentioned method of constructing a keyword library is only an exemplary description. The embodiment of the present application has no special restrictions on the method of constructing a keyword library. Any method that suits the usage situation can be used for construction, and the embodiment of the present application does not impose any restrictions on this.

[0035] In some embodiments, the question bank includes a plurality of preset questions related to preset fields.

[0036] It is understandable that the question library may include any number of preset questions, such as 20, 30 or 40 questions, etc., and the embodiments of the present application are not limited to this.

[0037] It should be noted that the domain knowledge base requires users to manually construct or collect knowledge in a preset domain and form question-answer pairs. As described above, when the domain knowledge base is a knowledge base for government policies, the multiple preset questions included in the question base may be: preset question 1: "How to handle business A", preset question 2: "How to check the handling progress of business A", preset question 3: "When will policy A be updated", etc., and the embodiments of this application do not limit this.

[0038] In some embodiments, in the question library, each preset question has multiple different ways of expression.

[0039] Among them, multiple different expression methods can be constructed for each preset question, for example, 3, 4 or 5 methods, etc., and the embodiments of the present application do not limit this.

[0040] For example, the above-mentioned preset question 1 can be pre-constructed into three different expressions. Among them, the expression 1 of the preset question 1 is: "How to handle business A"; the expression 2 of the preset question 1 is: "Where to handle business A"; the expression 3 of the preset question 1 is: "How to handle business A".

[0041] In some embodiments, the answer library includes preset answers corresponding to respective preset questions.

[0042] In this embodiment, in the answer library, each preset answer also has multiple different expressions.

[0043] In an embodiment of the present application, a variety of different expressions of preset answers can be constructed for the same preset question, for example, 3, 4 or 5 expressions, etc., and the embodiment of the present application does not limit this.

[0044] For example, three different expressions of the preset answer 1 can be pre-constructed for the preset question 1. Among them, expression 1 of the preset answer 1: To handle business A, you need to prepare material A and go to department A for handling; expression 2 of the preset answer 1: First, you need to prepare material A, then go to department A and find employee A for handling; expression 3 of the preset answer 1: Please prepare material A first, and go to department A for handling during working days.

[0045] It should be noted that after constructing the keyword library, question library and answer library of the domain knowledge base, the search engine of the question library and knowledge base, i.e., the index, can be constructed using the similarity search open source library (Facebook aisimilarity search, Faiss). It is understandable that when an electronic device uses a preset question to search in the question library or uses a preset answer to search in the knowledge base, the corresponding preset question and preset answer can be quickly searched using the established index.

[0046] Among them, the preset questions in the question library are used to create an index, and the many-to-many data form of each question-answer pair in the domain knowledge base is split into one-to-many, forming a new question-answer pair dataset. For example, see Figure 2 As shown, the three expressions of the preset question 1 and the corresponding three expressions of the preset answer 1 are split into: 3 expressions of the preset answer 1 corresponding to expression 1 of the preset question 1, 3 expressions of the preset answer 1 corresponding to expression 2 of the preset question 1, and 3 expressions of the preset answer 1 corresponding to expression 3 of the preset question 1.

[0047] After the preset questions in the question bank are used to build the index, the Faiss tool is used to build the question-answer pair dataset. Faiss first maps the embedding vectors of each question statement. Then Faiss uses these embeddings to build the index. When searching, Faiss can return the index closest to the preset question and the preset answer corresponding to the index, thereby improving the working efficiency of the electronic device.

[0048] In an embodiment of the present application, the language model used for embedding can be a common language model such as Simbert simulation pre-training or Roberta Chinese pre-training model, and the embodiment of the present application is not limited to this.

[0049] Similarly, the target answers in the answer library are used to create an index, and the target answers with different expressions corresponding to the same preset question in the domain knowledge library are split. The multiple expressions of the target answers serve as indexes in turn, and the remaining expressions serve as indexed target answers. For example, see Figure 3 As shown, when statement 1 of the preset answer 1 acts as an index, statement 2 of the preset answer 1 and statement 3 of the preset answer 1 serve as indexed knowledge; when statement 1 of the preset answer 1 acts as an index, statement 2 of the preset answer 1 and statement 3 of the preset answer 1 serve as indexed knowledge; when statement 2 of the preset answer 1 acts as an index, statement 1 of the preset answer 1 and statement 3 of the preset answer 1 serve as indexed knowledge; when statement 3 of the preset answer 1 acts as an index, statement 1 of the preset answer 1 and statement 2 of the preset answer 1 serve as indexed knowledge.

[0050] In the embodiments of the present application, as can be seen above, the same preset question can be preset with multiple different expressions, and the corresponding target answer can also be preset with multiple different expressions, so that one preset question can form question-answer pairs with multiple different expressions, thereby increasing the matching coverage and improving the working efficiency of the electronic device.

[0051] It is understandable that the structure of the domain knowledge base described in the embodiments of the present application does not constitute a specific limitation on the domain knowledge base. In other embodiments of the present application, a specific domain knowledge base may include more or fewer libraries, or combine certain libraries.

[0052] In the following, in conjunction with specific embodiments, an output control method of a large language model provided by an embodiment of the present application is exemplarily described. It should be understood that the specific embodiments described herein are only used to explain the solution of the present application and are not used to limit the present application.

[0053] like Figure 4 FIG. 1 is a flow chart of an output control method of a large language model provided by an embodiment of the present application, and the method comprises the following steps:

[0054] Step S410: Obtain the target question to be searched.

[0055] Taking a mobile phone as an example, various types of search bars may be displayed on the mobile phone display, such as a search bar for weather query function, a search bar for song name query function, a search bar for restricted license plate number query function, a search bar for government policy construction query function, etc. When a user enters a target question in the search bar through the mobile phone display and triggers the start of the search control, the mobile phone receives the search instruction information and starts to execute the following search functions.

[0056] Step S420: When the target question is not related to the preset domain, the model answer of the large language model to the target question is determined as the target answer.

[0057] In some embodiments, the situation where the target question is not related to the preset field includes: there are no keywords in the target question, and there are no keywords in the model answer, and there is no first preset question similar to the target question in the question library, and there is no first preset answer similar to the model answer in the answer library.

[0058] Among them, determining that the keywords do not exist in the target question and the model answer is to segment the target question and the model answer, traverse the segmentation results and identify them in the keyword library, and when no keywords matching the segmentation results are identified in the keyword library, it is determined that the keywords do not exist in the target question and the model answer.

[0059] Determining whether there is no first preset question similar to the target question in the question library is to use the question library to search for similar questions. If there is a preset question that meets a preset similarity threshold, it can be considered that there is a first preset question similar to the target question in the question library.

[0060] It can be understood that the first preset answer is a preset answer in the answer library, and the first preset question is a preset question in the question library.

[0061] In an embodiment of the present application, a method for obtaining a similar first preset question and a first preset answer may be to return an index closest to the question and an answer corresponding to the index through Faiss.

[0062] To determine whether there is no first preset answer similar to the model answer in the answer library, the answer library is used to search for similar answers. If there is a preset answer that meets the preset similarity threshold, it can be considered that there is a first preset answer similar to the target answer in the answer library.

[0063] It should be noted that different similarity thresholds can be set according to actual user needs and different fields, and the embodiments of the present application are not limited to this.

[0064] In this embodiment, after the model answer is determined by the large language model, the electronic device will determine whether the target question is related to the preset domain through the domain knowledge base. When it is determined that the target question is not related to the preset domain, the model answer is determined as the target answer. Since the target question is determined not to be a question in the preset domain at this time, determining the model answer as the target answer does not affect the output accuracy of the large language model.

[0065] Step S430: When the target question is related to the preset domain, determine the target answer corresponding to the target question based on the domain knowledge base.

[0066] In some embodiments, situations where the target question is related to a preset field include: there are keywords in the target question; or, there are keywords in the model answer; or, there is a first preset question in the question library; or, there is a first preset answer in the answer library.

[0067] Among them, the specific implementation method of determining that there are keywords in the target question and the model answer, there is a first preset question in the question library, and there is a first preset answer in the answer library can refer to the principle in the above step S220, which will not be repeated here.

[0068] In this embodiment, when it is determined that the target question is related to the preset domain, the electronic device will not determine the model answer as the target answer, but will determine the preset answer corresponding to the target question through the domain knowledge base, and determine the preset answer as the target answer. Since the target question is determined to be a question in the preset domain, determining the preset answer as the target answer will improve the accuracy of the electronic device output.

[0069] Step S440: Output the target answer.

[0070] The output control method of the large language model provided in the embodiment of the present application is that when the electronic device obtains the target question to be searched, it will judge the relevance between the target question and the preset field. When it is determined that the target question is not relevant to the preset field, the answer determined by the large language model is output as the target answer; when it is determined that the target question is relevant to the preset field, based on the domain knowledge base, the answer determined by the domain knowledge base is output as the target answer. Thus, the output of the large language model can be controlled to improve the accuracy of the output of the large language model, thereby improving the accuracy of the output of the electronic device.

[0071] Next, the specific implementation method of the electronic device to determine the target answer is introduced in detail.

[0072] like Figure 5 As shown, it is a schematic diagram of a question-answering process of an output control method of a large language model provided by another embodiment of the present application. The specific question-answering process includes the following:

[0073] First, the target question to be searched is obtained, and then the large language model is used to determine the model answer corresponding to the target question. The relevance of the target question to the preset domain is judged through the target question, the model answer, and the domain knowledge base.

[0074] (1) When it is determined that there are keywords in the target question, it is considered that the target question is related to the preset field. At this time, the question library is used to search for similar preset questions.

[0075] Case 1: When the question library contains a first preset question similar to the target question, a target answer corresponding to the first preset question is determined and output from the answer library.

[0076] Case 2: When the question library does not contain a preset question similar to the target question, the answer library is searched for a first preset answer similar to the model answer. When the answer library contains a first preset answer similar to the model answer, the first preset answer is used as the target answer and output. When the answer library does not contain a first preset answer similar to the model answer, an evasive answer or a model answer is output.

[0077] It is understandable that the electronic device can output evasive answers or model answers according to different user requirements. For example, when the user has low requirements for the accuracy and correctness of the output results, the model answer can be output; when the user has high requirements for the accuracy and correctness of the output results, the evasive answer can be output, thereby preventing the electronic device from outputting incorrect or inappropriate model answers.

[0078] In the embodiment of the present application, the evasive answer is used to indicate that the electronic device cannot answer the target question. The content of the evasive answer may be: "Sorry, I don't have this knowledge yet."

[0079] It should be noted that the content of the evasive answer may be any content used to indicate that the electronic device is unable to answer the target question, and the embodiments of the present application are not limited to this.

[0080] (2) When it is determined that the keyword does not exist in the target question, the target question is not considered to be irrelevant to the preset field. At this time, it is determined whether the keyword exists in the model answer.

[0081] Case 1: When there are keywords in the model answer, it is considered that the target question is related to the preset field. At this time, the first preset answer similar to the model answer is searched in the answer library. When the answer library contains a first preset answer similar to the model answer, the first preset answer is used as the target answer and output; when the answer library does not contain a first preset answer similar to the model answer, an evasive answer or a model answer is output.

[0082] Case 2: When there are no keywords in the model answer, the target question is not considered to be irrelevant to the preset field. At this time, the first preset answer similar to the model answer will still be searched in the answer library. When the answer library has a first preset answer similar to the model answer, the first preset answer will be used as the target answer and output. It can be understood that when the answer library has a first preset answer similar to the model answer, the target question can be considered to be related to the preset field; when the answer library does not have a first preset answer similar to the model answer and outputs it as the target answer, it can be considered that the target question is irrelevant to the preset field, so the model answer can be output.

[0083] For example, when the target question is: "Can I handle business A?", the model answer is determined as: "Go to department A to handle it." As can be seen from the above, the keyword library contains "business A", so it can be determined that there are keywords in the target question. At this time, the question library will be used to search for similar preset questions. As can be seen from the above, the question library contains preset question 1 similar to "Can I handle business A?", namely "How to handle business A", so the preset answer 1 corresponding to question 1 can be output: "To handle business A, you need to prepare material A and go to department A to handle it."

[0084] In one embodiment, when the question library does not contain a preset question 1 similar to "Can business A be handled?", a preset answer 1 similar to "Go to department A to handle it" is searched in the answer library. From the above, it can be seen that the answer library contains a preset answer 1 similar to "Go to department A to handle it", that is, "To handle business A, you need to prepare material A, and go to department A to handle it." Therefore, the output at this time is "To handle business A, you need to prepare material A, and go to department A to handle it."

[0085] In this embodiment, when the answer library does not contain a preset answer 1 similar to "go to department A for processing", "go to department A for processing" or "sorry, I don't have the knowledge in this area yet" may be output.

[0086] As can be seen from the above, through the output control method of the large language model provided in the embodiment of the present application, when the electronic device obtains the target question to be searched, it will judge the relevance of the target question with the preset field. When it is determined that the target question is not related to the preset field, the answer determined by the large language model is output as the target answer; when it is determined that the target question is related to the preset field, based on the domain knowledge base, the answer determined by the domain knowledge base is output as the target answer. Thus, the output of the large language model can be controlled to improve the accuracy of the output of the large language model, thereby improving the accuracy of the output of the electronic device.

[0087] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0088] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application provides an output control device for a large language model. The device embodiment corresponds to the above method embodiment. For ease of reading, the device embodiment will no longer repeat the details of the above method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the above method embodiment.

[0089] Figure 6 A schematic diagram of the structure of the output control device of the large language model provided in the embodiment of the present application, such as Figure 6 As shown, the output control device of the large language model provided in this embodiment includes: an acquisition unit 601, a determination unit 602, and an output unit 603.

[0090] Acquisition unit 601: used to acquire the target question to be searched.

[0091] Determination unit 602: used to determine the model answer of the large language model to the target question as the target answer when the target question is not related to the preset domain; when the target question is related to the preset domain, determine the target answer corresponding to the target question based on the domain knowledge base.

[0092] Output unit 603: used to output the target answer.

[0093] Based on the same inventive concept, the present application also provides an electronic device. Figure 7 FIG. 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 2 The electronic device includes: a processor 701 and a memory 702. The memory 702 is used to store a computer program, and the processor 701 is used to execute the output control method of the above method embodiment when calling the computer program.

[0094] The self-equipped device provided in this embodiment can execute an embodiment of the above method, and its implementation principle and technical effect are similar, which will not be repeated here.

[0095] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method described in the above method embodiment is implemented.

[0096] The embodiment of the present application also provides a computer program product. When the computer program product is run on a mobile device, the method described in the above method embodiment is implemented when the mobile device executes the computer program product.

[0097] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0098] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0099] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).

[0100] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0101] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0102] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0103] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0104] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0105] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0106] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to a large-screen device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0107] Finally, it should be noted that the above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for controlling the output of a large language model, characterized in that: Applied to an electronic device, the electronic device includes a large language model and a domain knowledge base of a preset domain, the method includes: Get the target question to be searched; When the target question is not related to the preset domain, determining the model answer of the large language model to the target question as the target answer; When the target question is related to the preset domain, determining a target answer corresponding to the target question based on the domain knowledge base; The target answer is output.

2. The method according to claim 1, characterized in that The domain knowledge base includes a keyword base, a question base and an answer base; The keyword library includes a plurality of keywords related to the preset field; The question bank includes a plurality of preset questions related to the preset field; The answer library includes preset answers corresponding to each of the preset questions.

3. The method according to claim 2, characterized in that In the question bank, each of the preset questions has multiple different ways of expression; In the answer library, each target answer has multiple different expressions.

4. The method according to claim 2 or 3, characterized in that: The situation that the target question is not related to the preset field includes: the keyword does not exist in the target question, the keyword does not exist in the model answer, the first preset question similar to the target question does not exist in the question library, and the first preset answer similar to the model answer does not exist in the answer library; The situations where the target problem is related to the preset field include: The keyword exists in the target question; or, When the keyword exists in the model answer; or, When the first preset question exists in the question library; or, When the first preset answer exists in the answer library.

5. The method according to claim 4, characterized in that When the target question is related to the preset domain, determining a target answer corresponding to the target question based on the domain knowledge base includes: When the target question contains the keyword in the keyword library, determining the target answer based on the question library and the answer library; When the keyword in the keyword library does not exist in the target question, the target answer is determined based on the model answer and the answer library.

6. The method according to claim 5, characterized in that The determining the target answer based on the question library and the answer library comprises: When the question library contains the first preset question, determining the preset answer corresponding to the first preset question in the answer library as the target answer; When the first preset question does not exist in the question library, the target answer is determined based on the model answer and in combination with the answer library.

7. The method according to claim 6, characterized in that Determining the target answer based on the model answer and in combination with the answer library includes: When the first preset answer exists in the answer library, determining the first preset answer as the target answer; When the first preset answer does not exist in the answer library, the model answer or the evasive answer is determined as the target answer, wherein the evasive answer is used to indicate that the electronic device cannot answer the target question.

8. The method according to claim 4, characterized in that When the keyword in the keyword library does not exist in the target question, determining the target answer based on the model answer and the answer library includes: When the keyword exists in the model answer and the first preset answer exists in the answer library, determining the first preset answer as the target answer; When the keyword exists in the model answer but the first preset answer does not exist in the answer library, determining the model answer or an evasive answer as the target answer, wherein the evasive answer is used to indicate that the electronic device cannot answer the target question; When the keyword does not exist in the model answer, but the first preset answer exists in the answer library, determining the model answer or the evasive answer as the target answer; When the keyword does not exist in the model answer and the first preset answer does not exist in the answer library, the model answer is determined as the target answer.

9. An output control device for a large language model, characterized in that: Applied to an electronic device, the electronic device includes a large language model and a domain knowledge base of a preset domain, and the control device includes: Acquisition unit: used to acquire the target question to be searched; A determination unit: configured to determine, when the target question is not related to the preset domain, a model answer of the large language model to the target question as a target answer; When the target question is related to the preset domain, determining a target answer corresponding to the target question based on the domain knowledge base; Output unit: used for outputting the target answer.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.