Reinforcement learning-based document retrieval enhancement generation method and system

By using a reinforcement learning-based document retrieval enhancement generation method, unified decision-making for retrieval, reordering, and proactive visual perception in visual document question answering tasks is achieved. This solves the problems of noise and information redundancy in existing technologies and improves reasoning accuracy and robustness.

CN123178590APending Publication Date: 2026-11-27BEIJING DEEPGLINT INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611308663.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-26
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing visual retrieval enhancement generation methods rely on shallow similarity matching, resulting in the inclusion of task-irrelevant images in the retrieval results and introducing background noise. Furthermore, reinforcement learning-based methods only provide reward signals based on whether the final answer is correct or not, leading to the independence of each step and limiting system performance.

Method used

We adopt a reinforcement learning-based document retrieval enhancement generation method. An agent generates and executes actions such as obtaining candidate image sets from an image corpus, determining target images for semantic matching, and extracting key information regions. Combined with a multi-stage reward mechanism to optimize the model strategy, we realize a unified sequential decision framework for retrieval, re-ranking, and active visual perception.

Benefits of technology

It reduces retrieval noise, avoids information redundancy, improves the reasoning accuracy and robustness of visual document question answering tasks, and drives agent policy optimization by clarifying credit allocation through dense reward signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178590A_ABST
    Figure CN123178590A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of based on reinforcement learning's document retrieval enhancement generation method and device, system, storage medium, it is related to visual document retrieval enhancement generation technical field.By incorporating retrieval, reordering, active visual perception and reasoning into a unified sequential decision framework, the defect that the system performance is limited due to the independence of each link in the related art is overcome.By precisely selecting actions and active visual perception actions, semantic filtering of candidate images and active focusing on local key regions are achieved, respectively, reducing retrieval noise and avoiding information redundancy caused by full-image encoding.By providing supervision signals for retrieval, selection, perception and final answers through a dense multi-stage reward mechanism, the credit allocation in reinforcement learning is clearly defined, driving agent policy optimization, and improving the reasoning accuracy and robustness of the model in complex visual document question answering tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual document retrieval enhancement generation technology, specifically, to a document retrieval enhancement generation method, apparatus, system, and storage medium based on reinforcement learning. Background Technology

[0002] Currently, retrieval-enhanced generative techniques are widely used to improve the factual accuracy of large language models in knowledge-intensive tasks. The core process involves first retrieving documents relevant to the user's query from an external knowledge base using information retrieval techniques, and then providing these retrieved documents as additional contextual information to the generative language model to assist in generating more reliable answers. In recent years, with the continuous development of multimodal technologies, the paradigm of retrieval-enhanced generative has expanded to the visual domain. Visual retrieval-enhanced generative systems allow large visual language models to perform reasoning and question answering using retrieved external visual documents, including PDF files, scanned documents, charts in slides, and various data reports and other images.

[0003] In related technologies, one visual retrieval enhancement generation method relies on an embedding-based retrieval approach to align text queries with visual documents. After encoding the retrieved complete image, it is input into a large visual language model for inference generation. Typical examples include ColPali and VisRAG. Another method introduces reinforcement learning into the visual retrieval enhancement generation process. It uses a large visual language model as an agent, trains the model to perform retrieval and visual perception actions through reinforcement learning, and optimizes the model strategy based on the reward signal of the final inference result. Typical examples include VRAG-RL. In addition, related technologies have also proposed improved schemes to optimize retrieval strategies, such as Search-R1 and its visual variant Search-R1-VL.

[0004] In the process of implementing the embodiments of this application, at least the following problems were found in the related technology: External retrieval engines in related technologies rely solely on shallow visual or textual similarity for matching, resulting in task-irrelevant images in the retrieval results and introducing background noise into subsequent inference. Large visual language models encode the entire image used to determine reading, while key information for answering questions in rich visual documents is concentrated in local regions; this full-image encoding makes it difficult to extract fine visual details. Reinforcement learning-based methods only provide reward signals based on the correctness of the final answer. Therefore, employing related technologies leads to the independence of retrieval, re-ranking, active visual perception, and inference processes, limiting overall system performance. Summary of the Invention

[0005] This application provides a document retrieval enhancement generation method, apparatus, system, and storage medium based on reinforcement learning.

[0006] A first aspect of this application provides a reinforcement learning-based document retrieval enhancement generation method applied to a computer system execution, comprising: acquiring query information and initializing an interaction history, the interaction history containing the query information; in each iteration step, generating and executing an action by an agent based on the current interaction history, the action being at least one of a first action, a second action, a third action, or a termination action, wherein the first action is used to acquire a candidate image set from an image corpus, the second action is used to determine a target image semantically matching the query information from the candidate image set, the third action is used to extract a key information region from the target image, and the termination action is used to generate a final answer based on the query information and the key information region; if the action is the first action, the second action, or the third action, acquiring an observation of the environment in response to the action and appending the observation to the interaction history, the observation corresponding to the type of action, and continuing to execute the iteration step; if the action is a termination action, outputting the final answer.

[0007] A second aspect of the embodiments of this application provides a document retrieval enhancement generation apparatus based on reinforcement learning, including a processor and a memory storing program instructions. The processor is configured to execute the document retrieval enhancement generation method based on reinforcement learning as described in the first aspect of the embodiments of this application when running the program instructions.

