A long text generation method and device

CN123012138APending Publication Date: 2026-10-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510549815.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]但是现有的基于大语言模型的知识长文生成方案存在着一些问题,例如生成时延较长,或生成的长文本质量较低等问题

Benefits of technology

[0045]可以理解的是,上述第二方面至第六方面的有益效果可以参见上述第一方面中的相关描述,为了简洁,在此不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012138A_ABST
    Figure CN123012138A_ABST
Patent Text Reader

Abstract

The application provides a long text generation method and device, and relates to the technical field of artificial intelligence. The method comprises the following steps: acquiring a query text; performing greedy retrieval planning based on the query text to obtain a retrieval planning result, the retrieval planning result being a plurality of retrieval sentences for parallel retrieval; performing retrieval based on the plurality of retrieval sentences to obtain relevant information, the relevant information being information related to the current query task; and generating a long text response corresponding to the query text based on the query text and the relevant information. The long text generation method provided by the application adopts greedy retrieval planning, realizes the collection of as much relevant information as possible under the opportunity of one-time parallel search, generates a complete long text response according to the relevant information, reduces the long text generation delay on the basis of ensuring the long text generation quality, and takes into account the quality and delay requirements of long text generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a method and apparatus for generating long text. Background Technology

[0002] A web search engine is designed to search the World Wide Web, meaning it automatically collects specific information from the web and provides it to users for querying. Traditional search engine results are typically displayed as a row-and-column linked list. These links may lead to web pages, images, videos, infographics, articles, research papers, or other types of documents. Search engines usually provide a short summary of these links to help users determine if the page contains the content they need. However, web search engines handle 10 billion search queries daily, but according to Microsoft research, about half of them do not provide satisfactory answers. While very useful for finding specific websites, they often perform poorly for more complex user questions or decision support. With new breakthroughs in large language models (LLMs) such as GPT4, we can iterate on the capabilities of search engines. Using foundational LLMs, new generative search engines (such as Microsoft's Copilot and Google's Gemini) can answer entirely new types of questions and change how information is organized to help users better organize research-related information and support decision-making. Consider the question, "Please compare the Li Auto M7, Li Auto L7, and NIO ES7 and provide a purchase recommendation." Humans typically break down this problem into smaller, more manageable parts and search for them, then categorize the vast amount of information retrieved and synthesize it themselves. A large language model can help users accomplish this arduous task, generating informative, lengthy reports that help users understand the overall picture and make decisions faster and easier.

[0003] However, existing knowledge-based long text generation schemes based on large language models have some problems, such as long generation latency or low quality of generated long texts. Summary of the Invention

[0004] The embodiments of this application provide a long text generation method and apparatus, which can reduce the long text generation latency while ensuring the quality of long text generation, thus balancing the requirements for both quality and latency in generating long texts.

[0005] Firstly, this application provides a long text generation method, including obtaining query text; performing a greedy retrieval plan based on the query text to obtain retrieval plan results, the retrieval plan results being multiple retrieval statements for parallel retrieval; performing a retrieval based on the multiple retrieval statements to obtain relevant information, the relevant information being information related to the current query task; and generating a long text response corresponding to the query text based on the query text and the relevant information.

[0006] The long text generation method provided in this application adopts a greedy retrieval planning approach, which is a heuristic method. That is, it collects as much relevant information as possible for the current query in a single parallel search opportunity, without considering the potential impact of this choice on future steps. This makes the retrieved relevant information for the current query task as complete as possible. Then, it uses the retrieved relevant information to generate a complete long text response in one go. This reduces the number of retrieval triggers during the generation process, reduces the latency of long text generation, and ensures the quality of long text generation by generating long text with the most complete relevant information retrieved.

[0007] In one possible implementation, the objective of a greedy retrieval plan is to obtain relevant information that supports the task of generating long text responses through a single round of retrieval.

[0008] Compared to existing technologies that typically break down long text generation tasks into multiple sub-tasks and use sub-tasks as the target for retrieval planning, each retrieval plan only retrieves the documents needed to complete one sub-task, requiring multiple rounds of retrieval to find the documents required for the long text generation task, this application optimizes the retrieval planning objective to: obtain relevant information to support the completion of the long text response generation task in one round of retrieval. This allows subsequent steps to use the relevant information obtained in one round of retrieval as reference information to generate a complete long text response, eliminating the need for multiple rounds of retrieval and effectively reducing the latency of long text generation.

[0009] In one possible implementation, a specific implementation of greedy search planning based on query text to obtain search planning results is as follows: greedy search planning based on query text and background knowledge to obtain search planning results, where background knowledge includes search content obtained from pre-search based on query text.

[0010] For example, after a user enters a question (i.e. query text), a pre-retrieval can be performed based on the user's input text. For instance, the search results obtained from searching the user's input question on a regular search engine can be used as background knowledge. Then, a greedy search plan can be made using the background knowledge, which helps to plan more relevant search statements.

[0011] In another possible implementation, a specific implementation of greedy retrieval planning based on query text and background knowledge to obtain retrieval planning results is as follows: input the query text and background knowledge into the first language model so that the first language model decomposes the query text into multiple sub-problems; input the multiple sub-problems into the second language model so that the second language model generates multiple retrieval statements for the multiple sub-problems.

[0012] The search results obtained from the user's original question will be used as background knowledge and input into a large language model along with the user's question. Based on the understanding of the user's question intent by the large model, the user question will be decomposed into a number of simpler sub-questions according to the complexity of the question, which will facilitate the generation of subsequent search statements. Then, the large language model will be used to generate corresponding search statements for each decomposed sub-question. Multiple search statements can be searched in parallel, so that all generated search statements can be searched in parallel in subsequent steps to obtain the searched documents, further reducing the latency of the entire long text generation.

[0013] In another possible implementation, a specific approach to generating a long text response based on the query text and related information is to use the query text and related information as input to a third language model and output a long text response.

[0014] The third language model uses the query text and the relevant information retrieved by the greedy retrieval plan to generate a complete long-text response in one go, resulting in better consistency in the generated long-text responses.

[0015] In another possible implementation, the relevant information includes multiple search documents retrieved based on multiple search statements; a specific implementation of taking the query text and relevant information as input to the third large language model and outputting a long text response is as follows: based on the query text and multiple search documents, a prompt is generated, which instructs the large language model to generate a long text response for the query text based on the multiple search documents.

[0016] In another possible implementation, the long text generation method provided in this application further includes: evaluating the long text response to obtain evaluation feedback information; performing greedy retrieval planning again based on the evaluation feedback information and updating the retrieval planning results; performing retrieval based on the updated retrieval planning results and updating relevant information; updating the long text response based on the query text, the updated relevant information, the evaluation feedback information, and the long text response; and obtaining the final long text response after several iterations.

[0017] Through multiple iterations, based on the evaluation feedback of the long text generated in the previous round, the search statements and relevant supplementary information are further planned. Then, based on the long text generated in the previous round, the collected relevant information and evaluation feedback, a new long text response is generated. This improves the problems existing in the long text response generated in the previous round, optimizes the long text response generated in the previous round, and improves the quality of the long text response.

