Method for generating Boolean logic samples and computing equipment

By generating Boolean logic samples, using a large language model to construct Boolean problems and their corresponding text paragraphs, the problem of insufficient accuracy of the text retrieval system when processing Boolean logic queries is solved, and the Boolean logic understanding and semantic understanding capabilities of the retrieval system are improved.

CN120409474APending Publication Date: 2025-08-01SASI DIGITAL TECHNOLOGY (BEIJING) CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510346461.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The existing text retrieval system lacks semantic understanding ability when processing Boolean logic queries, and it is difficult to effectively handle complex Boolean logic, resulting in insufficient accuracy of the search results.

Method used

By generating Boolean logic samples, atomic problems and disjunction problems are generated using large language models, combined with preset logical relationships, Boolean problems and their corresponding text paragraphs are constructed, and Boolean logic samples are formed to train and test the Boolean logic understanding ability of the text retrieval system.

Benefits of technology

It improves the accuracy and semantic understanding ability of the text retrieval system when processing Boolean logical queries, and enhances the retrieval performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409474A_ABST
    Figure CN120409474A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a Boolean logic sample generation method and computing equipment, and the method comprises the steps: firstly, inputting a plurality of text paragraphs related to a target topic into a large language model, indicating the large language model to generate atomic questions corresponding to the text paragraphs, and indicating the large language model to generate disjunction questions; wherein the disjunction question corresponds to the plurality of text paragraphs; then, generating a first Boolean problem according to at least one target problem in the plurality of atomic problems and disjunction problems and a first logic relationship, and taking the first Boolean problem as a Boolean problem in a first Boolean logic sample; and then, according to the text paragraph corresponding to the target question and the first logic relationship, determining the text paragraph corresponding to the first Boolean question as the text paragraph in a first Boolean logic sample.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification belong to the technical field of natural language processing, and particularly relate to a method for generating Boolean logic samples and a computing device. Background Art

[0002] Text retrieval is a basic component of a natural language processing (NLP) system and is widely used in fields such as question answering systems, dialogue systems, and web search. Its core task is to quickly and accurately retrieve relevant information from a large-scale text collection to support upper-layer applications.

[0003] In the era of large language models (LLMs), text retrieval has become increasingly important. Although these models have learned a vast amount of knowledge, due to the limitations of information staticity and timeliness, the knowledge of large language models themselves is difficult to update in real time. To address this issue, the retrieval-augmented generation (RAG) paradigm based on text retrieval provides an efficient solution. By retrieving relevant information from an offline-constructed incrementally updatable knowledge base and then inputting the retrieved information into the model, the model can refer to real-time information when generating answers, improving the reliability and accuracy of the content. Therefore, text retrieval is not only an important technology for information retrieval but also a key means to enhance the application effect of large language models.

[0004] Traditional text retrieval methods mainly rely on lexical overlap to evaluate the relevance between a query text and a document. Based on the "bag of words" assumption and set theory, these methods usually organize text content in the form of an inverted index to support the processing of Boolean logic. However, methods based on inverted indexes rely on exact lexical matching, lack semantic understanding, and are difficult to handle queries related to synonyms, polysemes, and concept hierarchical relationships.

[0005] To flexibly consider the weights of different words, researchers have proposed probability models such as the BM25 algorithm and statistical language modeling. These methods have improved the flexibility of retrieval to a certain extent but still mainly rely on lexical matching and do not fully consider the role of Boolean operations. Therefore, in cases where complex Boolean logic is involved in a query, these probability models are often difficult to handle effectively.

[0006] With the emergence of deep learning, traditional manually constructed sparse text features have gradually been replaced by low-dimensional dense vectors automatically learned by neural networks. Compared with the sparse vector space, dense vectors can capture the deep semantic relationships of text more effectively, thus enhancing the understanding ability of the retrieval system. In these deep learning-based text retrieval frameworks, the goal of the retrieval system is to assign a higher relevance score to real query-document pairs, while giving a lower score to irrelevant or randomly combined query-document pairs. Thanks to the powerful capabilities of pre-trained language models, significant performance improvements have been achieved in text retrieval.

[0007] However, dense retrieval systems mainly focus on the semantic relevance of text, which is not sufficient to handle the complex Boolean logic involved in natural language queries. Specifically, since the current retrieval systems do not incorporate Boolean logic into their training paradigm, the comparability of the output scores for query-document pairs involving Boolean logic cannot be guaranteed. For example, when the user queries "What are the mobile phone brands other than brand A?", the existing dense retrieval systems may still return relevant information about "brand A" and cannot accurately exclude the retrieval results related to this brand.