[0008] A third aspect of the present application provides a computer system, including: a computer system body; and a document retrieval enhancement generation apparatus based on reinforcement learning, as described in the second aspect of the present application, installed on the computer system body.

[0009] A fourth aspect of the embodiments of this application provides a computer-readable storage medium storing program instructions, which, when executed, cause a computer to perform a reinforcement learning-based document retrieval enhancement generation method as described in the first aspect of the embodiments of this application.

[0010] The document retrieval enhancement generation method, apparatus, system, and storage medium based on reinforcement learning provided in the embodiments of this application have the following beneficial effects: This application's embodiments overcome the performance limitations of related technologies where each stage is independent, by incorporating retrieval, reordering, active visual perception, and reasoning into a unified sequential decision-making framework. Through precise selection actions and active visual perception actions, semantic filtering of candidate images and active focusing on key local regions are achieved, reducing retrieval noise and avoiding information redundancy caused by full-image encoding. A dense, multi-stage reward mechanism provides supervisory signals to retrieval, selection, perception, and the final answer, clearly defining credit allocation in reinforcement learning, driving agent policy optimization, and improving the model's reasoning accuracy and robustness in complex visual document question-answering tasks. Attached Figure Description

[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic diagram of a reinforcement learning-based document retrieval enhancement generation method provided in an embodiment of this application; Figure 2 This is a schematic diagram of another reinforcement learning-based document retrieval enhancement generation method provided in an embodiment of this application; Figure 3 This is a schematic diagram of a document retrieval enhancement generation device based on reinforcement learning provided in an embodiment of this application.

[0012] Figure label: 800: Reinforcement learning-based document retrieval enhancement generation device; 801: Processor; 802: Memory; 803: Communication interface; 804: Bus. Detailed Implementation

[0013] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.

[0014] This application proposes a computer system, including a computer system ontology and the following reinforcement learning-based document retrieval enhancement generation device 800. The computer system ontology includes an interaction initialization module, an agent module, an external environment module, an interaction history update module, a reward calculation module, and a supervised fine-tuning training module. The interaction initialization module is used to acquire query information and initialize the interaction history, which contains the query information. The agent module is used to generate and execute actions based on the current interaction history in each iteration step. The action type includes at least one of a first action, a second action, a third action, or a termination action. The first action is used to acquire a candidate image set from an image corpus; the second action is used to determine a target image semantically matching the query information from the candidate image set; the third action is used to extract key information regions from the target image; and the termination action is used to generate a final answer based on the query information and the key information regions. The external environment module is used to return corresponding observations in response to the first, second, or third action executed by the agent module. The interaction history update module is used to append the observations returned by the external environment module to the current interaction history in the form of user roles, forming a new interaction history. The reward calculation module is used to calculate the first reward value corresponding to the first action, the second reward value corresponding to the second action, the third reward value corresponding to the third action, the pattern following reward value, and the result reward value corresponding to the termination action during the training phase. The supervised fine-tuning training module is used to supervise and fine-tune the agent using training data during the supervised fine-tuning phase. The reinforcement learning-based document retrieval enhancement generation device 800 is installed in the computer system body. The installation relationship described herein is not limited to placement within the computer system, but also includes installation and connection with other components of the computer system, including but not limited to physical connections, electrical connections, or signal transmission connections. Those skilled in the art will understand that the reinforcement learning-based document retrieval enhancement generation device 800 can be adapted to feasible computer system bodies to achieve other feasible embodiments. The reinforcement learning-based document retrieval enhancement generation device 800 also includes a processor 801, which is electrically connected to the above modules and is used to control the above modules to perform corresponding actions.

[0015] Figure 1 and Figure 2 This is a flowchart illustrating a reinforcement learning-based document retrieval enhancement generation method provided in an embodiment of this application. Any of the following methods can be executed in a computer system or in a server or terminal device that is connected to the computer system.

[0016] Based on the above-mentioned computer system structure, such as Figure 1 As shown, this application provides a reinforcement learning-based document retrieval enhancement generation method, applied to a computer system for execution, including: S01, obtain query information and initialize the interaction history, which contains query information.

[0017] S02, in each iteration step, based on the current interaction history, an action is generated and executed by the agent. The action is at least one of a first action, a second action, a third action, or a termination action. The first action is used to obtain a candidate image set from the image corpus, the second action is used to determine the target image that semantically matches the query information from the candidate image set, the third action is used to extract the key information region from the target image, and the termination action is used to generate the final answer based on the query information and the key information region.

[0018] S03, if the action is the first action, the second action, or the third action, then obtain the observation of the environment response to the action return, and append the observation to the interaction history. The observation corresponds to the type of the action, and continue to execute the iteration step.

[0019] S04. If the action is a termination action, then output the final answer.

[0020] In this embodiment, the query information is a question statement in natural language. The interaction history is initialized to contain only a message sequence of query information given by a user role. The agent is implemented as a pre-trained large visual language model capable of processing both text and image sequences simultaneously. The agent takes the current interaction history as input and generates text tokens one by one through an autoregressive approach to form a text response, which contains at least one structured action. The system text parser parses the response, identifying the action type and action parameters. When the action generated by the agent is a first action, the system obtains the observation returned by the environment in response to the first action, which is a set of candidate images. The system appends this observation to the current interaction history in the form of a user role, forming a new interaction history, and then continues to the next iteration step. When the action generated by the agent is a second action, the system obtains the observation returned by the environment in response to the second action, which is a target image. The system appends this observation to the current interaction history in the form of a user role, forming a new interaction history, and then continues to the next iteration step. When the agent generates a third action, the system acquires the observation returned by the environment in response to this third action. This observation is a key information area, and the system appends this observation to the current interaction history in the form of a user role, forming a new interaction history, and then continues to the next iteration step. When the agent generates a terminating action, the system outputs the final answer, and the entire interaction process terminates.

[0021] In this embodiment, the continuous addition of interaction history enables the agent to perceive all its past decisions and their corresponding environmental feedback. In each iteration, the agent generates its current action based on a state input containing the complete interaction history; therefore, the agent's decision-making process is a sequential decision-making process with memory capabilities. The first, second, and third actions constitute a progressive chain from coarse-grained retrieval to fine-grained information extraction. The first action expands the candidate range to ensure recall; the second action performs precise semantic-level filtering based on the first action; and the third action performs fine-grained spatial-level localization based on the second action. These three actions are executed sequentially or the agent autonomously chooses to jump to them based on its current state. Through this sequential decision-making method, the retrieval scope gradually shrinks from a large-scale image corpus to at least a minimum number of precisely filtered images, and then further shrinks to key local regions within the images, achieving information extraction from coarse to fine.

[0022] The reinforcement learning-based document retrieval enhancement generation method provided in this application can achieve a progressive decision-making process from coarse-grained retrieval to fine-grained information extraction by incorporating retrieval, reordering, active visual perception and reasoning into a unified sequential decision-making framework. This is achieved by enabling the agent to autonomously generate hierarchical actions within the framework of thinking, action and observation. This reduces background noise introduced during the retrieval stage and avoids information redundancy caused by indiscriminate encoding of the entire image, thereby improving the quality of visual evidence.

[0023] In an optional embodiment of this application, obtaining a candidate image set from an image corpus includes: retrieving multiple candidate images from the image corpus according to the retrieval criteria, wherein the multiple candidate images constitute a candidate image set.

[0024] In this embodiment, the retrieval basis is the structured action parameters in the text response generated by the agent. After identifying the type of the first action, the system text parser further extracts action parameters from the text expression of the first action, which serve as the retrieval basis. This retrieval basis is a natural language query string, generated by the agent through an autoregressive approach based on the current interaction history, and its semantic content is related to the query information input by the user. The system uses the extracted retrieval basis as input parameters and calls an external retrieval engine to perform a retrieval operation in the image corpus. The external retrieval engine employs a retrieval algorithm based on multimodal vector similarity matching, calculating the similarity between the textual retrieval basis and the visual and textual feature vectors of each image in the image corpus. It returns a preset number of candidate images in descending order of similarity, forming a candidate image set. The similarity calculation uses cosine similarity or inner product similarity. The preset number K is a configurable hyperparameter.

[0025] In this embodiment, the external retrieval engine can also employ a text-to-text retrieval method. First, it extracts the text content of each image in the image corpus using optical character recognition technology, establishes a text index, and then performs keyword matching or semantic matching between the retrieval criteria and the extracted text content, returning the image with the highest matching degree as a candidate image. Both implementation methods can achieve the goal of quickly narrowing down the candidate range from a large-scale image corpus.

[0026] In this way, the first action, by performing a high-recall retrieval in a large-scale image corpus, provides initial candidate input for subsequent fine screening and focusing processes, ensuring that relevant information is not missed in the early stages.

[0027] In an optional embodiment of this application, the retrieval is based on a query statement wrapped with a preset first tag.

[0028] In this embodiment, the preset first tag is a pair of special marker symbols with semantic identification function. When the agent generates the first action, it uses the first tag to wrap the query statement as the retrieval basis in the autoregressive generated text response. The system text parser scans the entire text response generated by the agent, identifies the substring defined by the first tag, and extracts the query statement in the substring as the retrieval basis. The tag name of the first tag is set to "search", indicating that the content within the tag is a query string used for search operations. In alternative implementations, the first tag can also be other distinguishable strings, such as... <retrieval> and< / retrieval> or <query> and< / query> These alternative tags serve to define the scope of the query statements used for retrieval.

[0029] In this way, through the structured wrapping of the first tag, the first action generated by the agent has a clear and parsable format, ensuring that the retrieval basis can be accurately extracted and executed by the system, avoiding parsing failure or retrieval errors caused by the ambiguity of free text expression.

[0030] In an optional embodiment of this application, determining the target image that semantically matches the query information from the candidate image set includes: selecting at least one candidate image from the candidate image set as the target image based on image indication information.

[0031] In this embodiment, the image indication information is the action parameter provided by the agent in the textual expression of the second action. After identifying the type of the second action, the system text parser further extracts the image indication information from the textual expression of the second action. This image indication information is used to indicate which candidate images in the candidate image set are determined to be semantically matched with the query information. The candidate image set is a list containing K candidate images, each candidate image having a unique position number in the list. The image indication information is presented in the form of an index list, which contains one or more integer indices, each integer index corresponding to a position number in the candidate image set.

[0032] In this embodiment, the system copies the candidate image corresponding to the index from the candidate image set according to the image indication information, forming a new image list, which is the target image. The number of target images is less than or equal to the total number of candidate images in the candidate image set. This selection operation does not change the content and resolution of the selected image, but only reduces the number of images.

[0033] In this way, based on the coarse retrieval results, the second action uses the agent's deep understanding of the semantics of the query information to perform task-level screening of candidate images, eliminating noisy images that are similar to the retrieval criteria in shallow features but are irrelevant to the query information in terms of task semantics, thus providing high signal-to-noise ratio input for subsequent visual perception and reasoning generation.

[0034] In an optional embodiment of this application, the image indication information is an index wrapped with a preset second label, and the index is used to indicate the position of the candidate image in the candidate image set.

[0035] In this embodiment, the preset second label is a pair of special marker symbols with semantic identification function. When the agent generates the second action, it uses the second label to wrap the index sequence of image indication information in the autoregressive text response. The system text parser scans the entire text response generated by the agent, identifies the substring defined by the second label, and extracts the index sequence from the substring. The indices in the index sequence are separated by commas or spaces, and each index is an integer greater than or equal to 0, with a value range not exceeding the size of the candidate image set minus one. The label name of the second label is set to "select," indicating that the content within the label is a list of indices used for selection operations. In alternative implementations, the second label can also use other distinguishable strings, such as... <pick> and< / pick> or <choose> and< / choose> These alternative labels serve to define an index list used to indicate the selection of the target image.

[0036] In this way, through the structured wrapping of the second label, the second action generated by the agent has a clear and parsable index format, ensuring that the image indication information can be accurately extracted by the system and the filtering operation can be performed, thus realizing the agent's precise semantic control over the candidate image set.

[0037] In an optional embodiment of this application, extracting key information regions from a target image includes: determining a local region from the target image based on region positioning information; and cropping and enlarging the local region to obtain the key information regions.

[0038] In this embodiment, the region localization information is an action parameter provided by the agent in the textual expression of the third action. This parameter is used to define the spatial range of the local region to be extracted in the target image. When the second action filters out multiple target images, the agent performs the third action on each target image separately, or selects one of them to perform the third action. The region localization information is presented in the form of one or more bounding boxes, each bounding box being defined by a set of coordinate values. These coordinate values ​​are used to define a rectangular local region in the pixel space of the target image. After recognizing the type of the third action, the system text parser extracts the region localization information from the textual expression of the third action. The system calls the image processing tool to locate the corresponding rectangular region in the pixel space of the target image based on the coordinate values ​​in the region localization information. This rectangular region can be any position and any size in the target image, and its boundary is within the image size range.

[0039] In this embodiment, after localization, the system performs an image cropping operation, extracting pixel information within a rectangular region and discarding all pixel information outside the rectangular region. The cropped sub-image retains all pixel details within the original rectangular region, and its resolution is the same as that of the region in the original image. To further improve the visual clarity of the local region, the system performs adaptive magnification processing on the cropped sub-image, enlarging the pixel size of the sub-image to match the standard input size required by the agent's visual encoder. When the agent's visual encoder requires an input image size of 448×448 pixels and the cropped sub-image size is 224×224 pixels, the system enlarges the sub-image to 448×448 pixels using a bicubic interpolation algorithm. In alternative implementations, adaptive magnification processing can also employ nearest neighbor interpolation, bilinear interpolation, or deep learning-based super-resolution algorithms. These alternative algorithms ensure that the cropped local region meets the model input resolution requirements while retaining the original detail information.

[0040] In this way, the third action extracts key information regions in the target image through active positioning, cropping, and magnification, enabling the agent to perceive the fine visual content in the local area in a high-resolution form, thus avoiding the loss of details caused by indiscriminate encoding of the entire image.

[0041] In an optional embodiment of this application, the region positioning information is the coordinates of a bounding box wrapped with a preset third label, and the bounding box coordinates are used to define a local region in the pixel space of the target image.

[0042] In this embodiment, the preset third label is a pair of special marker symbols with semantic identification function. When the agent generates the third action, it uses the third label to wrap the bounding box coordinates of the region positioning information in the autoregressive text response. The system text parser scans the entire text response generated by the agent, identifies the substring defined by the third label, and extracts the coordinate values ​​of the quadruplet in the substring. These four coordinate values ​​are used to define a rectangular local region in the pixel space of the target image, where x1 and y1 represent the coordinates of the upper left corner of the rectangular region, and x2 and y2 represent the coordinates of the lower right corner of the rectangular region.

[0043] In this embodiment, the coordinate values ​​are normalized to continuous values ​​between 0 and 1, and their physical meaning is the ratio relative to the width and height of the target image. Coordinate x = 0.5 represents the midpoint position in the width direction of the target image, and coordinate y = 0.5 represents the midpoint position in the height direction of the target image. When the agent needs to crop the central region of the target image, bounding box coordinates are generated. <bbox> 0.25,0.25,0.75,0.75< / bbox> This region covers an area ranging from 25% to 75% in width and from 25% to 75% in height. The normalized coordinate representation allows the agent to reason and generate within a normalized coordinate space without needing to be aware of the specific pixel dimensions of the target image. After parsing and obtaining the normalized coordinates, the system maps the normalized coordinates to pixel coordinates based on the actual pixel width and height of the target image and performs a cropping operation. In an alternative implementation, the bounding box coordinates can also be in the form of absolute pixel values, meaning the coordinate values ​​represent the specific pixel positions in the target image.

[0044] In this way, through the structured wrapping of the third label, the third action generated by the agent has a clear and resolvable bounding box coordinate format, ensuring that the regional positioning information can be accurately extracted by the system and the cropping operation can be performed, thus realizing the agent's precise spatial positioning of local areas of the image.

[0045] In an optional embodiment of this application, generating the final answer based on query information and key information area includes: taking the key information area and query information as input, generating a text response through an autoregressive method, wherein the text response contains the final answer wrapped with a preset fourth tag.

[0046] In this embodiment, when the agent decides to terminate the interaction process and output the final answer, the agent generates a termination action. In the text response of this termination action, the agent uses the current interaction history and the most recently observed key information region as context input, and generates a natural language text token-by-token through the autoregressive generation capability of the large visual language model. This natural language text is the final answer to the user's query. To identify the final answer in this text, the agent wraps the content of the final answer in the text response using a preset fourth tag.

[0047] In this embodiment, the fourth tag is a pair of special marker symbols. The text appearing in the text response generated by the agent is in the form of " <answer> Final answer content< / answer> After the system text parser recognizes the termination action, it extracts the content defined by the fourth tag from the text response as the final answer and outputs this content to the user. In alternative implementations, the fourth tag can also be other distinctive strings, such as... <output> and< / output> or <response> and< / response> These alternative labels serve to define the textual scope of the final answer.

[0048] In this way, through the structured wrapping of the fourth label, the final answer generated by the agent has a clear and parsable output format, ensuring that the system can accurately extract the final answer from the agent's complete response and return it to the user, avoiding response failure due to unclear output content.

[0049] In an optional embodiment of this application, when the action is a first action, the observation is a set of candidate images; when the action is a second action, the observation is a target image; and when the action is a third action, the observation is a key information region.

[0050] In this embodiment, the observation returned by the environment in response to different actions has different data formats and content. For the first action, the observation is an image list containing multiple candidate images, each candidate image existing in the form of image data, and the image list is sorted from high to low according to retrieval relevance. For the second action, the observation is the target image retained after filtering, which comes from a subset of the candidate image set, and its data format is the same as the candidate images, but the number is reduced. For the third action, the observation is a high-resolution local image after cropping and magnification, which comes from a specific region in the target image, and its data format is a single image with adaptively adjusted resolution.

[0051] In this embodiment, the three types of observation correspond to three stages in the information extraction process: from an image list to a single image and then to a local area of ​​an image. The content of the observation gradually focuses, and the information density gradually increases. The observations are added to the interaction history in the form of user roles to maintain consistency with the dialogue format seen by the large visual language model during the pre-training stage.

[0052] In this way, different types of observations correspond one-to-one with different types of actions, enabling the agent to infer the effect of its previous action from the content of the observation, evaluate the correctness of its own decision, and provide a basis for generating the next action.

[0053] Based on the above-mentioned computer system structure, such as Figure 2 As shown in the embodiments of this application, another document retrieval enhancement generation method based on reinforcement learning is provided and applied to computer system execution, including: S01, obtain query information and initialize the interaction history, which contains query information.

[0054] S02, in each iteration step, based on the current interaction history, an action is generated and executed by the agent. The action is at least one of a first action, a second action, a third action, or a termination action. The first action is used to obtain a candidate image set from the image corpus, the second action is used to determine the target image that semantically matches the query information from the candidate image set, the third action is used to extract the key information region from the target image, and the termination action is used to generate the final answer based on the query information and the key information region.

[0055] S03, if the action is the first action, the second action, or the third action, then obtain the observation of the environment response to the action return, and append the observation to the interaction history. The observation corresponds to the type of the action, and continue to execute the iteration step.

[0056] S04. If the action is a termination action, then output the final answer.

[0057] S21, obtain the first reward value corresponding to the first action, the second reward value corresponding to the second action, and the third reward value corresponding to the third action.

[0058] S22, Obtain the pattern follow reward value, which is used to indicate the legality of the format of each action generated by the agent.

[0059] S23, obtain the result reward value corresponding to the termination action. The result reward value is used to indicate the quality of the final answer.

[0060] S24, update the agent based on the combination of the first reward value, the second reward value, the third reward value, the pattern following reward value, and the result reward value.

[0061] In this embodiment, the acquisition and update operations are performed during the reinforcement learning training phase, not the inference phase. During the training phase, the system calculates multiple sub-reward values ​​for the interaction trajectory generated by the agent, each sub-reward value corresponding to a decision-making step or an execution action in the trajectory. The first reward value quantifies the retrieval quality of the first action, i.e., assessing whether the retrieval criteria generated by the agent can recall images related to the query information from the image corpus. The second reward value quantifies the filtering accuracy of the second action, i.e., assessing whether the target image selected by the agent from the candidate image set semantically matches the query information. The third reward value quantifies the localization accuracy of the third action, i.e., assessing whether the bounding box coordinates generated by the agent cover the local area containing key information in the target image. The pattern follows the reward value to quantify the legality and parsability of the entire interaction trajectory generated by the agent in terms of format, checking whether the labels of all actions are correctly closed and whether the parameters are within the legal range. The result reward value quantifies the quality of the final answer generated by the agent in the termination action, i.e., assessing whether the final answer accurately answers the user query.

[0062] In this embodiment, the system calculates a total reward value based on the combination of the five sub-reward values, and updates the agent's model parameters using a reinforcement learning algorithm based on this total reward value. This combination result is obtained through weighted summation, where each sub-reward value is multiplied by its corresponding weight coefficient and then summed. The weight coefficient is a configurable hyperparameter, and different weight coefficients reflect the relative importance of different decision-making stages in the overall optimization objective. Through the combination of the five sub-reward values, the system's update signal covers the entire chain of agent decision-making, from action format compliance to retrieval quality, filtering quality, perception quality, and final answer quality, all of which are incorporated into the optimization objective.

[0063] The document retrieval enhancement generation method based on reinforcement learning provided in this application uses dense reward signals to enable the agent to obtain clear supervision for each intermediate decision step during reinforcement learning training, which solves the problem of unclear credit allocation under sparse rewards and enables the agent to continuously improve its strategic behavior in retrieval query generation, semantic filtering and regional localization.

[0064] In an optional embodiment of this application, the first reward value is used to quantify the retrieval quality of the candidate image set, the second reward value is used to quantify the matching accuracy of the target image, and the third reward value is used to quantify the positioning accuracy of the key information region; the combined result is a weighted sum of the first reward value, the second reward value, the third reward value, the pattern following reward value, and the result reward value.

[0065] In this embodiment, the first reward value is calculated based on the Normalized Decay Cumulative Gain Index (NDCI) in the information retrieval domain. The system merges the candidate image sets returned by all first actions performed by the agent throughout the interaction process into a unified sorted list using a round-priority alternating method. The round-priority alternating method means that the first image from the sorted results of all first actions is taken to form the first part of the list, then the second image from the sorted results of all first actions is taken to form the subsequent parts of the list, and so on. Based on a pre-labeled set of images truly relevant to the query information, the system calculates the Normalized Decay Cumulative Gain Score of this unified sorted list. The Normalized Decay Cumulative Gain Index ranges from 0 to 1; a higher score indicates higher retrieval sorting quality.

[0066] In this embodiment, the second reward value is calculated based on the matching relationship between the target image selected by the agent in the second action and the set of real related images. The third reward value is calculated based on the geometric overlap between the bounding box generated by the agent in the third action and the pre-labeled real key information region bounding box, specifically using the intersection-union ratio (IUGR) index. The IUGR value ranges from 0 to 1, with a higher score indicating a higher degree of overlap between the predicted bounding box and the real bounding box. The reward value follows a binary reward system: it is set to 1 when all action labels appear in pairs and are correctly nested, and all action parameters conform to the legal value range; otherwise, it is set to 0. The final reward value is calculated by an independent reward model, which takes the user query, the reference answer, and the final answer generated by the agent as input and outputs a score representing the accuracy of the final answer.

[0067] In this embodiment, the five sub-reward values ​​are multiplied by their respective weight coefficients and then summed to obtain the total reward value. The weight coefficients λ1 to λ5 are positive real numbers, and their specific values ​​are optimized based on the performance of the validation set before training begins.

[0068] In this way, the total reward value comprehensively reflects the overall performance of the agent when performing a complete visual question answering task. At the same time, the weighted combination of sub-reward values ​​retains the relative importance information of different decision-making links, so that the optimization objectives of each link can be incorporated into a unified training signal.

[0069] In an optional embodiment of this application, obtaining the second reward value includes: when the candidate image set contains images that are truly related to the query information, if the target image is an image that is truly related to the query information, then the second reward value is a first preset value; otherwise, it is a second preset value. When the candidate image set does not contain images that are truly related to the query information, if the target image is the first image in the candidate image set, then the second reward value is a first preset value; otherwise, it is a second preset value.

[0070] In this embodiment, the first preset value and the second preset value are pre-set values, with the first preset value being 1 and the second preset value being 0. When the candidate image set contains at least one image that is truly related to the query information, there is a clear criterion for judging the correctness of the selection. It is determined whether the target image selected by the agent through the second action belongs to the set of truly relevant images. If it does, it indicates that the agent has identified the correct image from the candidates containing relevant images, and a positive reward of the first preset value is given. If the selected target image does not belong to the set of truly relevant images, it indicates that the agent has judged an irrelevant image as relevant, and a second preset value is given.

[0071] In this embodiment, when the candidate image set does not contain any images truly related to the query information, no truly relevant images exist, and traditional binary judgment methods cannot provide discriminative supervisory signals. To address this issue, this embodiment sets the image ranked first in the candidate image set as a temporary pseudo-positive target. The image ranked first is determined by the external retrieval engine to be the most relevant image to the retrieval criteria. Although it does not semantically match the query information, it is a relatively optimal choice when all candidates are noise. In this case, if the target image selected by the agent is the image ranked first in the candidate image set, the second reward value is the first preset value; otherwise, it is the second preset value. In an alternative implementation, the pseudo-positive target ranked first can also be replaced by any one of the top two or top three images in the candidate image set.

[0072] In this way, the calculation of the second reward value can provide effective feedback to the agent in different situations, avoiding model training stagnation caused by the lack of supervision signals. Even in the difficult situation of zero answer candidate set, the agent can still receive effective navigation signals and learn to evaluate and distinguish the relative correlation between noisy images.

[0073] In an optional embodiment of this application, updating the agent includes: employing a group relative strategy optimization algorithm to calculate the intra-group advantage function based on the combination results of multiple interaction trajectories, and updating the agent's parameters based on the intra-group advantage function.

[0074] In this embodiment, the group relative policy optimization algorithm is a reinforcement learning algorithm that does not require an independent value network. In each training step, for the same user query, the system generates multiple independent complete interaction trajectories through parallel sampling using the current policy network, for example, generating five interaction trajectories. Each interaction trajectory contains a complete decision sequence from the initial state to the final action, as well as the total reward value of that trajectory calculated according to the aforementioned intensive reward mechanism. These multiple interaction trajectories form a trajectory group.

[0075] In this embodiment, within a trajectory group, the system calculates the relative merit of each trajectory's total reward value compared to the total reward values ​​of other trajectories in the group, i.e., it calculates the intra-group dominance function. The intra-group dominance function is calculated by normalizing the total reward values ​​of all trajectories in the group, or by calculating the difference between the total reward value of each trajectory and the average total reward value of the group, and then dividing by the standard deviation of the total reward values ​​within the group. After calculating the intra-group dominance function for each trajectory, the system updates the parameters of the current policy network based on this dominance function. The system calculates the policy gradient of the policy network on the trajectories in this group and uses the intra-group dominance function to weight the policy gradient, increasing the probability that trajectories with higher total reward values ​​will be sampled in the future, and decreasing the probability that trajectories with lower total reward values ​​will be sampled. This update process iterates through multiple training steps, sampling a new trajectory group and updating the policy network parameters once in each step, until the policy network converges.

[0076] In this way, through the intra-group comparison mechanism of the group relative policy optimization algorithm, the agent can be updated without the need for an additional value network, thereby improving training efficiency, enhancing training stability, and driving the policy to evolve in the direction of generating higher rewards and more accurate decisions.

[0077] In an optional embodiment of this application, the reinforcement learning-based document retrieval enhancement generation method further includes: acquiring training data, which includes multiple interaction trajectories, the interaction trajectories containing query information, action sequences generated by the agent, observation sequences returned by the environment, and the final answer; and using the training data to perform supervised fine-tuning of the agent.

[0078] In this embodiment, supervised fine-tuning is a cold-start phase preceding reinforcement learning training. During this phase, the system acquires a training dataset containing multiple high-quality interaction trajectories. Each interaction trajectory records the complete interaction process for a user query from start to finish, including the actions generated by the agent at each iteration step, the observations returned by the environment, and the final termination action and final answer. The action sequences in these interaction trajectories are decision sequences pre-generated by the teacher model, rather than sequences generated autonomously by the current policy network.

[0079] In this embodiment, the system employs a standard supervised learning approach, using the interaction trajectories in the training data as label data to update the parameters of the agent's large visual language model. For each iteration step in each interaction trajectory, the system takes the history up to the current step in the trajectory as input, the next action recorded in the trajectory as the prediction target, calculates the cross-entropy loss of the model-generated action, and updates the model parameters through the backpropagation algorithm. In an alternative implementation, supervised fine-tuning can employ a multi-task joint training approach, simultaneously optimizing both action format prediction and action content prediction tasks.

[0080] In this way, after supervised fine-tuning, the agent's action output conforms to the requirements of the system parser in terms of format and is reasonable in terms of content, avoiding the training collapse caused by starting from scratch in the reinforcement learning stage and accelerating the convergence speed of subsequent training.

[0081] In an optional embodiment of this application, the interaction trajectory is generated by: performing a first action, a second action, and a third action through a teacher model to generate candidate action trajectories; and performing quality filtering and difficulty screening on the candidate action trajectories to obtain the interaction trajectory.

[0082] In this embodiment, the teacher model is a high-performance large visual language model with a parameter size greater than or equal to that of the policy network, possessing stronger reasoning and visual understanding capabilities. The system inputs user queries into the teacher model and guides it to execute hierarchical actions within a thinking-action-observation framework. At each step, the teacher model generates actions based on the current interaction history; these actions include a first action, a second action, a third action, and a termination action. The teacher model's decision-making process is fully recorded, forming a candidate action trajectory. This trajectory includes query information, the action sequence generated by the teacher model, the observation sequence returned by the environment in response to each action, and the final answer generated by the teacher model.

[0083] In this embodiment, after generating a large number of candidate action trajectories, the system performs quality filtering and difficulty selection on these candidate trajectories. Quality filtering, based on the correctness of the final answer, retains only candidate trajectories with correct final answers to ensure the training data has positive supervisory value. Difficulty selection is based on the complexity of the actions performed in the trajectory, considering factors such as the number of iteration steps, the number of times the retrieved and selected actions are executed, and the accuracy of bounding box localization, to select challenging trajectories to be added to the final training dataset. The combination of quality filtering and difficulty selection ensures that the training dataset has both correct decision labels and sufficient diversity.

[0084] In this way, by automatically generating training data through the teacher model and filtering it by quality and difficulty, the efficiency of acquiring training data is significantly improved, the cost of manual annotation is greatly reduced, and the quality and diversity of training data are guaranteed.

[0085] In an optional embodiment of this application, the key information region corresponding to the third action is determined in the following way: using a document layout parsing tool to detect layout elements in the target image and generating at least one candidate bounding box; using a teacher model to select a bounding box that matches the query information from the at least one candidate bounding box as the annotation position of the key information region.

[0086] In this embodiment, the determination process is performed during the training data synthesis phase to provide ground truth annotations of bounding boxes for supervised fine-tuning of the third action and reinforcement learning training. When the teacher model decides to perform the third action on a target image, the system first preprocesses the target image using a document layout parsing tool. The document layout parsing tool uses the open-source Mineru tool, which can detect various layout elements in a document image, including text blocks, tables, charts, titles, and legends, and generate a bounding box for each detected layout element. The document layout parsing tool generates a set of candidate bounding boxes, each of which defines a potential region of interest in the image.

[0087] In this embodiment, the system provides the target image and the coordinate information of these candidate bounding boxes to the teacher model. Knowing the set of candidate bounding boxes, the teacher model selects one or more bounding boxes that best match the current query information from these candidate bounding boxes, without needing to generate bounding box coordinates from scratch. The selected bounding boxes are used as ground truth labels for the third action, i.e., the labeled positions of key information regions. In alternative implementations, the document layout parsing tool can also employ other optical character recognition or layout analysis tools, such as PaddleOCR or Tesseract combined with a layout analysis module. These alternative tools have the function of detecting layout elements in the image and generating corresponding bounding boxes.

[0088] In this way, by generating candidate bounding boxes through document layout parsing tools and then selecting matching bounding boxes from them by the teacher model, the accuracy and rationality of the annotation of the third action are improved, while reducing the difficulty for the teacher model to generate bounding boxes.

[0089] Combination Figure 3 As shown in the illustration, this application provides a reinforcement learning-based document retrieval enhancement generation device 800, including a processor 801 and a memory 802. Optionally, the device may further include a communication interface 803 and a bus 804. The processor 801, communication interface 803, and memory 802 can communicate with each other via the bus 804. The communication interface 803 can be used for information transmission. The processor 801 can call logical instructions in the memory 802 to execute the reinforcement learning-based document retrieval enhancement generation method described in the above embodiment.

[0090] Furthermore, the logic instructions in the aforementioned memory 802 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0091] The memory 802, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as the program instructions / modules corresponding to the methods in the embodiments of this application. The processor 801 executes functional applications and data processing by running the program instructions / modules stored in the memory 802, that is, it implements the document retrieval enhancement generation method based on reinforcement learning in the above embodiments.