[0018] In another possible implementation, the evaluation feedback information includes self-evaluation feedback information; a specific implementation of evaluating long text responses to obtain evaluation feedback information is as follows: input the query text and the long text response into the fourth language model so that the fourth language model evaluates the long text response from at least one dimension to obtain self-evaluation feedback information.

[0019] By using a large language model to self-evaluate the long text responses generated in the previous round from at least one dimension, problems in the long text responses generated in the current round can be identified, so that these problems can be used to improve the long text responses in the next iteration and improve their quality.

[0020] In another possible implementation, at least one dimension includes one or more of the following: relevance, breadth of information, depth of information, and consistency. This allows for a more comprehensive self-evaluation across multiple dimensions to identify problems with the long text responses generated in the previous round.

[0021] In another possible implementation, the evaluation feedback information also includes user feedback information, which includes feedback information entered by the user after evaluating the long text response.

[0022] This possible implementation supports user feedback input, allowing the generated long texts to be adjusted and improved according to the user's preferences, thereby enhancing the user experience.

[0023] In another possible implementation, the iteration stopping condition for several rounds of iterations includes any one of the following: reaching the configured number of iterations, meeting the self-evaluation feedback criteria, and receiving a stop iteration instruction from the user.

[0024] The latency and quality of long text generation can be dynamically adjusted by allowing users to configure the iteration count or by issuing a stop-iteration command. For example, if the generation latency is perceived to be too long, the iteration count parameter can be reduced, or a stop-iteration command can be issued to control the iteration and obtain the final generated long text response. If the quality of the generated long text is deemed unsatisfactory, the iteration count parameter can be increased to generate a higher-quality long text response through more iterations.

[0025] In one possible implementation, the first, second, third, fourth, and fifth largest language models are the same large language model, for example, all of them are the gpt4o large language model.

[0026] In another possible implementation, the first, second, third, fourth, and fifth major language models are different major language models.

[0027] Secondly, this application also provides a long text generation device, including an acquisition module, a retrieval planning module, a retrieval module, and a generation module. The acquisition module is used to acquire query text; the retrieval planning module is used to perform a greedy retrieval planning based on the query text to obtain retrieval planning results, which are multiple retrieval statements for parallel retrieval; the retrieval module is used to perform retrieval based on the multiple retrieval statements to obtain relevant information, which is information related to the current query task; and the generation module is used to generate a long text response corresponding to the query text based on the query text and relevant information.

[0028] In one possible implementation, the objective of a greedy retrieval plan is to obtain relevant information that supports the task of generating long text responses through a single round of retrieval.

[0029] In one possible implementation, the retrieval planning module is specifically used to: perform greedy retrieval planning based on the query text and background knowledge to obtain the retrieval planning results. The background knowledge includes the retrieval content obtained by pre-retrieval based on the query text.

[0030] In another possible implementation, a specific implementation of greedy retrieval planning based on query text and background knowledge to obtain retrieval planning results is as follows: input the query text and background knowledge into the first language model so that the first language model decomposes the query text into multiple sub-problems; input the multiple sub-problems into the second language model so that the second language model generates multiple retrieval statements for the multiple sub-problems.

[0031] In another possible implementation, the generation module is specifically used to: take the query text and related information as input to a third language model and output a long text response.

[0032] In another possible implementation, the relevant information includes multiple search documents retrieved based on multiple search statements; a specific implementation of taking the query text and relevant information as input to the third large language model and outputting a long text response is as follows: based on the query text and multiple search documents, a prompt is generated, which instructs the large language model to generate a long text response for the query text based on the multiple search documents.

[0033] In another possible implementation, the long text generation apparatus provided in this application further includes an evaluation feedback module, a replanning module, and a regeneration module. The evaluation feedback module is used to evaluate the long text response and obtain evaluation feedback information. The re-retrieval module is used to perform greedy retrieval planning again based on the evaluation feedback information and update the retrieval planning results. The retrieval is performed based on the updated retrieval planning results and the relevant information is updated. The regeneration module is used to update the long text response based on the query text, the updated relevant information, the evaluation feedback information, and the long text response. After several rounds of iteration, the final long text response is obtained.

[0034] In another possible implementation, the evaluation feedback information includes self-evaluation feedback information; the evaluation feedback module is specifically used to: input the query text and the long text response into the fourth language model, so that the fourth language model evaluates the long text response from at least one dimension and obtains self-evaluation feedback information.

[0035] In another possible implementation, at least one dimension includes one or more of the following: relevance dimension, breadth of information dimension, depth of information dimension, and consistency dimension.

[0036] In another possible implementation, the evaluation feedback information also includes user feedback information, which includes feedback information entered by the user after evaluating the long text response.

[0037] In another possible implementation, the iteration stopping condition for several rounds of iterations includes any one of the following: reaching the configured number of iterations, meeting the self-evaluation feedback criteria, and receiving a stop iteration instruction from the user.

[0038] In one possible implementation, the first, second, third, fourth, and fifth largest language models are the same large language model.

[0039] In another possible implementation, the first, second, third, fourth, and fifth major language models are different major language models.

[0040] Thirdly, embodiments of this application provide a computing device, including a memory and a processor, wherein the memory stores instructions that, when executed by the processor, cause the method described in the first aspect or any possible implementation of the first aspect to be implemented.

[0041] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the method described in the first aspect or any possible implementation thereof to be implemented.

[0042] Fifthly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the method described in the first aspect or any possible implementation thereof to be implemented.

[0043] Fifthly, embodiments of this application also provide a computer program or computer program product, which includes instructions that, when executed, cause a computer to perform the method described in the first aspect or any possible implementation thereof.

[0044] In a sixth aspect, embodiments of this application also provide a chip including at least one processor and a communication interface, the processor being configured to perform the method described in the first aspect or any possible implementation thereof.

[0045] It is understandable that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here for the sake of brevity. Attached Figure Description

[0046] Figure 1 A schematic diagram of a system architecture is shown;

[0047] Figure 2 A flowchart illustrating the long text generation method provided in this application embodiment;

[0048] Figure 3 This paper illustrates a schematic diagram of the greedy search planning implementation steps in an embodiment of this application.

[0049] Figure 4 A schematic diagram illustrating the long text generation steps of an embodiment of this application is shown;

[0050] Figure 5 A schematic diagram of a system architecture for implementing the long text generation method provided in the embodiments of this application;

[0051] Figure 6 A schematic diagram of the self-assessment feedback steps in an embodiment of this application is shown;

[0052] Figure 7 A schematic diagram of an evaluation standard is shown;

[0053] Figure 8 A schematic diagram of the feedback-based replanning steps in an embodiment of this application is shown;

[0054] Figure 9 A schematic diagram illustrating the feedback-based long text generation steps of an embodiment of this application is shown;

[0055] Figure 10This is a schematic diagram of the structure of a long text generation device provided in an embodiment of this application;

[0056] Figure 11 A schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation

[0057] The term "and / or" used in this article describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.

[0058] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same properties in the description of embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such processes, methods, systems, products, or apparatus.

[0059] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0060] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.