[0008] According to the above content, the existing text retrieval methods based on inverted indexes, although they can handle Boolean logic, lack the understanding of semantics, resulting in low-quality retrieval results. While the deep learning-based methods have the ability to understand semantics, they are difficult to effectively handle Boolean logic. Therefore, a method is needed to enable text retrieval to have the ability to understand semantics while also being able to effectively handle the Boolean logic in query texts. Summary of the Invention

[0009] The purpose of this specification is to provide a method and a computing device for generating Boolean logic samples, aiming to generate text retrieval training samples with Boolean logic, so that the text retrieval system trained based on the Boolean logic samples can, while having the ability to understand semantics, also effectively handle the Boolean logic in query texts.

[0010] The first aspect of this specification provides a method for generating Boolean logic samples, including:

[0011] Inputting multiple text paragraphs related to the target topic into a large language model, instructing the large language model to generate respective atomic questions corresponding to each text paragraph, and instructing the large language model to generate disjunctive questions; wherein, the disjunctive questions correspond to the multiple text paragraphs;

[0012] Generating a first Boolean question according to at least one target question and a first logical relationship among the multiple atomic questions and disjunctive questions, as the Boolean question in the first Boolean logic sample;

[0013] According to the text paragraph corresponding to the target problem and the first logical relationship, determine the text paragraph corresponding to the first Boolean problem as the text paragraph in the first Boolean logic sample.

[0014] The second aspect of this specification provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method described in the first aspect.

[0015] The third aspect of this specification provides a computing device, including a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method described in the first aspect is implemented.

[0016] The fourth aspect of this specification provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] The method and computing device for generating a Boolean logic sample proposed in the embodiments of this specification. The method first instructs a large language model to generate respective corresponding atomic problems according to each paragraph, and at the same time instructs the large language model to generate a disjunctive problem corresponding to all text paragraphs. Then, according to at least one target problem in the generated atomic problems and disjunctive problems, and a preset logical relationship, a corresponding Boolean problem is generated; in addition, according to the target problem and the logical relationship, the text paragraph corresponding to the Boolean problem is determined. The Boolean problem and its corresponding text paragraph can form a Boolean logic sample.

[0018] The Boolean logic sample generated by using the method described in the embodiments of this specification can be used as a training set to train a dense retrieval system to improve the Boolean logic understanding ability of the dense retrieval system, thereby improving the retrieval performance. It can also be used as a test set to test the understanding and retrieval ability of the retrieval system for Boolean logic and text semantics. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] To more clearly illustrate the technical solutions of the embodiments of this specification, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0020] Figure 1 is a schematic diagram of an implementation scenario of the method for generating a Boolean logic sample in an embodiment;

[0021] Figure 2 is a flowchart of the method for generating a Boolean logic sample in an embodiment of this specification;

[0022] Figure 3 is a flowchart of text retrieval by a target dense retriever based on an inverted index in an embodiment of this specification;

[0023] Figure 4 is a schematic block diagram of an apparatus for generating Boolean logic samples in an embodiment of this specification. Detailed implementation manners

[0024] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of this specification.

[0025] Figure 1 is a schematic diagram of an implementation scenario of a method for generating Boolean logic samples in an embodiment. In Figure 1 the example, multiple text paragraphs have the same or related themes. It can be understood that Figure 1 only text paragraphs 1 to 4 are shown, which does not constitute a limitation on the number of text paragraphs.

[0026] First, each text paragraph is respectively input into a large language model, instructing the large language model to generate the atomic questions corresponding to each text paragraph. An atomic question is a basic question that does not contain Boolean logic and cannot be further divided. Boolean logic includes logical AND, logical OR, and logical NOT. As Figure 1 shown, text paragraphs 1 to 4 respectively correspond to atomic questions 1 to 4. At the same time, the large language model is also instructed to generate a disjunctive question corresponding to the multiple text paragraphs.

[0027] That a text paragraph corresponds to a question may mean that the text paragraph contains knowledge points that can be used to answer the question; it may also mean that the text paragraph is the answer text that can directly answer the question. The disjunctive question corresponding to the multiple text paragraphs may be that any text paragraph among the multiple text paragraphs contains knowledge points that can be used to answer the disjunctive question; it may also be that any text paragraph among the multiple text paragraphs is the answer text that can directly answer the disjunctive question.

[0028] After obtaining the disjunctive question and the atomic questions corresponding to each of the multiple text paragraphs, Boolean questions containing Boolean logic can be generated based on these questions and text paragraphs.