[0092] The memory 802 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 802 may include high-speed random access memory and may also include non-volatile memory.

[0093] This application provides a computer-readable storage medium storing computer-executable instructions configured to execute the above-described reinforcement learning-based document retrieval enhancement generation method.

[0094] The technical solutions of this application embodiment can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this application embodiment. The aforementioned storage medium can be a non-transitory storage medium, including: USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, and other media capable of storing program code.

[0095] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A document retrieval enhancement generation method based on reinforcement learning, characterized in that, Applied to computer system execution, including: Retrieve query information and initialize the interaction history, which contains the query information; In each iteration step, based on the current interaction history, an action is generated and executed by the agent. The action is at least one of the first action, the second action, the third action, or the termination action. The first action is used to obtain a candidate image set from the image corpus, the second action is used to determine the target image that semantically matches the query information from the candidate image set, the third action is used to extract the key information region from the target image, and the termination action is used to generate the final answer based on the query information and the key information region. If the action is the first action, the second action, or the third action, then obtain the observation of the environment's response to the action, append the observation to the interaction history, the observation corresponds to the type of action, and continue to execute the iteration step; If the action is a termination action, then output the final answer.

2. The method according to claim 1, characterized in that, Obtaining candidate image sets from image corpora includes: Based on the retrieval criteria, multiple candidate images are retrieved from the image corpus, and these multiple candidate images constitute a candidate image set.