[0061] The core task of this application is knowledge-based long-form text generation using a large language model. This task focuses on helping the large language model generate information-rich long-form texts by repeatedly planning and coordinating information gathering through search engines. This typically involves challenges such as pre-planning complex questions, continuously and dynamically adjusting retrieval strategies, integrating information from multiple sources, and latency. Latency generally refers to the latency of the first token, i.e., the time taken from when the user inputs the question to when the large language model begins generating the first token of the long-form text displayed to the user. Current main methods can be divided into three categories, but all struggle to balance the requirements of long-form text generation quality and latency: 1) Continuously triggering searches during generation: Low latency for the first token, but difficulty in controlling the overall rationality of the outline, easily resulting in a large amount of irrelevant content; 2) Decomposing into multiple sub-questions and then splicing them together: Simple planning, moderate latency, but poor coherence of the final long-form text; 3) Generating only after global multi-round search planning. High latency, complex process, but high upper limit of the quality of the final generated long-form text.

[0062] For example, in the first related technical solution, the user inputs the topic, audience, and genre of the article through process prompts, and provides the materials they want to include in the article; the large language model expands the information based on the user's input and generates a general outline of the article; the user modifies and expands the outline, including inputting detailed content and required materials for each part of the article, and passes this information to the large language model for integration and expansion. This fully considers the user's intent, context, and semantics, generating high-quality and personalized long articles, thereby improving writing efficiency and quality; it is used to generate articles with specific topic, audience, and genre requirements.

[0063] This technical solution requires users to provide data and materials, rather than the model planning the search itself, and it does not have the ability to plan multiple iterations.

[0064] The second related technical solution is a long-text generation scheme based on an outline. First, it generates an article outline by acquiring the user's input writing requirements and optionally using reference documents as a data source. The outline includes titles and chapter structures. Next, the generated outline is parsed and transformed into structured chapter title data. Then, based on each chapter title and user needs, specific chapter content is generated, and the accuracy and professionalism of the content are improved by combining knowledge base support.

[0065] This technical solution involves decomposing the problem into multiple sub-problems, generating them separately, and then splicing them together. It has weak control over the consistency between chapters and provides little information on how to plan the retrieval process to obtain relevant content.

[0066] In view of this, this application proposes a long text generation method that adopts a greedy retrieval planning strategy, which aims to retrieve as much relevant information as possible in a single parallel search and generate a complete long text response based on the relevant information. This method reduces the long text generation latency while ensuring the quality of the generated long text, thus balancing the requirements for both quality and latency.

[0067] To facilitate understanding of the solutions in the embodiments of this application, the technical terms involved in the solutions provided in this application will be briefly introduced below.

[0068] Large language models are deep learning models trained on massive amounts of text data. By learning the structure, rules, and semantics of language through training, they can generate text with a natural language style or answer questions in natural language.

[0069] Retrieval augmented generation (RAG) is a method that enhances the generative capabilities of large language models by retrieving relevant information. Based on the user's input query, it first retrieves information related to the query from an external knowledge base. This retrieved information, along with the user's query, is then fed into the large language model, helping it generate more accurate, targeted, and realistic answers. It offers advantages such as solving knowledge update problems, reducing illusions and errors, providing domain-specific knowledge, and improving efficiency and cost-effectiveness.

[0070] The following describes in detail the specific implementation of the long text generation method and apparatus provided in this application, with reference to the accompanying drawings and embodiments.

[0071] Figure 1 A schematic diagram of a system architecture is shown. The system includes a terminal 110, a server 130, and a network 120 that communicatively connects the terminal 110 and the server 130. The server 130 may include one or more servers (…). Figure 1 (Using only one server as an example for illustration), server 130 can provide long text generation tasks that take into account both latency and quality requirements for one or more terminals 110.

[0072] In some embodiments, server 130 may also provide other services or software applications, including both non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to end users under a Software as a Service (SaaS) model.

[0073] exist Figure 1In the system shown, server 130 may include one or more components that implement the functions performed by server 130. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. A user of operating terminal 110 may sequentially interact with server 130 and utilize the services provided by these components using one or more client applications. It should be understood that... Figure 1 This is merely one example of a system for implementing the various methods described in the embodiments of this application; other different configurations are possible, and the embodiments of this application do not limit this.

[0074] Terminal 110 can have applications related to long text generation installed (such as intelligent Q&A software, smartphone assistants, such as Huawei's Xiaoyi Smart Assistant, which can provide Xiaoyi knowledge Q&A services), or open web pages related to long text generation. The above applications and web pages can provide an interactive interface. Optionally, users can input query text through this interactive interface, which can also be called user questions. For example, the interactive interface provides a text input box, and users can input the question they want to query through the text box, such as "Please compare the Wenjie M7, Li Auto L7 and NIO ES7 and provide purchase advice." Users can also input the question they want to query through voice input. For example, the interactive interface provides a voice input button. Users can press and hold the voice input button and say the question they want to query, such as "Please compare the Wenjie M7, Li Auto L7 and NIO ES7 and provide purchase advice." Then, the voice-to-text conversion module converts the input voice into text. Terminal 110 can receive query text input by the user and send the query text to server 130. Server 130 can perform long text generation task based on the received query text using the long text generation method provided in this application embodiment, and obtain a long text response that takes into account both latency and quality requirements.

[0075] In another example, the user can also input the question they want to query via voice wake-up. For example, the user can say "Xiaoyi, Xiaoyi" to wake up the Xiaoyi AI smart assistant, and then input the question they want to query via voice, such as "Please compare the Wenjie M7, Li Auto L7 and NIO ES7 and provide purchase advice". The terminal 110 sends the received voice input to the server 130, the server 130 converts the voice into text, and then uses the long text generation method provided in this application embodiment to perform the long text generation task, so as to obtain a long text response that takes into account both latency and quality requirements.

[0076] Terminal 110 may include various types of computer devices, such as portable handheld devices (e.g., smartphones), general-purpose computers (e.g., personal computers or laptops), workstation computers, wearable devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (e.g., Google Chrome OS), Harmony OS; or various mobile operating systems, such as Microsoft Windows Mobile OS, Windowsphone, Android, iPhone OS, HarmonyOS NEXT, etc. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays and smartwatches, etc.

[0077] Network 120 can be any type of network well known to those skilled in the art, and can use any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, 3G, 4G, 5G, etc., to support data communication. For example, one or more networks 120 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, the public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, Wi-Fi), and / or any combination of these and / or other networks.