[0029] When the Boolean logic is logical OR, select any two atomic questions from the atomic questions, such as atomic question 1 and atomic question 2, and perform a logical OR connection on their texts to generate the corresponding OR question 1. This OR question 1 can correspond to text passage 1 and text passage 2. As Figure 1 shown.

[0030] When the Boolean logic is logical NOT, select any one atomic question from the atomic questions, such as atomic question 3, and then perform a logical NOT connection on the disjunctive question and atomic question 3 to generate the corresponding NOT question 1. This NOT question 1 can correspond to any text passage other than text passage 3, such as Figure 1 text passage 1, text passage 2, and text passage 4 shown.

[0031] When the Boolean logic is logical AND, select any one text passage from the text passages, such as text passage 4, and then input each text passage and the disjunctive question into a large language model, instructing the large language model to add constraint text in the disjunctive question (equivalent to performing a logical AND connection on the disjunctive question and the constraint text) to obtain the AND question 1, such that this AND question 1 only corresponds to text passage 4 and does not correspond to any text passage other than text passage 4. As Figure 1 shown.

[0032] After generating the Boolean questions, the Boolean questions and their corresponding text passages together form Boolean logic samples, and these Boolean logic samples can be positive samples. Optionally, the Boolean questions and the text passages that do not correspond to them can also be used to form Boolean logic samples, and these Boolean logic samples can be negative samples. The generated Boolean logic samples can be used to train or test a text retrieval system.

[0033] The following describes the specific implementation steps of the above method for generating Boolean logic samples in combination with specific embodiments.

[0034] Figure 2 is a flowchart of the method for generating Boolean logic samples in an embodiment of this specification, and the execution subject of the method can be any platform or server or device cluster with computing and processing capabilities, etc. As Figure 2As shown, the method at least includes: Step 202, inputting multiple text paragraphs related to the target topic into a large language model, instructing the large language model to generate atomic questions corresponding to each text paragraph respectively, and instructing the large language model to generate a disjunctive question; wherein, the disjunctive question corresponds to the multiple text paragraphs; Step 204, generating a first Boolean question according to at least one target question and a first logical relationship among the multiple atomic questions and the disjunctive question, as the Boolean question in the first Boolean logic sample; Step 206, determining the text paragraph corresponding to the first Boolean question according to the text paragraph corresponding to the target question and the first logical relationship, as the text paragraph in the first Boolean logic sample.

[0035] The specific execution processes of the above steps are described below.

[0036] First, in Step 202, multiple text paragraphs related to the target topic are input into a large language model, instructing the large language model to generate atomic questions corresponding to each text paragraph respectively, and instructing the large language model to generate a disjunctive question; wherein, the disjunctive question corresponds to the multiple text paragraphs.

[0037] The target topic can be a topic of any type and any level. The multiple text paragraphs related to the target topic can be directly obtained from an existing text dataset classified by topic; or can be obtained from a single text cluster after text clustering based on an existing text dataset; or can be multiple text paragraphs intercepted from the same article or web page, which is not limited here.

[0038] An atomic question is a basic question that does not contain Boolean logic and cannot be further divided, and can also be called a simple question. Boolean logic includes logical AND, logical OR, and logical NOT. A question containing Boolean logic is a Boolean question, and a Boolean question can be equivalently split into a form of Boolean logic connection of at least two atomic questions.

[0039] That a text paragraph corresponds to a question can be that the text paragraph contains knowledge points that can be used to answer the question; or that the text paragraph is the answer text for answering the question.

[0040] A prompt can be used to instruct the large language model to generate atomic questions corresponding to the text paragraphs. In one embodiment, the text paragraph is filled into a preset first prompt template to obtain a first prompt, and then the first prompt is input into the large language model to instruct the large language model to generate atomic questions corresponding to the text paragraph, and the atomic questions corresponding to the text paragraph are obtained.

[0041] In one example, the first prompt template can be: "Please generate a question that can be answered based on the following text passage: [text passage]." Here, [text passage] is a placeholder for filling in the specific text content of the text passage for which the atomic question is to be generated.

[0042] In other examples, other forms of the first prompt template can also be constructed according to specific requirements, which are not limited here.

[0043] The disjunctive question corresponding to the multiple text passages can be that any one of the multiple text passages contains knowledge points that can be used to answer the disjunctive question; or it can be that any one of the multiple text passages is the answer text for answering the disjunctive question.