3. The method according to claim 1, characterized in that, The target images that semantically match the query information are determined from the candidate image set, including: Based on the image indication information, select at least one candidate image from the candidate image set as the target image.

4. The method according to claim 1, characterized in that, The key information regions extracted from the target image include: Based on the region positioning information, determine the local region from the target image; By cropping and enlarging a local area, the key information area can be obtained.

5. The method according to claim 1, characterized in that, The final answer is generated based on the query information and key information areas, including: The key information area and the query information are used as input, and a text response is generated through autoregression. The text response contains the final answer wrapped with a preset fourth tag.

6. The method according to claim 1, characterized in that, Also includes: Obtain the first reward value corresponding to the first action, the second reward value corresponding to the second action, and the third reward value corresponding to the third action; The acquisition pattern follows the reward value, which is used to indicate the legality of the format of each action generated by the agent; Obtain the result reward value corresponding to the termination action. The result reward value is used to indicate the quality of the final answer. The agent is updated based on the combination of the first reward value, the second reward value, the third reward value, the pattern following reward value, and the result reward value.

7. The method according to claim 1, characterized in that, Also includes: Acquire training data, which includes multiple interaction trajectories. These trajectories contain query information, action sequences generated by the agent, observation sequences returned by the environment, and the final answer. The agent is fine-tuned under supervision using training data.

8. A document retrieval enhancement generation device based on reinforcement learning, comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to execute, when running the program instructions, the document retrieval enhancement generation method based on reinforcement learning as described in any one of claims 1 to 7.

9. A computer system, characterized in that, include: The computer system itself; as well as, The document retrieval enhancement generation device based on reinforcement learning as described in claim 8 is installed on the computer system body.

10. A computer-readable storage medium storing program instructions, characterized in that, When the program instructions are executed, they cause the computer to perform the reinforcement learning-based document retrieval enhancement generation method as described in any one of claims 1 to 7.