[0078] Server 130 may include one or more general-purpose computers, special-purpose server computers (e.g., personal computer servers, UNIX servers, terminal servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement or combination. Server 330 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization, such as one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for the server. In various embodiments, server 130 may run one or more services or software applications that provide the functionality described below.

[0079] In some implementations, server 130 can be a server for a distributed system or a server integrated with blockchain. Server 130 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and virtual private servers (VPS) services, such as high management difficulty and weak business scalability.

[0080] It should be noted that in some other examples, the terminal 110 can also execute the long text generation method provided in the embodiments of this application on its own to obtain a long text response that takes into account both latency and quality requirements, without the need for the cooperation of the server 130. Alternatively, the server 130 can also execute the long text generation method provided in the embodiments of this application on its own to optimize and obtain a long text response that takes into account both latency and quality requirements, without the need for the cooperation of the terminal 110. This application does not make specific limitations on this.

[0081] Figure 2 This is a flowchart illustrating the long text generation method provided in this application embodiment. This method can be executed by any device, equipment, platform, or cluster of devices with computing capabilities. This application embodiment does not specifically limit the specific computing device executing the method; a suitable computing device can be selected as needed. For example, it can be implemented by a terminal device, meaning the long text generation method can be implemented by a terminal device, providing a long text generation service that balances latency and quality. As another example, it can be implemented by a server, meaning the long text generation method can be implemented by a server, providing a long text generation service that balances latency and quality. Figure 1 The implementation can be executed on server 130. Alternatively, it can be executed on a cloud device, providing long-text generation services to cloud users as a cloud service. Another example is through end-to-end cloud collaboration, where some steps are executed on the terminal device and others on the cloud. For ease of description, the form of the execution entity will not be distinguished in the following text; all will be described as execution devices. Figure 2 As shown, the long text generation method provided in this application embodiment includes at least steps S201 to S205.

[0082] In step S201, the query text is obtained.

[0083] Taking a mobile phone as an example, a large language model is deployed on the mobile phone, which can provide intelligent question and answer services to users in the form of a mobile phone intelligent assistant.

[0084] For example, when a user has a question that needs answering, they can activate their phone's smart assistant and manually enter a natural query as the search text in the assistant's question-and-answer input box. For instance, the user taps the question-and-answer input box on the phone's touchscreen to bring up the virtual keyboard, then enters the query text "How do pianists and musicians typically balance composing and practicing composition?" in the input box, and clicks the "OK" button to submit the query. In response, the phone retrieves the query text and displays it on the phone's screen.

[0085] In another example, users can also input query text via voice. For instance, after activating the phone's smart assistant, a user can directly ask a question through the microphone. The phone responds to the user's action, acquires the user's voice input, recognizes the voice content, and then converts it into query text. Specific methods for converting voice content into text can be found in existing technologies, and will not be elaborated upon in this application.

[0086] It is understood that the methods for obtaining query text by terminal devices described above are merely illustrative and do not constitute a limitation on the scope of protection of the embodiments of this application.

[0087] In step S202, a greedy search plan is performed based on the query text to obtain the search plan result.

[0088] In step S203, a search is performed based on multiple search statements to obtain relevant information.

[0089] In this embodiment, a greedy search planning strategy is adopted to collect as much relevant information as possible in a single parallel search, so as to ensure that the retrieved information related to the query task is as complete as possible.

[0090] The greedy search planning strategy aims to collect as much relevant information as possible within a single parallel search opportunity. In other words, it seeks to generate as many parallel search statements as possible, using these parallel search statements to gather information, ensuring the completeness of the retrieved information while reducing the search time. Parallel search statements are those that are independent of each other; that is, the retrieval of one search statement does not depend on the results of another.

[0091] For example, a large language model can be invoked to decompose the query text into simpler sub-questions. Then, search queries can be generated for each sub-question. By breaking down complex problems into multiple simpler sub-questions, more in-depth analysis of different aspects can be conducted, leading to more specific solutions.

[0092] Of course, in other examples, query text can be decomposed into questions in other ways. For example, it can be decomposed into multiple simpler sub-questions according to preset rules. Alternatively, a neural network model specifically designed for question decomposition can be trained, with the query text as input. The neural network model then performs inference and outputs the decomposed question results, which include multiple sub-questions.

[0093] In another example, retrieval planning also considers background knowledge relevant to the current query to facilitate a more comprehensive retrieval plan. In other words, after the user enters their question (i.e., the query text), a pre-retrieval is performed based on the user's input text. For example, the search results obtained from searching the user's question on a regular search engine are used as background knowledge. Then, a greedy retrieval plan is performed using this background knowledge, which helps to plan more relevant search statements.

[0094] Figure 3 A schematic diagram illustrating the greedy search planning implementation steps in an embodiment of this application is shown. For example... Figure 3 As shown, the user question and the background knowledge obtained from the pre-retrieval of the user question are first decomposed into sub-questions using a large language model. Then, the large language model is used to generate retrieval statements (also known as search statements) for each sub-question. Finally, multiple retrieval statements are used in parallel to obtain retrieval documents, which contain relevant information related to the query task.

[0095] For example, the search results obtained from the user's original question are used as background knowledge and input into the large model along with the user's question. Based on the large model, the user's question intent is understood, and the user's question is decomposed into a different number of simpler sub-questions according to the complexity of the question, which facilitates the generation of subsequent search statements.

[0096] In practice, the large language model can generate prompts based on user questions and background knowledge using built-in prompt templates. These prompts instruct the large language model to decompose the user question. For example, a prompt template might be: "Please decompose the user question '…' into sub-problems based on the following background knowledge: '…'".

[0097] Then, a large language model is used to generate corresponding search statements for each decomposed sub-problem. A single sub-problem may generate multiple search statements. All generated search statements are retrieved in parallel to obtain the searched documents, which record relevant information about this query task.

[0098] Similarly, in the retrieval statement generation step, the large language model can also generate prompts for multiple sub-questions using built-in prompt templates. These prompts instruct the large language model to generate a retrieval statement for each sub-question. For example, the prompt template could be: "Please generate a retrieval statement for each of the following sub-questions: '...".

[0099] In step S204, a long text response corresponding to the query text is generated based on the query text and related information.

[0100] After obtaining the relevant information through the above steps, a complete long-text response is generated using the query text and related information. For example, a large language model can be invoked to infer from the query text and retrieved documents, outputting a complete long-text response. For instance, a prompt can be generated based on the user's question and the retrieved documents, guiding the large language model to generate a complete long-text response corresponding to the user's question. Optionally, prompts can be generated using prompt templates, such as: "Please refer to the following retrieved knowledge: "...", to generate a long-text response for the following question: "...".

[0101] For schemes with pre-retrieved background knowledge, the inputs to the large language model include: user question, background knowledge, and retrieval document.

[0102] Figure 4 A schematic diagram illustrating the long text generation steps of an embodiment of this application is shown. Figure 4 As shown, the user question, pre-retrieved background knowledge, and retrieved documents (i.e., relevant information retrieved based on the greedy retrieval planning results) are used as inputs to the large language model. The large language model then infers and outputs a complete long-text response. In other words, based on the currently retrieved relevant information, a complete long-text response is generated using the large language model.

[0103] For example, a prompt is first generated based on the user's question, background knowledge, and retrieved documents. This prompt is then input into a large language model. Guided by the prompt, the large language model infers from the background knowledge and retrieved documents to generate a complete, long-text response to the user's question. Optionally, the prompt can be generated using a prompt template. For example, the prompt template could be: "Please refer to the following background knowledge: "...", and the retrieved knowledge: "...", to generate a long-text response for the following question: "...".

[0104] In some other examples, to further improve the quality of the generated long-form responses, after generating the long-form responses through the above steps, the process also includes evaluating and providing feedback on the long-form responses generated in the previous round, as well as replanning based on the evaluation feedback and generating long-form responses based on the evaluation feedback. Through multiple iterations, the problems existing in the generated long-form responses are continuously improved, and the quality of the long-form responses is enhanced, such as making the generated long-form responses more professional and in-depth.

[0105] In each iteration of this application, a greedy search planning strategy is adopted. Each round of search planning is treated as the last round, and greedy planning and answering are performed to ensure that as many comprehensive search documents as possible are retrieved in each iteration, thereby ensuring the quality of the above text generated in each iteration.

[0106] Figure 5 This is a schematic diagram of a system architecture for implementing the long text generation method provided in the embodiments of this application. For example... Figure 5 As shown, the system architecture includes multiple rounds of planning and iteration, with each round of retrieval planning serving as the final round. A greedy algorithm is used to plan the data, retrieving information relevant to the query task. Then, a long text response (hereinafter referred to as "long text") is generated using this information, continuing until a self-evaluation criterion is met, the maximum number of iterations is reached, or a user feedback indicates a stop. That is, the value of N in the diagram can be determined based on whether the self-evaluation criterion is met, whether the maximum number of iterations is reached, or whether a user feedback stop instruction is received. The system consists of five key steps:

[0107] (1) Search planning: After the user enters a question, the first round of search statement planning is carried out based on certain background knowledge, and more relevant knowledge is obtained on the basis of background knowledge.

[0108] (2) Long text generation: Long texts are generated based on the relevant knowledge collected in the first round of retrieval planning.

[0109] (3) Self-evaluation feedback: The large model conducts self-evaluation of the long article generated in the previous round from multiple dimensions and receives user feedback. This will be involved in every round after the first round.

[0110] (4) Feedback-based replanning: Based on the evaluation feedback, further plan the search statements and retrieve supplementary knowledge. This will be involved in every round after the first round.

[0111] (5) Feedback-based long article generation: New long articles are generated based on the long articles generated in the previous round, the relevant knowledge collected for replanning, and the evaluation feedback. This will be involved in every round after the first round.

[0112] For a detailed description of the retrieval planning and long-text generation, please refer to the description above. The following section focuses on the specific implementation of the self-assessment feedback, feedback-based replanning, and feedback-based long-text generation steps.

[0113] Figure 6 A schematic diagram illustrating the self-assessment feedback steps of an embodiment of this application is shown. For example... Figure 6 As shown, user questions and the previous long text (i.e., the long text response generated in the previous round) can be used as input to the large language model. The large language model evaluates the long text generated in the previous round according to the evaluation criteria and user questions, and outputs evaluation feedback results in multiple dimensions.

[0114] For example, a prompt is first generated based on the user's question and the previous long text. This prompt is then input into the large language model. Guided by the prompt, the large language model evaluates the previous long text according to the user's question and evaluation criteria, and outputs the evaluation feedback. Optionally, the prompt can be generated using a prompt template. For example, the prompt template could be: "Please evaluate the long text generated for the following question: "...", "...", according to the evaluation criteria."

[0115] The evaluation criteria record which dimensions the large language model needs to evaluate the previous long text.

[0116] Figure 7 A schematic diagram of an evaluation standard is shown. For example... Figure 7 As shown, the evaluation criteria record multiple assessment dimensions, including relevance, breadth of information, depth of information, and consistency, guiding the large language model to evaluate the previous round of long articles from multiple dimensions.

[0117] It should be noted that, Figure 7 The evaluation criteria shown are merely a feasible example and do not constitute a limitation on the embodiments of this application. The embodiments of this application may also evaluate the previous long text from fewer dimensions, such as any one of the dimensions of relevance, breadth of information, depth of information and consistency, or any two or three dimensions.

[0118] In response to user feedback, this embodiment of the application displays a complete long article to the user after each round of generation. The user can input feedback on the article through an interactive interface, pointing out problems and / or suggesting modifications. For example, the display page has a feedback option; if the user selects this option, a text box will pop up where the user can input their feedback.

[0119] In another example, the interface also includes a confirmation button. If the user finds no problems with the generated long text, they can click the confirmation button. In response to this action, a stop iteration command is generated, the iteration stops, and the generated long text is output, which is the final long text response.

[0120] Figure 8 A schematic diagram illustrating the feedback-based replanning steps of an embodiment of this application is shown. Figure 8 As shown, the large language model is invoked, and a greedy search plan is performed based on user questions, previous long articles, evaluation feedback, and user feedback. The updated search plan results are then output, and the updated search documents are retrieved using the updated search plan results.

[0121] The feedback-based replanning step still involves sub-question decomposition and search statement generation. The sub-question decomposition here is similar to that in the previous retrieval planning, but the difference is that this step uses the large model to generate parallelizable sub-questions that need further resolution or supplementation based on evaluation and user feedback. That is, the generated prompts are different; these prompts instruct the large language model to decompose the user question based on the user question, the previous long document, evaluation feedback, and user feedback. Optionally, this prompt can be automatically generated using a prompt template, such as: "The long document generated in the previous round is: '…', evaluation feedback is: '…', user feedback is: '…', please refer to the above information to decompose the user question: '…' into sub-questions." The search statement generation here is consistent with the search statement generation step in the previous retrieval planning; all generated search statements are retrieved in parallel to obtain the searched documents.

[0122] In some other examples, evaluation feedback may consist only of self-evaluation feedback based on a large language model, excluding user feedback, thus eliminating the need for user feedback operations and reducing user involvement.

[0123] Figure 9 A schematic diagram illustrating the feedback-based long text generation steps of an embodiment of this application is shown. Figure 9 As shown, the large language model is invoked to regenerate a new long text based on the user question, the previous text, evaluation feedback, user feedback, and retrieved documents (i.e., relevant information collected for replanning).

[0124] For example, a prompt is first generated based on the user question, the previous round of text, evaluation feedback, user feedback, and retrieved documents. This prompt is then input into the large language model. Guided by this prompt, the large language model infers from the previous round of text, evaluation feedback, user feedback, and retrieved documents to generate an optimized long-text response for the user question. Optionally, the prompt can be generated using a prompt template. For example, the prompt template could be: "The long-text generated in the previous round was: '...', the evaluation feedback was: '...', the user feedback was: '...', and the retrieved documents are: '...'. Please refer to the above information to generate a long-text response for the following question: '...'". This requires the large language model to further optimize the previous round of long-text responses based on the feedback requirements.

[0125] The long text generation method provided in this application adopts a greedy planning strategy in each iteration, which aims to collect as much relevant information as possible in a single parallel search and generate a complete long text, and to improve the quality of the long text based on continuous feedback in multiple iterations.

[0126] For example, the user's original question was, "How do pianists and musicians typically balance composition and etude practice?" After the first iteration, the following complete, longer response was generated:

[0127] Pianists and musicians have their own unique strategies for balancing composition and etude studies, achieving this goal through scientific and reasonable time management, specific practical methods, and psychological adjustment.

[0128] ###1. Overall Time Management

[0129] First, pianists and musicians need to plan their daily time effectively. Take the renowned pianist Lang Lang as an example: starting at age seven, he woke up at 5:45 every morning for an hour of practice before going to school; after lunch, he practiced for another 45 minutes, followed by two more hours of practice after school, and then another two hours of practice in the evening before doing his homework. This strict schedule ensured that he could dedicate sufficient time to music and learn efficiently.

[0130] Making efficient use of fragmented time is also one of these musicians' secrets. For example, short periods of time at noon and after school are fully utilized for practice, wasting no time. This method can be adopted by ordinary piano learners to improve their daily practice efficiency.

[0131] ###2. Specific Practical Methods

[0132] **Practicing at fixed times and in fixed amounts** is an important strategy for pianists to maintain efficient learning. Practicing at fixed times every day not only helps to form good habits, but also improves the efficiency and effectiveness of practice. Even when the workload is heavy, such as when there is a lot of schoolwork or other tasks, you should still maintain at least 1-1.5 hours of practice time every day. When there is less homework, you can increase it to 2 hours or more.

[0133] Regarding specific **practice methods**, there are several scientifically effective techniques:

[0134] - **Slow practice**: For example, as Zhao Xiaosheng mentioned, slow practice is like a "magnifying glass," which allows the learner to notice every detail in the music and has time to prepare and correct shortcomings.

[0135] **Fast Practice**: Practicing quickly on the basis of slow practice can help you quickly grasp the overall continuity and sense of speed of a piece of music.

[0136] - **Medium-speed practice**: This practice method serves as a bridge between slow and fast practice, helping to solidify skills learned in slow practice and allowing for a faster adaptation to faster-paced music.

[0137] In addition, pianists also use **separate hand exercises** and **voice exercises** to practice the left and right hands and different voices separately, overcome technical difficulties, and gradually play the whole piece coherently.

[0138] ###3. Psychological Adjustment and Self-Motivation

[0139] During intensive learning and practice, pianists and musicians also place great emphasis on psychological adjustment and self-motivation. Cultivating interest and passion is the driving force for continuous progress. As Lang Lang said, learning the piano is not just about playing and having fun, but about developing patience, perseverance, and a pursuit of beauty through repeatedly overcoming tedious practice.

[0140] To maintain long-term motivation, they often set clear goals and stages, whether it's exams, competitions, performances, or composition. Achieving each goal brings a sense of accomplishment and motivates them to keep going.

[0141] In conclusion, the core of a pianist's balanced approach to composition and etude learning lies in scientific and reasonable time management, effective practice methods, and a stable mental state and motivation. Through rhythmic daily practice, breaking down challenging exercises, and setting phased goals, musicians can find their own balance amidst the pressures of study and creation.

[0142] As can be seen, the results of the first round of long text generation clearly have a relevance problem; it only answers "practicing the piano" but doesn't mention "composing," nor does it address how to balance the two. The self-evaluation feedback from the first round of generated long texts, obtained by calling a large language model, is shown below:

[0143] ###1. Evaluation and Analysis:

[0144] The lengthy answer suffers from issues in relevance, breadth of information, and depth of information. For example, regarding the specific question of "how pianists and musicians balance composition and etude learning," the article does not delve into specific strategies for balancing composition and etude learning, but instead focuses primarily on practice methods, demonstrating a lack of relevance.

[0145] ###2. Evaluation Feedback:

[0146] **Correlation**:

[0147] 1. Problem Description: The article focuses on practice methods but lacks specific strategies for balancing composition and etude learning. For example, when discussing time management, it doesn't mention how to balance composition time within that framework.

[0148] 2. Improvement Suggestion: Content should be added regarding how pianists and musicians specifically allocate their composition time, and explaining the trade-offs between time allocation for composition and etude study. For example, specific allocation schemes could be described, such as how much time is specifically dedicated to composition each day.

[0149] **Information breadth**:

[0150] 1. Problem Description: The article mainly focuses on the details of learning etudes and involves various practice methods, but it does not cover how different pianists or musicians handle composition and practice at different times.

[0151] 2. Suggestions for improvement: Case studies should be added on how different musicians balanced composition and practice at different stages, explaining the effectiveness of these strategies in practical application. For example, the habits and methods of some famous composers who were also pianists could be described.

[0152] **Information Depth:**

[0153] 1. Problem description: The article lacks in-depth analysis of the inherent logic and relationship between composition and etude learning, and mainly stays on the surface of practice methods.

[0154] 2. Suggestions for improvement: It is necessary to explore in depth the importance of composition for technical practice, and how technical practice, in turn, can promote the improvement of composition ability, and provide more detailed principle analysis and specific examples.

[0155] It can be seen that a "relevance issue" was found in the self-assessment feedback.

[0156] Next, feedback-based replanning and feedback-based long-text generation are performed. This involves calling the large language model, performing a greedy search plan based on the user question, the previous long-text, and evaluation feedback, and outputting the updated search plan results. Then, the updated search plan results are used to update the search documents. Finally, the large language model is called again to regenerate a new long-text based on the user question, the previous text, evaluation feedback, and the new search documents (i.e., the relevant information collected during replanning). In other words, the long-text generated in the first round is optimized and regenerated. The optimized long-text is shown below:

[0157] Pianists and musicians typically employ scientific and reasonable time management, specific practical methods, and psychological adjustments to achieve a balance between composition and etude studies. Below are some detailed strategies and methods.

[0158] ###1. Overall Time Management and Time Allocation

[0159] Properly planning one's daily time is key to balancing composition and etude studies. Many renowned musicians strictly manage their time. For example, pianist Lang Lang had an extremely strict schedule from a young age. He practiced for an hour every morning, continued practicing during lunch breaks and after school, and also practiced for two hours in the evening.

[0160] For musicians who also need to compose, the following time allocation scheme can be used as a reference:

[0161] - **Morning (1 hour):** Basic skills practice, such as scales, arpeggios and other basic techniques.

[0162] - **Morning (1 hour):** Composition time, for creating new music or revising previous works.

[0163] - **Afternoon (2 hours)**: Practice etudes, especially combining separate hand exercises and combined hand exercises.

[0164] - **Evening (1 hour):** Review and refine the day's compositional work, or practice the pieces you will be playing.

[0165] ###2. Specific Practical Methods

[0166] Effective practice methods are crucial. Here are some commonly used techniques:

[0167] **Slow practice vs. fast practice:** Slow practice helps you focus on details, while fast practice helps you grasp the overall flow. Medium-speed practice acts as a bridge to solidify skills.

[0168] - **Separate Hand Practice:** Practice with both hands separately to improve proficiency in certain technical difficulties.

[0169] **Phrase-by-phrase practice:** This method helps you learn the structure of a piece of music phrase by phrase, and is especially effective when dealing with difficult parts.

[0170] For composing music, the following methods can be used as a reference:

[0171] **Establish a dedicated composition time:** Focusing on composition at fixed times each day or week is a practice many composers have long adhered to. For example, Tchaikovsky spent two hours composing every morning, and scheduled practice and teaching activities for the afternoon.

[0172] - **Inspiration Capture and Recording:** Carry a notebook or recording device with you to record sudden musical inspirations at any time.

[0173] ###3. Case Sharing

[0174] Many famous composers and pianists had unique schedules. For example, Beethoven would do basic finger exercises before composing a new work to maintain finger dexterity. Mozart, on the other hand, composed anytime, anywhere, without being bound by occasion or time, a habit that allowed him to practice piano techniques even in between compositions.

[0175] ###4. Psychological Adjustment and Self-Motivation

[0176] In the process of intense learning and creation, psychological adjustment is crucial. Maintaining emotional investment and enthusiasm for work can be achieved by setting phased goals, whether it's exams, competitions, or performances. By achieving these goals one by one, one can maintain a long-term interest in learning the piano and composing.

[0177] ###5. The Intrinsic Relationship Between Composition and Etude Learning

[0178] Composition and etude study complement each other. Technical practice improves a pianist's playing ability, which in turn enriches their use of various techniques and expressive methods in composition. For example, Chopin used these pieces simultaneously to enhance his playing skills when composing his etude collection.

[0179] In conclusion, pianists and musicians can find a balance between efficient learning and creation through scientific time management, effective practice methods, and psychological adjustment, thereby continuously improving their skills and creative abilities. By setting clear goals and making reasonable time arrangements, they not only strive for excellence in technical practice but also continuously break through in composition.

[0180] As can be seen, the re-generated long article based on the evaluation feedback has resolved the previous relevance issues. Thus, through multiple iterations and continuous optimization of the generated long articles, the quality of the generated long articles has been effectively improved.

[0181] It should be noted that the large language model used in the embodiments of this application can be the same large language model, such as the gpt4o large language model. However, the large language models used in the embodiments of this application can also be different large language models. For example, considering that different steps in the long text generation method provided in the embodiments of this application have different requirements for the reasoning ability of the large language model, relatively simpler steps such as retrieval sentence generation may not require annotation or data construction for fine-tuning, or may use a large language model with a smaller parameter scale. Conversely, some more complex steps, such as self-evaluation feedback and feedback-based long text generation steps, may consider using a large language model with a larger parameter scale or constructing corresponding data for fine-tuning training.

[0182] Based on the same concept as the aforementioned embodiment of a long text generation method, this application also provides a long text generation device 1000. This long text generation device 1000 can be deployed on a server or terminal device to provide a long text generation service that balances the quality and latency requirements of generated long texts. The long text generation device 1000 includes components for implementing... Figure 2-9 The units or modules of each step in the long text generation method shown.

[0183] Figure 10 This is a schematic diagram of a long text generation device provided in an embodiment of this application. Figure 10 As shown, the long text generation device 1000 includes an acquisition module 1001, a retrieval planning module 1002, a retrieval module 1003, and a generation module 1004. The acquisition module 1001 is used to acquire the query text; the retrieval planning module 1002 is used to perform a greedy retrieval planning based on the query text to obtain the retrieval planning result, which is a plurality of retrieval statements for parallel retrieval; the retrieval module 1003 is used to perform retrieval based on the plurality of retrieval statements to obtain relevant information, which is information related to the current query task; and the generation module 1004 is used to generate a long text response corresponding to the query text based on the query text and the relevant information.

[0184] In one possible implementation, the objective of a greedy retrieval plan is to obtain relevant information to support the task of generating long text responses through a single round of retrieval.

[0185] In one possible implementation, the retrieval planning module 1002 is specifically used to: perform greedy retrieval planning based on the query text and background knowledge to obtain the retrieval planning result, wherein the background knowledge includes the retrieval content obtained by pre-retrieval based on the query text.

[0186] In another possible implementation, a specific implementation of greedy retrieval planning based on query text and background knowledge to obtain retrieval planning results is as follows: input the query text and background knowledge into the first language model so that the first language model decomposes the query text into multiple sub-problems; input the multiple sub-problems into the second language model so that the second language model generates multiple retrieval statements for the multiple sub-problems.

[0187] In another possible implementation, the generation module 1004 is specifically used to: take the query text and related information as input to the third language model and output a long text response.

[0188] In another possible implementation, the relevant information includes multiple search documents retrieved based on multiple search statements; a specific implementation of taking the query text and relevant information as input to the third large language model and outputting a long text response is as follows: based on the query text and multiple search documents, a prompt is generated, which instructs the large language model to generate a long text response for the query text based on the multiple search documents.

[0189] In another possible implementation, the long text generation apparatus 1000 provided in this application further includes an evaluation feedback module 1005, a replanning module 1006, and a regeneration module 1007. The evaluation feedback module 1005 evaluates the long text response and obtains evaluation feedback information. The re-retrieval module 1006, based on the evaluation feedback information, performs a greedy retrieval plan again and updates the retrieval plan result. It then performs a retrieval based on the updated retrieval plan result and updates the relevant information. The regeneration module 1007 updates the long text response based on the query text, the updated relevant information, the evaluation feedback information, and the long text response. After several iterations, the final long text response is obtained.

[0190] In another possible implementation, the evaluation feedback information includes self-evaluation feedback information; the evaluation feedback module 1005 is specifically used to: input the query text and the long text response into the fourth language model, so that the fourth language model evaluates the long text response from at least one dimension to obtain self-evaluation feedback information.

[0191] In another possible implementation, at least one dimension includes one or more of the following: relevance dimension, breadth of information dimension, depth of information dimension, and consistency dimension.

[0192] In another possible implementation, the evaluation feedback information also includes user feedback information, which includes feedback information entered by the user after evaluating the long text response.

[0193] In another possible implementation, the iteration stopping condition for several rounds of iterations includes any one of the following: reaching the configured number of iterations, meeting the self-evaluation feedback criteria, and receiving a stop iteration instruction from the user.

[0194] In one possible implementation, the first, second, third, fourth, and fifth largest language models are the same large language model.

[0195] In another possible implementation, the first, second, third, fourth, and fifth major language models are different major language models.

[0196] The long text generation apparatus 1000 according to the embodiments of this application can correspond to the execution of the methods described in the embodiments of this application, and the above and other operations and / or functions of each module in the long text generation apparatus 1000 are respectively for implementing Figure 2-9 For the sake of brevity, the corresponding processes of each method in the code will not be elaborated here.

[0197] This application embodiment also provides a computing device, including at least one processor, a memory, and a communication interface, wherein the processor is used to execute... Figure 2-9 The method described.

[0198] Figure 11 A schematic diagram of the structure of a computing device provided in an embodiment of this application.

[0199] like Figure 11 As shown, the computing device 1100 includes at least one processor 1101, a memory 1102, and a communication interface 1103. The processor 1101, memory 1102, and communication interface 1103 are communicatively connected, which can be achieved via a wired (e.g., bus) or wireless connection. The communication interface 1103 is used to send and / or receive data from other devices. The memory 1102 stores computer instructions, which the processor 1101 executes to perform the methods described in the foregoing method embodiments, thereby providing a long text generation service that balances the quality and latency requirements of the generated long text.

[0200] It should be understood that, in the embodiments of this application, the processor 1101 may be a central processing unit (CPU), and the processor 1001 may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0201] The memory 1102 may include read-only memory and random access memory, and provides instructions and data to the processor 1101. The memory 1102 may also include non-volatile random access memory. Optionally, the random access memory may be, for example, high bandwidth memory (HBM).