[0044] In one embodiment, the multiple text passages are filled into a preset second prompt template to obtain a second prompt, and then the second prompt is input into a large language model to instruct the large language model to generate a disjunctive question corresponding to the multiple text passages, thereby obtaining the disjunctive question corresponding to the multiple text passages.

[0045] In one example, the second prompt template can be: "Please generate a question that can be answered based on any one of the following text passages. Please ensure that each text passage can independently provide information for answering the question. Text passages: [multiple text passages]" Here, [multiple text passages] is a placeholder for filling in the specific text content of the multiple text passages for which the disjunctive question is to be generated.

[0046] In other examples, other forms of the second prompt template can also be constructed according to specific requirements, which are not limited here.

[0047] Compared with the atomic question, the disjunctive question is a question with a higher level of abstraction, and any one of the text passages can be used to answer the disjunctive question.

[0048] In the embodiments of this specification, each text passage can be denoted as where n is the number of text passages. The atomic questions corresponding to each text passage can be denoted as where q i is the atomic question corresponding to p i correspondingly. The disjunctive question corresponding to the multiple text passages can be denoted as q disj .

[0049] Then, in step 204, according to at least one target question and the first logical relationship among the multiple atomic questions and the disjunctive question, a first Boolean question is generated as the Boolean question in the first Boolean logic sample.

[0050] According to and q disj At least one of the target questions and the first logical relationship implied in the Boolean question to be generated, generate the first Boolean question q bool .

[0051] Next, in step 206, according to the text paragraph corresponding to the target question and the first logical relationship, determine the text paragraph corresponding to the first Boolean question as the text paragraph in the first Boolean logic sample.

[0052] According to the corresponding relationship between the target question and the text paragraph, and the first logical relationship, it is possible to determine the text paragraph {p bool corresponding to the first Boolean question q +}.

[0053] According to the specific content of the first logical relationship, the first Boolean question can be generated in a corresponding manner, and the text paragraph corresponding to the first Boolean question can be determined.

[0054] In one embodiment, the first logical relationship is a logical NOT relationship, and the first Boolean question is the first NOT question.

[0055] In this embodiment, generating the first Boolean question in step 204 includes:

[0056] Logically connect the disjunctive question and the first atomic question with a logical NOT to determine the first NOT question.

[0057] The first NOT question q NOT is constructed by adding an exclusion term to the disjunctive question q disj . Specifically, the exclusion term is any first atomic question q1. Formally, it can be expressed as where [NOT] represents a logical NOT connection.

[0058] In this embodiment, determining the text paragraph corresponding to the first Boolean question in step 206 includes:

[0059] Determine the text paragraph other than the first text paragraph as the text paragraph corresponding to the first NOT question; the first text paragraph corresponds to the first atomic question.

[0060] The first text paragraph can be p1, and the text paragraph other than the first text paragraph p1 is determined as the first NOT question q NOT corresponding text paragraph {p NOT+}, formally expressed as {p NOT+} Any one of the text paragraphs in can be used to answer the first NOT question q NOT .

[0061] In this embodiment, the first non-question q NOT and its corresponding text paragraph {p NOT+} can form the first Boolean logic sample.

[0062] In a more specific embodiment, the text of the first non-question q NOT may be different from ordinary natural language in writing. In order to generate a question that is more in line with natural language, a large language model can be used to rewrite the first non-question q NOT . Specifically, the first non-question is input into the third prompt template to obtain the third prompt, and then the third prompt is input into the large language model to obtain the rewritten first non-question, and the rewritten first non-question is used to determine the first Boolean logic sample.

[0063] In one example, the third prompt template can be: "Please rewrite the following text containing the logical NOT connective into the form of natural language expression: [non-question]". Among them, [non-question] is a placeholder for filling in the question text of the first non-question.

[0064] In other examples, other forms of the third prompt template can also be constructed according to specific needs, which are not limited here.

[0065] Since the first Boolean logic sample is essentially a positive sample, in some possible implementation manners, negative samples can also be constructed according to the first non-question q NOT . Specifically, the first text paragraph p1 can be marked as the negative text paragraph {p NOT} corresponding to the first non-question q, and can be formally expressed as NOT- Then, according to the first non-question q and the first text paragraph p1, a second Boolean logic sample can be constructed. The second Boolean logic sample is essentially a negative sample. NOT In another embodiment, the first logical relationship is a logical AND relationship, and the first Boolean question is a first AND question.

[0066] In this embodiment, generating the first Boolean question in step 204 includes:

[0067] Inputting each text paragraph containing the second text paragraph and the disjunctive question into the large language model, and instructing the large language model to generate the first AND question according to the disjunctive question.

