Sentence generation device, control method thereof, information processing system, and program
The text generation device addresses LLM hallucination by verifying the consistency between quoted and generated text, allowing for reliable answer determination.
Patent Information
- Application Number
- JP2024031788
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2025-09-17
AI Technical Summary
Existing large language models (LLMs) suffer from hallucination, generating fictitious or erroneous information, particularly when providing important information, and adding reference information does not always result in an appropriate answer.
A text generation device comprising a quoted text search unit, answer generation unit, and reliability calculation unit to acquire and verify the consistency between quoted and generated text, calculating the reliability of the answer based on this consistency.
Enables easy determination of the reliability of generated answers by assessing the consistency between quoted and generated text, ensuring accurate and trustworthy responses.
Smart Images

Figure 2025134103000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a text generation device, a control method thereof, an information processing system, and a program. [Background technology]
[0002] In recent years, the use of large language models (LLMs) has progressed, but there are significant issues with the accuracy of answers. Specifically, hallucination, a phenomenon in which LLM models generate fictitious or erroneous information that is not based on actual sources, is a problem, particularly when providing important information such as product information or technical advice.
[0003] Patent Document 1 discloses a method for generating a separate question from an input question, searching a sentence database using a feature vector calculated from the input question and the generated separate question, and acquiring sentences associated with the feature vector that satisfy a predetermined condition for similarity with the feature vector as candidate sentences to be used for generating additional sentences to be added as reference information to the input question.The method then discloses a method for generating a prompt to be input to a large-scale language model by adding the additional sentences generated based on the acquired candidate sentences to the question as reference information. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] Patent No. 7325152 Summary of the Invention [Problem to be solved by the invention]
[0005] As mentioned above, adding reference information to a question and inputting the generated prompt into the LLM is effective in that it makes it easier to obtain an appropriate answer than if no reference information were added. However, adding reference information may not always result in an appropriate answer.
[0006] An object of the present invention is to provide a text generation device and a control method thereof, an information processing system, and a program that enable easy determination of the reliability of a generated answer text. [Means for solving the problem]
[0007] In view of the above, the text generation device of the present invention is characterized by comprising a quoted text search unit that acquires text related to a question text as quoted text, an answer generation unit that generates an answer text to the question text using the quoted text, and a reliability calculation unit that calculates the reliability of the answer text based on the quoted text and the answer text. [Effects of the Invention]
[0008] As described above, according to the present invention, the reliability of a generated answer sentence can be easily determined. [Brief explanation of the drawings]
[0009] [Figure 1] 1 is a block diagram showing a configuration of a sentence generation device according to an embodiment of the present invention; [Figure 2] FIG. 1 is a block diagram showing an example of a first hallucination determination method of the present invention. [Figure 3] FIG. 10 is a block diagram showing an example of the second hallucination determination method of the present invention. [Figure 4] FIG. 10 is a block diagram showing an example of the third hallucination determination method of the present invention. [Figure 5] 10 is an example of a prompt for verifying consistency between a response sentence and a quoted sentence in an embodiment of the present invention. [Figure 6] FIG. 3 is a flowchart showing the operation of the sentence generation device according to the embodiment of the present invention. [Figure 7] 1 is a block diagram showing an example of a hardware configuration of a sentence generation device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0010] An information processing device, a control method thereof, an information processing system, and a program according to an embodiment of the present invention will be described below with reference to Figures 1 to 7. Note that, although the information processing device will be described below as a text generation device, it is not limited to this and may be, for example, a PC (Personal Computer), a smartphone, a tablet terminal, etc.
[0011] [Device configuration] First, the configuration of a sentence generation device 100 according to this embodiment will be described with reference to Fig. 1. Fig. 1 is a block diagram showing the configuration of a sentence generation device according to this embodiment of the present invention.
[0012] 1 is a device that generates an answer to a question input by a user via an input device 70. The text generation device 100 includes a quoted text search unit 10, a prompt generation unit 20, an answer generation unit 30, a hallucination determination unit 40, a display unit 50, and a quoted text database 60.
[0013] Specific examples of the input device 70 include an input device such as a keyboard, a computer connected via a network, and a reader for a recording medium on which a text collection is recorded. The input device 70 may be any device that can input text. Note that FIG. 1 illustrates a case where the input device 70 is a computer.
[0014] The quoted sentence search unit 10 converts the question received from the input device 70 into search conditions, searches for and extracts quoted sentences related to the question from the quoted sentence database 60, and outputs the obtained quoted sentences to the prompt generation unit 20.
[0015] The cited text database 60 can apply known document search techniques, such as full-text search engines, distributed databases, and time-series databases.
[0016] The prompt generating unit 20 generates a prompt for generating an answer to a question inputted from the input device 70 by adding the quoted sentence extracted by the quoted sentence searching unit 10 as reference information.
[0017] The answer generation unit 30 acquires the prompt generated by the prompt generation unit 20. Then, using the quoted sentence included in the acquired prompt as reference information, the answer generation unit 30 generates an answer sentence to the question sentence included in the prompt, and outputs the generated answer sentence to the hallucination determination unit 40.
[0018] The hallucination judgment unit 40 acquires the answer sentence generated by the answer generation unit 30 and the quoted sentence extracted by the quoted sentence search unit 10, checks the consistency between the answer sentence and the quoted sentence, and calculates the reliability of the answer sentence.
[0019] The display unit 50 acquires the reliability calculated by the hallucination judgment unit 40 and the answer sentence generated by the answer generation unit 30, and presents the reliability together with the answer sentence by using methods such as color coding or notes.
[0020] In this way, the text generation device 100 in this embodiment generates an answer sentence based on the quoted sentence, and further calculates the reliability based on the consistency between the answer sentence and the quoted sentence, and presents it together with the answer sentence. Therefore, according to the text generation device 100 in this embodiment, the reliability of the generated answer sentence can be easily determined.
[0021] [Citation text acquisition method] In order for the answer generation unit 30 to generate a more appropriate answer to a question, or for the hallucination determination unit 40 to check the consistency between the answer and the quoted text, it is important to acquire appropriate quoted text from the quoted text database 60. To this end, the quoted text search unit 10 acquires quoted text using one or more of the methods described below.
[0022] <First method for obtaining citations> The quoted text search unit 10 extracts search keywords from the question text entered via the input device 70. For example, it extracts words as search keywords from the entered question text using morphological analysis. Words may be extracted by limiting them to specific parts of speech or excluding specific parts of speech. One or more words may be extracted, but using multiple search keywords makes it possible to search for and obtain more relevant sentences. It is not limited to the extracted words, and it is also possible to use some or all of the relevant word's synonyms, similar words, hypernyms, etc. as search keywords.
[0023] <Second method for obtaining citations> The citation text search unit 10 extracts embedded representations of sentences from a question text input via the input device 70. The embedded representations are high-dimensional real vectors generated using known natural language processing techniques. The method for calculating the embedded representations is not limited, and other known techniques can also be applied. For example, morphological analysis can be performed on the input question text to extract words, and embedded representations of the words can also be applied. By searching the citation text database 60 using the embedded representations, it is possible to obtain a predetermined number of sentences with the highest degree of similarity between the embedded representations.
[0024] <Third method for obtaining citations> The citation text search unit 10 outputs intent from a question input via the input device 70. Intent classification is a field of natural language processing (NLP) that identifies the intent of a sentence or question uttered by a user. It is generated using known natural language processing techniques such as machine learning (SVM, Naive Bayes), deep learning, feature engineering, and embedding models.
[0025] For example, when a question such as "Are there any precautions to take regarding static electricity when designing a circuit board?" is input from the input device 70, intents such as hardware, circuit board design, and electricity can be output. The intent can be used as a search keyword as is. It is also possible to change the intent to a pre-set keyword and use it as a search keyword. For example, if keywords such as circuit board, electronic components, wiring, signals, and electromagnetic interference are registered in advance for the intent of circuit board design, it is possible to replace them with keywords that are more likely to return hits.
[0026] <Fourth method for obtaining citations> The citation search unit 10 collects information necessary for the search during a dialogue with the user. This information collection can be achieved using known natural language processing techniques, such as the slot-feeling technique. Slot-feeling aims to fill in specific missing pieces of information, called "slots," from the information provided by the user during the dialogue. This usually refers to information about specific attributes or variables, such as the departure point, destination, and departure date and time in a reservation system.
[0027] For example, when a question such as "Please tell me what to pay attention to in design" is input from the input device 70, the user can be presented with the question "Are you looking for hardware design or software design?" and the search keywords can be narrowed down according to the answer.
[0028] The prompt generation unit 20 generates the prompt by adding the quoted sentence acquired by the quoted sentence acquisition unit as the reference information to the input question sentence. The prompt generation unit 20 then inputs the generated prompt to the answer generation unit 30.
[0029] For example, when a question such as "Are there any precautions to take regarding static electricity when designing a circuit board?" is input from the input device 70, the quoted sentence search unit 10 generates three quoted sentences shown in the examples, and the prompt generation unit 20 adds these quoted sentences to the question to generate a prompt. A sentence such as "Please refer to the contents of the example below and answer the following questions based on that" is also added to the beginning of the prompt.
[0030] [Hallucination assessment method] Here, the hallucination determination method performed by the hallucination determination unit 40 will be described in detail with reference to Figures 2 to 4 in addition to Figure 1. The hallucination determination unit 40 can determine hallucination by applying one or more of the following methods.
[0031] <First method for determining hallucination> 2 is a block diagram showing an example of the functional configuration of the hallucination determination unit 40 when implementing the first hallucination determination method. The first hallucination determination method is a hallucination determination method that calculates the reliability of an answer sentence using the similarity between the answer sentence and the quoted sentence. In the example shown in FIG. 2, the hallucination determination unit 40 includes a similar sentence extraction unit 40a and a reliability calculation unit 40b.
[0032] The similar sentence extraction unit 40a inputs the answer sentence generated by the answer generation unit 30 and the quoted sentence extracted by the quoted sentence search unit 10, calculates the distributed representations of the sentences in the answer sentence and the sentences in the quoted sentence, calculates the similarity of the sentences using a method such as cosine similarity of the distributed representations, and extracts sentences in the quoted sentence that are similar to the sentences in the answer sentence.
[0033] The similar sentence extraction unit 40a divides the answer sentence output by the answer generation unit 30 into one or more sentences using periods or other methods. The quoted sentence extracted by the quoted sentence search unit 10 is divided into one or more sentences using the same method. A distributed representation of the above multiple sentences is calculated using a known natural language processing technology, such as the BERT model. Using the distributed representation of the sentences in the answer sentence and the quoted sentence, it is possible to calculate the similarity between the sentences in the answer sentence and the quoted sentence using a calculation method such as cosine similarity.
[0034] Cosine similarity is an index that indicates how closely two vectors point in the same direction in a vector space model. It is mainly used to measure the similarity of text data and documents. Let A and B be the two vectors to consider, and each vector be an n-dimensional vector. Cosine similarity is the dot product of A and B divided by the norm of A (the magnitude or length of the vector) and the norm of B. The more closely two vectors point in the same direction, the higher the similarity can be considered to be.
[0035] Pairs are created between one sentence in the answer and all sentences in the quoted text, and the similarity is calculated using the cosine similarity described above. The sentence in the quoted text with the highest similarity is extracted as a similar sentence to the corresponding sentence in the answer. Similar sentences to all sentences in the answer are extracted using the above method.
[0036] The reliability calculation unit 40b inputs pairs of answer sentences and quoted sentences extracted by the similar sentence extraction unit 40a, extracts structured data such as named entities, relationships, and event information from the answer sentences and quoted sentences, verifies the consistency of the structured data, and calculates the degree of agreement between the answer sentences and quoted sentences as reliability. The reliability calculation method may use weighting or other methods.
[0037] <Second method for determining hallucination> Fig. 3 is a block diagram showing an example of the functional configuration of the hallucination assessment unit 40 when implementing the second hallucination assessment method. The second hallucination assessment method is a hallucination assessment method that calculates the reliability of an answer sentence using keywords extracted from the answer sentence and the quoted sentence. In the example shown in Fig. 3, the hallucination assessment unit 40 includes a question / answer extraction unit 40c and a reliability calculation unit 40d.
[0038] The question and answer extraction unit 40c inputs the question sentence input via the input device 70 and the quoted sentence extracted by the quoted sentence search unit 10 to the question and answer model. The question and answer model outputs the start position and end position of one or more keywords that answer the question sentence from the quoted sentence.
[0039] Furthermore, the question and answer extraction unit 40c inputs the question sentence input from the input device 70 and the answer sentence generated by the answer generation unit 30 to the question and answer model. The question and answer model outputs the start position and end position of one or more keywords that are the answer to the question sentence from the answer sentence.
[0040] The above-mentioned question answering model can calculate the start and end positions of keywords that answer questions from reference texts using known natural language processing techniques, such as the BERT model.
[0041] As described above, the question and answer extractor 40c can extract keywords by calculating the start and end positions of the keywords.
[0042] The reliability calculation unit 40d verifies consistency by calculating the difference between the keywords extracted from the quoted text by the question and answer extraction unit 40c and the keywords extracted from the answer text, and calculates the percentage of matching keywords as reliability.
[0043] <Third method for determining hallucination> Fig. 4 is a block diagram showing an example of the functional configuration of the hallucination assessment unit 40 when implementing the third hallucination assessment method. The third hallucination assessment method is a hallucination assessment method that calculates the reliability of an answer sentence using a verification prompt that verifies the consistency between the answer sentence and a quoted sentence. In the example shown in Fig. 4, the hallucination assessment unit 40 includes a verification prompt generation unit 40e and a reliability calculation unit 40f.
[0044] The verification prompt generation unit 40e generates a prompt to verify the consistency between the answer sentence and the quoted sentence based on the question sentence input from the input device 70, the answer sentence generated by the answer generation unit 30, and the quoted sentence extracted by the quoted sentence search unit 10.
[0045] For example, it is possible to generate a prompt such as that shown in FIG.
[0046] The reliability calculation unit 40f submits the prompt generated by the verification prompt generation unit 40e to a large-scale language model, and verifies consistency by obtaining differences between the answer sentence output by the large-scale language model and the quoted sentence, and calculates the reliability. The reliability calculation method may be to count the number of characters in the sentence indicating the difference between the answer sentence and the quoted sentence, and determine that the reliability is higher the fewer the number of characters. Alternatively, the determination may be based on the number of lines, or may be based on other methods.
[0047] By the above method, the text generation device 100 in this embodiment calculates the reliability from the consistency between the answer text and the quoted text.
[0048] The display unit 50 acquires the reliability calculated by the reliability calculation unit 40b, the reliability calculation unit 40d, or the reliability calculation unit 40f and the answer sentence generated by the answer generation unit 30, and presents the reliability together with the answer sentence by color coding, a note, or other methods. Alternatively, the display unit 50 may determine the presence or absence of hallucination from the reliability calculated based on a predetermined threshold, and present the answer sentence excluding the hallucination portion, or may present it in some other way.
[0049] Therefore, according to the sentence generation device 100 of this embodiment, the reliability of the generated answer sentence can be easily determined by calculating the reliability based on the consistency between the answer sentence and the quoted sentence and presenting it together with the answer sentence.
[0050] [Device operation] Next, the operation of the text generation device 100 in the embodiment of the present invention will be described with reference to FIG. 6. FIG. 6 is a flow diagram showing the operation of the text generation device in the embodiment of the present invention. In the following description, FIGS. 1 to 4 will be referred to as appropriate. In addition, in this embodiment, a text generation method is implemented by operating the text generation device 100. Therefore, the description of the text generation method in this embodiment will be replaced by the following description of the operation of the text generation device 100.
[0051] As shown in FIG. 6, first, the quoted text search unit 10 converts the question text received from the input device 70 into a search condition, and extracts quoted texts related to the question text from the quoted text database 60 (step S601).
[0052] Next, the prompt generator 20 generates a prompt for generating a response sentence by adding the quoted sentence extracted in step S601 as reference information (step S602).
[0053] Next, the answer generating unit 30 inputs the prompt generated in step S602, and generates an answer to the question contained in the prompt by using the quoted sentence contained in the prompt as reference information (step S603).
[0054] Next, the hallucination determination unit 40 inputs the reply sentence generated in step S603 and the quoted sentence extracted in step S601, and checks the consistency between the reply sentence and the quoted sentence (step S604).
[0055] Next, the hallucination determination unit 40 calculates the reliability based on the consistency between the answer sentence checked in step S604 and the quoted sentence (step S605).
[0056] Finally, the display unit 50 acquires the reliability calculated in step S605 and the answer sentence generated in step S603, and presents the reliability together with the answer sentence by color coding, a note, or the like (step S606). Execution of step S606 ends the processing in the sentence generation device 100.
[0057] As described above, the text generation device 100 in this embodiment generates an answer sentence based on the quoted sentence, and further calculates the reliability based on the consistency between the answer sentence and the quoted sentence, and presents it together with the answer sentence. Therefore, according to the text generation device 100 in this embodiment, the reliability of the generated answer sentence can be easily determined.
[0058] The program in this embodiment may be any program that causes a computer to execute steps S601 to S606 shown in Fig. 6. By installing and executing this program in a computer, the text generation device 100 and text classification method in this embodiment can be realized. In this case, the CPU (Central Processing Unit) of the computer functions as the quoted text search unit 10, the prompt generation unit 20, the answer generation unit 30, the hallucination determination unit 40, and the display unit 50 and performs processing.
[0059] In this embodiment, quoted sentence database 60 can be realized by storing the data files that make up the database in a storage device such as a hard disk installed in the computer. However, the storage device in which quoted sentence database 60 is stored is not limited to this, and it may also be an external storage device such as an external hard disk, or a storage device installed in another computer or server.
[0060] Here, a computer 110 that realizes the sentence generation device 100 by executing the program in the embodiment will be described with reference to Fig. 7. Fig. 7 is a block diagram showing an example of the hardware configuration of the sentence generation device in the embodiment of the present invention.
[0061] 7, the computer 110 includes a CPU 211, a memory 212 including various ROMs and RAMs, a storage device 213 such as a hard disk, an input device 214, a display device 215, and a communication interface 217 (communication I / F 217). These components are connected by a bus 218.
[0062] The CPU 211 loads the program (code) according to this embodiment stored in the storage device 213 into the memory 212 and executes the program in a predetermined order to perform various calculations. The program according to this embodiment is provided in a state stored in a computer-readable recording medium such as an optical disk. The program according to this embodiment may be distributed over the Internet connected via the communication I / F 217.
[0063] As described above, the present invention makes it possible to easily determine the reliability of a generated answer sentence. Therefore, the present invention is useful for generating an answer sentence to a question sentence based on a quoted sentence. [Explanation of symbols]
[0064] 10 Citation Search Section 20 Prompt Generation 30 Answer generation part 40 Hallucination determination unit 50 Display 60 Citation Database 70 Input Device 100 Sentence generator
Claims
1. a quoted sentence search unit that acquires sentences related to the question sentence as quoted sentences; an answer generation unit that generates an answer to the question sentence by using the quoted sentence; a reliability calculation unit that calculates the reliability of the answer sentence based on the quoted sentence and the answer sentence; A sentence generation device comprising:
2. The sentence generation device further includes a hallucination determination unit, 2. The text generation device according to claim 1, wherein the hallucination determination unit verifies consistency between the answer text and the quoted text, and the reliability calculation unit calculates the reliability.
3. The sentence generation device according to claim 1 or 2, further comprising a display unit that displays the reliability of the answer sentence calculated by the reliability calculation unit.
4. The hallucination determination unit further comprises: a similar sentence extraction unit that extracts sentences in the quoted text that are similar to the answer sentence; The text generation device according to claim 2 , wherein the reliability calculation unit verifies the consistency using the answer text and a sentence in the quoted text extracted by the similar sentence extraction unit.
5. The hallucination determination unit further comprises: a question and answer extraction unit that extracts keywords that answer the question sentence from the answer sentence and the quoted sentence; The text generation device according to claim 2 , wherein the reliability calculation unit verifies the consistency by using keywords of the answer text and the quoted text extracted by the question and answer extraction unit.
6. The hallucination determination unit further comprises: a verification prompt generation unit that generates a verification prompt that verifies the consistency between the answer sentence and the quoted sentence; The text generation device according to claim 2 , wherein the reliability calculation unit obtains a difference between the answer text and the quoted text using the verification prompt, and verifies the consistency using the difference.
7. a quoted sentence search means for acquiring sentences related to the question sentence as quoted sentences; an answer generation means for generating an answer to the question sentence by using the quoted sentence; a reliability calculation means for calculating the reliability of the reply sentence based on the quoted sentence and the reply sentence; An information processing system comprising:
8. A method for controlling a sentence generation device, comprising: a citation search method for acquiring citations related to a question; an answer generation method for generating an answer to the question sentence by using the quoted sentence; a reliability calculation method for calculating the reliability of the answer sentence based on the quoted sentence and the answer sentence; A method for controlling a sentence generation device, comprising:
9. A computer program for causing a computer to function as each of the means of the sentence generation device according to claim 1 or 2.
Citation Information
Patent Citations
Text generation device and text generation method
JP7325152B1