[0202] The memory 1102 can be volatile memory or non-volatile memory, or it can include both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but 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 linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0203] It should be understood that the computing device 1100 according to the embodiments of this application can perform the implementation of the embodiments of this application. Figure 2-9 The method shown is described in detail above, and will not be repeated here for the sake of brevity.

[0204] Embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer instructions are executed by a processor, the aforementioned method is implemented.

[0205] Embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer instructions are executed by a processor, the aforementioned method is implemented.

[0206] An embodiment of this application provides a chip including at least one processor and an interface, wherein the at least one processor determines program instructions or data through the interface; the at least one processor is used to execute the program instructions to implement the method mentioned above.

[0207] Embodiments of this application provide a computer program or computer program product that includes instructions that, when executed, cause a computer to perform the methods mentioned above.

[0208] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0209] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented using hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0210] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above description is only a specific embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for generating long text, characterized in that, include: Get the query text; Based on the query text, a greedy search plan is performed to obtain the search plan result, which is a set of multiple search statements for parallel retrieval. Based on the multiple search statements, relevant information is obtained, which is information related to this query task. Based on the query text and the relevant information, a long text response corresponding to the query text is generated.

2. The method according to claim 1, characterized in that, The objective of the greedy retrieval plan is to obtain the relevant information that supports the completion of the long text response generation task through one round of retrieval.