[0068] Specifically, instruct the large language model to add constraint text to the disjunctive question to generate the first AND question, so that the first AND question corresponds to the second text paragraph and does not correspond to any text paragraph other than the second text paragraph.

[0069] ​

[0070] Each text paragraph and the disjunctive problem can be input into the fourth prompt template to obtain the fourth prompt, and then the fourth prompt is input into the large language model to instruct the large language model to generate the first AND problem according to the disjunctive problem.

[0071] In one example, the fourth prompt template can be: "Please add constraint text to the following problem [disjunctive problem] to obtain a new problem such that the new problem can only be answered based on the text paragraphs marked as positive and cannot be answered based on the text paragraphs marked as negative. Positive text paragraphs: [positive text paragraphs]. Negative text paragraphs: [negative text paragraphs]." Among them, [disjunctive problem], [positive text paragraphs], and [negative text paragraphs] are placeholders for filling in the problem text of the disjunctive problem, the second text paragraph, and all text paragraphs other than the second text paragraph, respectively.

[0072] In other examples, other forms of the fourth prompt template can also be constructed according to specific requirements, which are not limited here.

[0073] The first AND problem q AND is constructed by adding additional constraint text constraints to the disjunctive problem q disj . Formally, it can be expressed as where [AND] represents the logical AND connection.

[0074] In this embodiment, determining the text paragraph corresponding to the first Boolean problem in step 206 includes:

[0075] Determining the second text paragraph as the text paragraph corresponding to the first AND problem.

[0076] The second text paragraph can be p2. Determining the second text paragraph p2 as the text paragraph {p AND} corresponding to the first AND problem q AND+ . Formally, it can be expressed as The second text paragraph p2 can be used to answer the first AND problem q AND .

[0077] In this embodiment, the first AND problem q AND and its corresponding text paragraph {p AND+} can form the first Boolean logic sample.

[0078] Since the first Boolean logic sample is essentially a positive sample, in some possible implementation manners, a negative sample can also be constructed according to the first AND problem q AND . Specifically, the text paragraphs other than the second text paragraph p2 can be marked as the first AND problem qAND The corresponding negative text paragraph {p AND-}, which can be formally expressed as Then, according to the first and the problem q AND and the text paragraphs other than the second text paragraph p2 construct a second Boolean logic sample. The second Boolean logic sample is a substantially negative sample.

[0079] In yet another embodiment, the first logical relationship is a logical OR relationship, and the first Boolean problem is a first OR problem.

[0080] In this embodiment, generating the first Boolean problem in step 204 includes:

[0081] Logically OR-connect the texts of the third atomic problem and the fourth atomic problem to determine the first OR problem.

[0082] The first OR problem q OR is constructed by using any two atomic problems, namely the third atomic problem q3 and the fourth atomic problem q4, and can be formally expressed as where [OR] represents a logical AND connection.

[0083] In this embodiment, determining the text paragraph corresponding to the first Boolean problem in step 206 includes:

[0084] Determine the third text paragraph and the fourth text paragraph as the text paragraphs corresponding to the first OR problem; the third text paragraph and the fourth text paragraph correspond to the third atomic problem and the fourth atomic problem respectively.

[0085] The third text paragraph can be p3, and the fourth text paragraph can be p4. Determine the third text paragraph p3 and the fourth text paragraph p4 as the text paragraphs corresponding to the first OR problem q OR {p OR+}, which can be formally expressed as {p OR+} Any one of the text paragraphs in can be used to answer the first OR problem q OR .

[0086] In this embodiment, the first OR problem q OR and its corresponding text paragraph {p OR+} can form a first Boolean logic sample.

[0087] In a more specific embodiment, the text of the first OR problem q OR may be different from ordinary natural language in terms of writing. In order to generate a question that is more in line with natural language, a large language model can be used for the first OR problem q ORPerform rewriting. Specifically, input the first OR question into the fifth prompt template to obtain the fifth prompt, then input the fifth prompt into the large language model to obtain the rewritten first OR question, and use the rewritten first OR question to determine the first Boolean logic sample.

[0088] In one example, the fifth prompt template can be: "Please rewrite the following text containing the logical OR (OR) connective into a natural language expression: [OR question]". Here, [OR question] is a placeholder for filling in the question text of the first OR question.

[0089] In other examples, other forms of the fifth prompt template can also be constructed according to specific requirements, which are not limited here.