3. The method according to claim 1 or 2, characterized in that, The greedy search planning based on the query text, to obtain the search planning result, includes: Based on the query text and background knowledge, a greedy search plan is performed to obtain the search plan result. The background knowledge includes the search content obtained by pre-searching based on the query text.

4. The method according to claim 3, characterized in that, The greedy search planning based on the query text and background knowledge, to obtain the search planning result, includes: The query text and background knowledge are input into the first large language model, so that the first large language model decomposes the query text into multiple sub-problems; The multiple sub-problems are input into the second large language model, so that the second large language model generates the multiple search statements for the multiple sub-problems.

5. The method according to any one of claims 1-4, characterized in that, The step of generating a long text response corresponding to the query text based on the query text and the relevant information includes: The query text and related information are used as input to the third language model to output the long text response.

6. The method according to claim 5, characterized in that, The relevant information includes multiple search documents obtained based on the multiple search statements; The step of taking the query text and the relevant information as input to the third language model and outputting the long text response includes: Based on the query text and the multiple search documents, a prompt is generated, which instructs the large language model to generate the long text response for the query text based on the multiple search documents.

7. The method according to any one of claims 1-6, characterized in that, Also includes: The long text response is evaluated to obtain evaluation feedback information; Based on the evaluation feedback information, the greedy search plan is performed again, and the search plan result is updated. The search is performed based on the updated search plan results, and the relevant information is updated accordingly. The long text response is updated based on the query text, the updated relevant information, the evaluation feedback information, and the long text response; After several rounds of iteration, the final long text response is obtained.

8. The method according to claim 7, characterized in that, The assessment feedback information includes self-assessment feedback information; The evaluation of the long text response to obtain evaluation feedback information includes: The query text and the long text response are input into the fourth language model so that the fourth language model evaluates the long text response from at least one dimension to obtain the self-evaluation feedback information.

9. The method according to claim 8, characterized in that, The at least one dimension includes one or more of the following dimensions: relevance dimension, information breadth dimension, information depth dimension, and consistency dimension.

10. The method according to any one of claims 7-9, characterized in that, Based on the evaluation feedback information, the greedy search planning is performed again, and the search planning results are updated, including: The query text, the long response, and the evaluation feedback information are used as inputs to the fifth language model, and the updated retrieval plan results are output.

11. The method according to any one of claims 7-10, characterized in that, The evaluation feedback information also includes user feedback information, which includes feedback information entered by the user after evaluating the long text response.

12. The method according to any one of claims 8-11, characterized in that, The iteration stopping conditions for the aforementioned rounds of iterations include any one of the following: reaching the configured number of iterations, meeting the self-evaluation feedback criteria, and receiving a stop iteration instruction from the user.

13. A long text generation device, characterized in that, include: The retrieval module is used to retrieve the query text; The retrieval planning module is used to perform a greedy retrieval plan based on the query text to obtain the retrieval planning result, which is a set of multiple retrieval statements for parallel retrieval. The retrieval module is used to perform retrieval based on the multiple retrieval statements to obtain relevant information, which is information related to the current query task. The generation module is used to generate a long text response corresponding to the query text based on the query text and the relevant information.