[0090] Since the first Boolean logic sample is essentially a positive sample, in some possible implementation manners, negative samples can also be constructed according to the first OR question q OR Specifically, the text paragraphs other than the third text paragraph p3 and the fourth text paragraph p4 can be marked as the first OR question q OR The corresponding negative text paragraphs {p OR-}, which can be formally expressed as Then, the second Boolean logic sample can be constructed according to the first OR question q OR and the text paragraphs other than the third text paragraph and the fourth text paragraph. The second Boolean logic sample is essentially a negative sample.

[0091] The above shows the process of generating the corresponding first Boolean logic sample according to the target question, and the process of generating the second Boolean logic sample. In other embodiments, Boolean logic samples corresponding to other target questions can also be generated, which are not limited here.

[0092] It can be understood that the above only shows the process of generating Boolean logic samples according to multiple text paragraphs related to a single target theme. In other embodiments, text paragraphs related to other themes can also be obtained, and then the above steps can be respectively executed for multiple text paragraphs related to each theme to respectively generate Boolean logic samples related to each theme, which are not limited here.

[0093] The large language model described in the embodiments of this specification can be any pre-trained large language model, which is not limited here.

[0094] After generating the first Boolean logic sample according to step 206, due to the performance issues of the large language model, sometimes reasonable atomic questions, disjunctive questions, or Boolean questions may not be generated, resulting in poor quality of the generated first Boolean logic sample. In this regard, it is also possible to verify again whether the text paragraphs in the first Boolean logic sample have a corresponding relationship with the first Boolean question.

[0095] In some possible embodiments, the method further includes step 208:

[0096] Step 208, input the first Boolean logic sample into the large language model, and instruct the large language model to determine whether the text paragraphs in the first Boolean logic sample contain the knowledge points for answering the first Boolean question.

[0097] Input the first Boolean question and the text paragraphs in the first Boolean logic sample into the sixth prompt template to obtain the sixth prompt, and then input the sixth prompt into the large language model to make the large language model determine whether the text paragraphs contain the knowledge points for answering the first Boolean question.

[0098] In one example, the sixth prompt template can be: "Please determine whether the following question can be answered based on the following text paragraphs and give a short answer. Question: [Boolean question]. Text paragraphs: [Text paragraphs]". Among them, [Boolean question] and [Text paragraphs] are placeholders, which are used to fill in the first Boolean question and the corresponding text paragraphs respectively.

[0099] In other examples, other forms of the sixth prompt template can also be constructed according to specific requirements, which are not limited here.

[0100] The process of generating Boolean questions and Boolean logic samples is described above. The following gives specific examples of corresponding Boolean questions for logical NOT, logical AND, and logical OR respectively.

[0101] When the first Boolean logic is logical NOT, the disjunctive question can be, for example: "What are the mobile phone brands?", the first atomic question can be, for example: "Is brand A a mobile phone brand?", and the generated first NOT question can be, for example: "What are the mobile phone brands other than brand A?"

[0102] When the first Boolean logic is logical AND, the disjunctive question can be, for example: "What are the mobile phone models?", the relevant text paragraphs can be the list of mobile phone models released by each year and their specific introductions. The second text paragraph can be, for example, the list of mobile phone models released in 2024 and their specific introductions. The generated first AND question can be, for example: "What are the mobile phone models released in 2024?"

[0103] When the first Boolean logic is logical OR, the third atomic question can be, for example, "What are the car brands in country A?", the fourth atomic question can be, for example, "What are the car brands in country B?", and the generated first OR question can be, for example, "What are the car brands in country A or country B?"

[0104] After generating the Boolean logic samples, a set of Boolean logic samples containing the Boolean logic samples can also be used to continue training the existing dense retriever.

[0105] In some possible implementation manners, the method further includes:

[0106] Using a set of Boolean logic samples containing the first Boolean logic sample to fine-tune the pre-trained dense retriever.

[0107] By using a set of Boolean logic samples containing the Boolean logic samples to fine-tune the pre-trained dense retriever, the understanding ability of the retrieval system for natural language Boolean logic can be enhanced, and the performance of the retrieval system can be improved.

[0108] After generating the Boolean logic samples, a set of Boolean logic samples containing the Boolean logic samples can also be used to perform performance testing on the dense retriever based on the inverted index.

[0109] In some possible implementation manners, it further includes:

[0110] Using a set of Boolean logic samples containing the first Boolean logic sample to perform performance testing on the target dense retriever based on the inverted index.

[0111] In a more specific implementation manner, the target dense retriever based on the inverted index performs retrieval through steps 302 to 306 as Figure 3 shown. Figure 3 It is a flowchart of text retrieval by the target dense retriever based on the inverted index in an embodiment of this specification.