14. The apparatus according to claim 13, characterized in that, The objective of the greedy retrieval plan is to obtain the relevant information that supports the completion of the long text response generation task through one round of retrieval.

15. The apparatus according to claim 13 or 14, characterized in that, The retrieval planning module is specifically used for: Based on the query text and background knowledge, a greedy search plan is performed to obtain the search plan result. The background knowledge includes the search content obtained by pre-searching based on the query text.

16. The apparatus according to claim 15, characterized in that, The greedy search planning based on the query text and background knowledge, to obtain the search planning result, includes: The query text and background knowledge are input into the first large language model, so that the first large language model decomposes the query text into multiple sub-problems; The multiple sub-problems are input into the second large language model, so that the second large language model generates the multiple search statements for the multiple sub-problems.

17. The apparatus according to any one of claims 13-16, characterized in that, The generation module is specifically used for: The query text and related information are used as input to the third language model to output the long text response.

18. The apparatus according to claim 17, characterized in that, The relevant information includes multiple search documents obtained based on the multiple search statements; The step of taking the query text and the relevant information as input to the third language model and outputting the long text response includes: Based on the query text and the multiple search documents, a prompt is generated, which instructs the large language model to generate the long text response for the query text based on the multiple search documents.

19. The apparatus according to any one of claims 13-18, characterized in that, Also includes: The evaluation feedback module is used to evaluate the long text response and obtain evaluation feedback information. The re-retrieval module is used to perform the greedy retrieval plan again based on the evaluation feedback information and update the retrieval plan results; The search is performed based on the updated search plan results, and the relevant information is updated accordingly. The regeneration module is used to update the long text response based on the query text, the updated relevant information, the evaluation feedback information, and the long text response; After several rounds of iteration, the final long text response is obtained.

20. The apparatus according to claim 19, characterized in that, The assessment feedback information includes self-assessment feedback information; The evaluation feedback module is specifically used for: The query text and the long text response are input into the fourth language model so that the fourth language model evaluates the long text response from at least one dimension to obtain the self-evaluation feedback information.

21. The apparatus according to claim 20, characterized in that, The at least one dimension includes one or more of the following dimensions: relevance dimension, information breadth dimension, information depth dimension, and consistency dimension.

22. The apparatus according to any one of claims 19-21, characterized in that, The regeneration module is specifically used for: The query text, the long response, and the evaluation feedback information are used as inputs to the fifth language model, and the updated retrieval plan results are output.

23. The apparatus according to any one of claims 19-22, characterized in that, The evaluation feedback information also includes user feedback information, which includes feedback information entered by the user after evaluating the long text response.

24. The apparatus according to any one of claims 20-23, characterized in that, The iteration stopping conditions for the aforementioned rounds of iterations include any one of the following: reaching the configured number of iterations, meeting the self-evaluation feedback criteria, and receiving a stop iteration instruction from the user.

25. A computing device, comprising a memory and a processor, characterized in that, The memory stores instructions that, when executed by a processor, cause the method described in any one of claims 1-12 to be implemented.

26. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it causes the method as described in any one of claims 1-12 to be implemented.

27. A chip comprising at least one processor and a communication interface, the processor being configured to perform the method as described in any one of claims 1-12.

28. A computer program or computer program product comprising instructions that, when executed, cause a computer to perform the method as described in any one of claims 1-12.