[0112] In step 302, the original question to be retrieved is input into the large language model, instructing the large language model to decompose the original question into the Boolean logic operation form of several atomic questions; no Boolean logic operation is contained in any atomic question.

[0113] The original question r can be decomposed into the Boolean logic operation form r1[B1]r2[B2]r3... of multiple atomic questions ri, where i represents the Boolean logic operator.

[0114] In step 304, each atomic question is respectively input into the target dense retriever to determine the set of similar text paragraphs corresponding to each atomic question.

[0115] The similar text paragraph set includes each text paragraph related to the corresponding atomic question retrieved by the target dense retriever, as well as the similarity score of each text paragraph.

[0116] In step 306 , based on the decomposition result of the original question, a set operation is performed on each set of similar text paragraphs to determine a target set of similar text paragraphs corresponding to the original question.

[0117] For any two adjacent atomic problems in the Boolean logic operation form r1[B1]r2[B2]r3… i and r i+1 , when the Boolean logic operation [B i ] is a logical AND, perform set intersection operation on their corresponding similar text paragraph sets, and then sum up the similarity scores of the text paragraphs that belong to both similar text paragraph sets, and the similarity scores of the remaining text paragraphs that belong to only one similar text paragraph set remain unchanged.

[0118] When any two adjacent atoms r i and r i+1 Boolean logic operations between i ] is a logical OR, the corresponding similar text paragraph sets are combined and the larger similarity score of the text paragraphs that belong to both similar text paragraph sets is taken, and the similarity scores of the remaining text paragraphs that belong to only one similar text paragraph set remain unchanged.

[0119] When any two adjacent atoms r i and r i+1 Boolean logic operations between i ] is logically not, keep the atomic problem r i The corresponding similar text paragraph sets, and the similarity scores of the text paragraphs belonging to both similar text paragraph sets are taken as the difference, and the rest belong only to the atomic question r i The similarity scores of the text paragraphs in the corresponding similar text paragraph set remain unchanged.

[0120] According to another embodiment, an apparatus for generating Boolean logic samples is also provided. Figure 4 This is a schematic block diagram of a device for generating Boolean logic samples in an embodiment of this specification. The device can be deployed in any device, platform or device cluster with computing and processing capabilities. Figure 4 As shown, the apparatus 400 includes:

[0121] An atomic problem generation unit 402 is configured to input multiple text paragraphs related to a target topic into a large language model, instruct the large language model to generate atomic problems corresponding to each of the text paragraphs respectively, and instruct the large language model to generate a disjunctive problem; wherein, the disjunctive problem corresponds to the multiple text paragraphs.

[0122] A boolean problem generation unit 404 is configured to generate a first boolean problem, as the boolean problem in a first boolean logic sample, according to at least one target problem and a first logical relationship among the multiple atomic problems and the disjunctive problem.

[0123] A sample generation unit 406 is configured to determine the text paragraph corresponding to the first boolean problem, as the text paragraph in the first boolean logic sample, according to the text paragraph corresponding to the target problem and the first logical relationship.

[0124] According to an embodiment of another aspect, there is also provided a computer program product, including a computer program / instructions, which when executed by a processor, implement the steps of the method described in any of the above embodiments.

[0125] According to an embodiment of still another aspect, there is also provided a computing device, including a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method described in any of the above embodiments is implemented.

[0126] In the 1990s, it was obvious to distinguish whether an improvement to a technology was a hardware improvement (e.g., improvement to the circuit structure such as diodes, transistors, switches, etc.) or a software improvement (improvement to the method flow). However, with the development of technology, many of today's improvements to method flows can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented with a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. The designer can program by themselves to "integrate" a digital system on a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called Hardware Description Language (HDL), and there is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow with the above-mentioned several hardware description languages and programming it into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.

[0127] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers to achieve the same function. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.

[0128] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the development of future computer technologies, the computers for implementing the functions of the above embodiments can be, for example, personal computers, laptop computers, in-vehicle human-machine interaction devices, cellular phones, camera phones, smart phones, personal digital assistants, media players, navigation devices, email devices, game consoles, tablet computers, wearable devices, or any combination of these devices.

[0129] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way among the execution orders of numerous steps and does not represent the only execution order. When the actual device or terminal product is executed, it may be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing, or even in a distributed data processing environment). The terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, product or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, product or device. Without further limitation, it does not exclude the existence of additional identical or equivalent elements in the process, method, product or device including the said elements. For example, if terms such as first and second are used to denote names, they do not denote any specific order.

[0130] For convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing one or more of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware, or the modules implementing the same function can be realized by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, 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 displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0131] This specification is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and the combination of processes and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0132] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction apparatus that implements the functions specified in one or more of the blocks and / or processes, and / or blocks, of the flowchart. Figure 1 one or more of the processes and / or blocks Figure 1 specified in one or more of the blocks and / or processes, and / or blocks.

[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one or more of the processes and / or blocks, and / or blocks, of the flowchart. Figure 1 one or more of the processes and / or blocks Figure 1 specified in one or more of the blocks and / or processes, and / or blocks.

[0134] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0135] Memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.

[0136] Computer-readable media includes both permanent and non-permanent, removable and non-removable media implemented by any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0137] Those skilled in the art should understand that one or more embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0138] One or more embodiments of this specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0139] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and reference can be made to the corresponding parts of the method embodiments for relevant content. In the description of this specification, the description of reference terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0140] The above description is only for the embodiments of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims.

Claims

1. A method for generating Boolean logic samples, comprising: Inputting multiple text paragraphs related to a target topic into a large language model, instructing the large language model to generate respective atomic questions corresponding to each text paragraph, and instructing the large language model to generate disjunctive questions; wherein, the disjunctive questions correspond to the multiple text paragraphs; Generating a first Boolean question as the Boolean question in the first Boolean logic sample according to at least one target question and a first logical relationship among the multiple atomic questions and disjunctive questions; Determining the text paragraph corresponding to the first Boolean question as the text paragraph in the first Boolean logic sample according to the text paragraph corresponding to the target question and the first logical relationship.

2. The method according to claim 1, wherein The first logical relationship is a logical NOT relationship, and the first Boolean question is a first NOT question; Generating the first Boolean question includes: Logically connecting the disjunctive question with a first atomic question by logical NOT to determine a first NOT question; Determining the text paragraph corresponding to the first Boolean question includes: Determining the text paragraphs other than the first text paragraph as the text paragraphs corresponding to the first NOT question; the first text paragraph corresponds to the first atomic question.

3. The method according to claim 1, wherein, The first logical relationship is a logical AND relationship, and the first Boolean question is a first AND question; Generating the first Boolean question includes: Inputting each text paragraph containing a second text paragraph and the disjunctive question into the large language model, and instructing the large language model to generate a first AND question according to the disjunctive question; Determining the text paragraph corresponding to the first Boolean question includes: Determining the second text paragraph as the text paragraph corresponding to the first AND question.

4. The method according to claim 3, wherein, Instructing the large language model to generate a first AND question according to the disjunctive question includes: Instructing the large language model to add constraint text to the disjunctive question to generate a first AND question, such that the first AND question corresponds to the second text paragraph and does not correspond to any text paragraph other than the second text paragraph.

5. The method according to claim 1, wherein The first logical relationship is a logical OR relationship, and the first Boolean question is a first OR question; Generating the first Boolean question includes: Logically connecting the texts of a third atomic question and a fourth atomic question by logical OR to determine a first OR question; Determining the text paragraph corresponding to the first Boolean question includes: Determining the third text paragraph and the fourth text paragraph as the text paragraphs corresponding to the first OR question; the third text paragraph and the fourth text paragraph correspond to the third atomic question and the fourth atomic question respectively.

6. The method according to claim 1, further comprising: Inputting the first Boolean logic sample into the large language model, and instructing the large language model to determine whether the text paragraph in the first Boolean logic sample contains the knowledge point for answering the first Boolean question.

7. The method according to claim 1, further comprising: Fine-tuning a pre-trained dense retriever using a Boolean logic sample set containing the first Boolean logic sample.

8. The method according to claim 1, further comprising: Performing a performance test on a target dense retriever based on an inverted index using a Boolean logic sample set containing the first Boolean logic sample.

9. The method according to claim 8, wherein, The target dense retriever based on the inverted index performs retrieval through the following steps: Input the original question to be retrieved into the large language model, and instruct the large language model to decompose the original question into the Boolean logic operation form of several atomic questions; There is no Boolean logic operation in any atomic question; Input each atomic question into the target dense retriever respectively, and determine the set of similar text paragraphs corresponding to each atomic question respectively; According to the decomposition result of the original question, perform set operations on the sets of similar text paragraphs respectively, and determine the set of target similar text paragraphs corresponding to the original question.

10. A computing device, comprising a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, the method described in any one of claims 1-9 is implemented.

Citation Information

Cited By

  • Retrieval question condition segmentation system generated based on large language model

    CN121350061A