Algorithm testing method and device, storage medium and electronic equipment
By performing interactive action trajectory prediction and multi-layer memory architecture reinforcement learning on the target platform using a target intelligent agent, the problem of low testing efficiency of existing algorithms is solved, enabling fast and low-cost policy algorithm evaluation and improving the accuracy and efficiency of testing.
Patent Information
- Application Number
- CN202611265083.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-27
AI Technical Summary
Existing algorithm testing methods are inefficient and fail to accurately reflect the true performance of strategy algorithms in recommendation systems, especially when data distribution is offset, offline metrics are prone to distortion.
The system predicts the interaction trajectory of the target agent on the target platform, generates the interaction trajectory, and tests the policy algorithm based on task indicator data. The system uses a multi-layer memory architecture and reinforcement learning to train the agent, thereby improving the accuracy and efficiency of the test.
It enables rapid and low-cost evaluation of policy algorithm performance without requiring significant online resource investment, thereby improving the efficiency and accuracy of algorithm testing.
Smart Images

Figure CN123178253A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to an algorithm testing method and apparatus, a storage medium, and an electronic device. Background Technology
[0002] In recommender systems, the quality of the strategy algorithm directly determines the user experience. However, traditional evaluation systems have limitations: online A / B testing, while realistic, is costly and time-consuming, while traditional offline evaluations are often based on static log data, making it difficult to accurately reflect the true performance of dynamic interaction strategies, especially when strategy changes cause data distribution shifts, offline metrics are prone to distortion. Existing algorithm testing methods mainly rely on the statistical characteristics of historical behavioral data or simplified simulation environments, which are insufficient to comprehensively reflect the true effectiveness of the strategy algorithm in recommendations.
[0003] There is currently no effective solution to the technical problem of low algorithm testing efficiency in the aforementioned related technologies. Summary of the Invention
[0004] This application provides an algorithm testing method and apparatus, a storage medium and an electronic device, to at least solve the technical problem of low algorithm testing efficiency in related technologies.
[0005] According to one aspect of the embodiments of this application, an algorithm testing method is provided, comprising: predicting the interaction action trajectory of a target product on a target platform by a target intelligent agent to obtain the interaction action trajectory; obtaining task indicator data corresponding to the target product based on the interaction action trajectory; and testing a target strategy algorithm based on the task indicator data to obtain a test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm.
[0006] Furthermore, the target agent is trained using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; training the initial agent to imitate behavior using the training sample set to obtain a pre-trained agent; and training the pre-trained agent to perform reinforcement learning using the training sample set to obtain the target agent.
[0007] Furthermore, the target agent is trained using the following steps: A training sample set is obtained, wherein the training sample set includes at least multiple real behavior trajectories, and each trajectory point in a real behavior trajectory includes at least: the current page element in the target platform and the real interaction action; Multiple rounds of sampling are performed on the target platform by the pre-trained agent to generate multiple predicted behavior trajectories, wherein each trajectory point in a predicted behavior trajectory includes at least: a page element, a predicted interaction action, and a predicted inference process; The target trajectory reward value is calculated based on the multiple predicted behavior trajectories and the real behavior trajectories; The pre-trained agent is trained using reinforcement learning based on the target trajectory reward value to obtain the target agent.
[0008] Furthermore, in the reinforcement learning training of the pre-trained agent using a training sample set, the method further includes: setting a multi-layer memory architecture in the pre-trained agent, wherein the multi-layer memory architecture includes at least: working memory, episodic memory, and preference memory; the working memory is used to record visual impression information corresponding to a preset number of browsing steps within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information; the episodic memory is used to record interaction event information during a session; and the preference memory is used to record preference information of the target object; and memory update operations are added to the action space of the pre-trained agent so that when the pre-trained agent generates a prediction interaction action on the target platform, it simultaneously outputs a memory update action, wherein the memory update action includes at least: episodic memory update action and preference memory update action.
[0009] Furthermore, multiple rounds of sampling are performed on the target platform by a pre-trained agent to generate multiple predicted behavior trajectories, including: for any round of sampling, obtaining the first page element corresponding to the first time step of the target platform, and obtaining the current state information from the multi-layer memory architecture of the pre-trained agent; performing action prediction based on the first page element and the current state information to obtain the predicted interaction action and the predicted reasoning process corresponding to the first time step; executing the predicted interaction action corresponding to the first time step on the target platform to obtain the second page element; repeatedly executing the step of obtaining the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met, and obtaining the predicted behavior trajectory of the current round based on the currently obtained predicted interaction action, predicted reasoning process and page element, wherein the multi-layer memory architecture is used to store the memory information of the target agent.
[0010] Furthermore, after predicting the action based on the first page element and the current state information, the method further includes: detecting whether there is a difference between the second page element and the first page element; if there is a difference between the second page element and the first page element, updating the second page element, the predicted interactive action corresponding to the first time step, and the predicted reasoning process corresponding to the first time step to the working memory of the multi-layer memory architecture.
[0011] Furthermore, after predicting actions based on the first page elements and the current state information, the method further includes: if a memory update action is output synchronously, if contextual memory information exists in the memory update action, then the contextual memory information is updated to the contextual memory of the multi-layer memory architecture; if preference memory information exists in the memory update action, then the preference memory information is updated to the preference memory of the multi-layer memory architecture.
[0012] Furthermore, the target trajectory reward value is calculated based on multiple predicted and actual behavior trajectories, including: for any predicted behavior trajectory, comparing the action distribution between the predicted and actual behavior trajectories to obtain an action distribution reward value; comparing the product types of the interactive products between the predicted and actual behavior trajectories to obtain a product alignment reward value; verifying the format specification of the predicted behavior trajectory and obtaining a format reward value based on the verification results; and obtaining the target trajectory reward value based on the action distribution reward value, product alignment reward value, and format reward value.
[0013] Furthermore, the action distribution between the predicted behavior trajectory and the actual behavior trajectory is compared to obtain the action distribution reward value, including: calculating the predicted action frequency corresponding to each of the multiple interaction action types in the predicted behavior trajectory; calculating the actual action frequency corresponding to each of the multiple interaction action types in the actual behavior trajectory; and calculating the action distribution reward value by combining the predicted action frequency and the actual action frequency.
[0014] Furthermore, the product types of the interactive products between the predicted behavioral trajectory and the actual behavioral trajectory are compared to obtain the product alignment reward value, including: determining the target class target tag corresponding to the interactive product in the predicted behavioral trajectory and the reference class target tag corresponding to the interactive product in the actual behavioral trajectory based on a preset hierarchical product category system; calculating the matching score for the target class target tag and the reference class target tag; and calculating the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0015] According to another aspect of the embodiments of this application, an algorithm testing device is also provided, comprising: a prediction unit, configured to predict the interactive action trajectory of a target product on a target platform through a target intelligent agent, and obtain an interactive action trajectory; a first acquisition unit, configured to acquire task indicator data corresponding to the target product based on the interactive action trajectory; and a testing unit, configured to test a target strategy algorithm based on the task indicator data and obtain a test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm.
[0016] Furthermore, the target agent is trained using the following apparatus: a second acquisition unit for acquiring a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and a real interactive action; a first training unit for training the initial agent to imitate behavior using the training sample set to obtain a pre-trained agent; and a second training unit for training the pre-trained agent to perform reinforcement learning using the training sample set to obtain the target agent.
[0017] Furthermore, the target agent is trained using the following apparatus: a third acquisition unit, used to acquire a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and a trajectory point in a real behavior trajectory includes at least: the current page element in the target platform and a real interactive action; a sampling unit, used to perform multiple rounds of sampling in the target platform through the pre-trained agent to generate multiple predicted behavior trajectories, wherein a trajectory point in a predicted behavior trajectory includes at least: a page element, a predicted interactive action, and a predicted inference process; a calculation unit, used to calculate the target trajectory reward value based on the multiple predicted behavior trajectories and real behavior trajectories; and a training unit, used to perform reinforcement learning training on the pre-trained agent based on the target trajectory reward value to obtain the target agent.
[0018] Furthermore, the device also includes: a setting unit, used to set a multi-layer memory architecture in the pre-trained agent during reinforcement learning training using a training sample set, wherein the multi-layer memory architecture includes at least: working memory, contextual memory, and preference memory, wherein the working memory is used to record visual impression information corresponding to a preset number of browsing steps within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information, the contextual memory is used to record interaction event information during a session, and the preference memory is used to record preference information of the target object; and an adding unit, used to add memory update operations to the action space of the pre-trained agent so that when the pre-trained agent generates prediction interaction actions on the target platform, it simultaneously outputs memory update actions, wherein the memory update actions include at least: contextual memory update actions and preference memory update actions.
[0019] Further, the sampling unit includes: an acquisition subunit, used for acquiring the first page element corresponding to the first time step of the target platform for any round of sampling, and acquiring the current state information from the multi-layer memory architecture of the pre-trained agent; a prediction subunit, used for action prediction based on the first page element and the current state information, to obtain the predicted interactive action and the predicted inference process corresponding to the first time step; an execution subunit, used for executing the predicted interactive action corresponding to the first time step in the target platform to obtain the second page element; and a first determination subunit, used for repeatedly executing the step of acquiring the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met, and obtaining the predicted behavior trajectory of the current round based on the currently obtained predicted interactive action, predicted inference process and page element, wherein the multi-layer memory architecture is used to store the memory information of the target agent.
[0020] Furthermore, the device also includes: a detection unit, used to detect whether there is a difference between the second page element and the first page element after performing action prediction based on the first page element and the current state information; and a first update unit, used to update the second page element, the predicted interactive action corresponding to the first time step, and the predicted reasoning process corresponding to the first time step to the working memory of the multi-layer memory architecture when there is a difference between the second page element and the first page element.
[0021] Furthermore, the device also includes: a second update unit, used to update the context memory information to the context memory of the multi-layer memory architecture if the memory update action synchronously outputs a memory update action after the action prediction is based on the first page element and the current state information; and a third update unit, used to update the preference memory information to the preference memory of the multi-layer memory architecture if the memory update action contains preference memory information.
[0022] Further, the calculation unit includes: a first comparison subunit, used to compare the action distribution between the predicted behavior trajectory and the actual behavior trajectory for any predicted behavior trajectory, and obtain an action distribution reward value; a second comparison subunit, used to compare the product type of the interactive product between the predicted behavior trajectory and the actual behavior trajectory, and obtain a product alignment reward value; a verification subunit, used to verify the format specification of the predicted behavior trajectory, and obtain a format reward value based on the verification result; and a second determination subunit, used to obtain a target trajectory reward value based on the action distribution reward value, the product alignment reward value, and the format reward value.
[0023] Furthermore, the first comparison subunit includes: a first calculation module, used to calculate the predicted action frequency corresponding to each of the multiple interactive action types in the predicted behavior trajectory; a second calculation module, used to calculate the actual action frequency corresponding to each of the multiple interactive action types in the actual behavior trajectory; and a third calculation module, used to calculate the predicted action frequency and the actual action frequency to obtain the action distribution reward value.
[0024] Furthermore, the second comparison subunit includes: a determination module, used to determine the target class target tag corresponding to the interactive product in the predicted behavior trajectory and the reference class target tag corresponding to the interactive product in the actual behavior trajectory based on a preset hierarchical product category system; a fourth calculation module, used to calculate the target class target tag and the reference class target tag to obtain a matching score; and a fifth calculation module, used to calculate the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0025] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, which includes a stored program, wherein the program controls the device where the storage medium is located to execute the above-described algorithm testing method when it is running.
[0026] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described algorithm testing method when it runs.
[0027] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program or instructions, which implement the above-described algorithm testing method when executed by a processor.
[0028] In this embodiment, the following steps are adopted: predicting the interaction trajectory of the target product on the target platform through the target intelligent agent to obtain the interaction trajectory; obtaining the task indicator data corresponding to the target product based on the interaction trajectory; testing the target strategy algorithm based on the task indicator data to obtain the test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm, which solves the technical problem of low algorithm testing efficiency in related technologies.
[0029] In this application, a target intelligent agent predicts the interaction trajectory of a target product on a target platform, obtaining the interaction trajectory. Based on this trajectory, task indicator data corresponding to the target product is acquired, and this data is used to test the target policy algorithm to obtain test results characterizing its policy performance. By using the interaction trajectory generated by the intelligent agent to simulate real-world interactions, time-consuming manual operations or long-term online experiments in related technologies are replaced. This allows for rapid and low-cost evaluation of the target policy algorithm's performance without requiring significant online resources, thereby improving the efficiency of algorithm testing. Attached Figure Description
[0030] 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:
[0031] Figure 1 This is a hardware structure block diagram of a computer terminal provided according to Embodiment 1 of this application;
[0032] Figure 2 This is a flowchart of the algorithm testing method provided in Embodiment 1 of this application;
[0033] Figure 3 This is a schematic diagram of the algorithm testing method provided in Embodiment 1 of this application;
[0034] Figure 4 This is a schematic diagram of the algorithm testing device provided according to Embodiment 2 of this application;
[0035] Figure 5 This is a structural block diagram of an electronic device provided according to Embodiment 3 of this application. Detailed Implementation
[0036] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0037] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0038] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0039] Example 1
[0040] According to an embodiment of this application, an algorithm testing method is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0041] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing an algorithm testing method is shown. Figure 1 As shown, the computer terminal (or mobile device) 10 may include a processor set 102 (the processor set 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, and the processor set 102 may include multiple processors). Figure 1The data is illustrated using 102a, 102b, ..., 102n. A memory 104 is used for storing data, and a transmission device 106 is used for communication functions. In addition, it may include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0042] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0043] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the algorithm testing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned algorithm testing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0044] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0045] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0046] Under the aforementioned operating environment, this application provides the following: Figure 2 The algorithm testing method is shown. Figure 2 This is a flowchart of an algorithm testing method according to Embodiment 1 of this application. The algorithm testing method includes:
[0047] Step S201: The target intelligent agent predicts the interaction trajectory of the target product on the target platform to obtain the interaction trajectory.
[0048] Optionally, the target agent generates simulated user interaction action trajectories on the target platform. For example, the target agent acquires visual observation information corresponding to the current page elements on the target platform, and then predicts the interaction action at the current time step. In the e-commerce field, the aforementioned interaction actions may include one or more types such as page browsing, product clicking, adding to cart, or purchasing. In the short video field, the aforementioned interaction actions may include one or more types such as browsing videos, liking, commenting, sharing, or following creators. In the social network field, the aforementioned interaction actions may include one or more types such as posting updates, viewing friend lists, sending messages, or liking and commenting.
[0049] After executing the predicted interactive action, the target agent obtains the page element or state information for the next time step from the target platform, and continues to predict the interactive actions for subsequent time steps based on this information until the session termination condition is met. Arranging these interactive actions in chronological order yields the interactive action trajectory. This trajectory reflects the entire process of the target agent browsing and making decisions about the target product under the guidance of user preferences.
[0050] In some embodiments, the target agent can be a user-simulated agent based on a GUI (Graphical User Interface, a computer user interface that uses a graphical display. A GUI allows users to interact with visual elements such as icons, menus, windows, and buttons on the screen using input devices such as a mouse and touchpad). The target platform refers to a GUI-based interactive platform where the target agent interacts with the environment by performing actions such as clicking, scrolling, and purchasing, receives page screenshots as visual feedback, and updates its state based on the actions. This supports online multi-round agent reinforcement learning and visual feedback simulation processes.
[0051] In some embodiments, the target agent may consist of one or more neural networks built on a large language model. These neural networks may include a basic inference network, a visual perception network, and a policy optimization network, which generate simulated user interaction trajectories on the target platform.
[0052] It should be noted that the target product refers to various products or services browsed, compared, added to cart, or purchased by users on the target platform. The target product can be physical goods, virtual services, or digital content. For example, in e-commerce scenarios, the target product can be physical goods such as clothing, electronic products, and household goods, or virtual benefits such as membership subscription services; in content platform scenarios, the target product can be specific video content, articles, live streams, or audio programs. By predicting and generating interactive action trajectories for the above-mentioned different types of target products, this application can be applied to various Internet application scenarios, thereby enabling extensive testing and evaluation of strategy algorithms in different domains.
[0053] Step S202: Based on the interaction action trajectory, obtain the task indicator data corresponding to the target product.
[0054] Optionally, the interactive action trajectories generated by the target intelligent agent are parsed and analyzed to extract behavioral features related to the target product, and relevant task indicator data are calculated accordingly.
[0055] For example, the interaction type can be identified and statistically analyzed for a specific time step within the interaction trajectory. All action records in the trajectory are traversed, and the frequency of target product-related actions (such as clicking, browsing details pages, adding to cart, adding to favorites, and purchasing) is counted. For instance, the number of clicks, visits to details pages, and purchases related to the target product can be counted. Based on the statistical results, corresponding task metrics for the target product can be calculated, such as click-through rate, favorites rate, and purchase rate.
[0056] Step S203: Test the target policy algorithm based on task indicator data and obtain test results, wherein the test results are used to characterize the policy performance of the target policy algorithm.
[0057] Optionally, the target strategy algorithm can be tested based on task metric data. It should be noted that the target strategy algorithm is a task algorithm deployed on the target platform, such as a product recommendation algorithm that determines which products to show to the user, or a product layout algorithm that determines the position, order, and style of products displayed on a page. The interactive action trajectory generated by the target agent reflects the actual reactions that users might produce under the guidance of the output of the target strategy algorithm. Therefore, the target strategy algorithm can be tested based on task metric data.
[0058] For example, the effectiveness of the target strategy algorithm's recommendation or layout can be determined by calculating the task metric data (such as click-through rate and add-to-cart rate for the target product).
[0059] In this way, without the need for online A / B testing, the interaction trajectories generated by the target agent can be used to quickly and cost-effectively detect and rank various existing target strategy algorithms in the target platform, and select the best algorithm solutions.
[0060] In summary, by predicting the interaction trajectory of a target product on a target platform using a target intelligent agent, the interaction trajectory is obtained. Then, based on this trajectory, corresponding task indicator data for the target product is acquired. This task indicator data is then used to test the target policy algorithm to obtain test results characterizing its policy performance. By using the interaction trajectory generated by the intelligent agent to simulate real-world interactions, time-consuming manual operations or long-term online experiments in related technologies are replaced. This allows for rapid and low-cost evaluation of the target policy algorithm's performance without investing significant online resources, thereby improving the efficiency of algorithm testing.
[0061] To improve the performance of the target agent, in the algorithm testing method provided in Embodiment 1 of this application, the target agent is trained using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; performing imitation behavior training on the initial agent using the training sample set to obtain a pre-trained agent; and performing reinforcement learning training on the pre-trained agent using the training sample set to obtain the target agent.
[0062] Optionally, in order to improve the accuracy of the target agent in simulating real interactive actions, the training process of the target agent is divided into imitation learning warm-up and reinforcement learning optimization.
[0063] First, obtain a training sample set containing historical real-world interaction records. The training sample set includes multiple real-world behavior trajectories. A real-world behavior trajectory consists of trajectory points arranged in chronological order. Each trajectory point includes visual observation data of the current page on the target platform, such as a page screenshot or DOM structure information, as well as the corresponding real-world user interaction action, such as clicking, swiping, adding to cart, or purchasing.
[0064] For example, the actual behavioral trajectory is }, where T is the total time step of the session. For each time step t in the trajectory (1≤t≤T). This represents the state and action pair at time step t. This represents the visual observation of the target platform's page at time step t, such as a screenshot or structured interface data. This represents the interactive actions performed by a real user at that time step, such as clicking, swiping, adding to cart, or making a purchase.
[0065] In the imitation learning warm-up phase, supervised learning training is performed on the initial agent using a training sample set to obtain a pre-trained agent. It should be noted that the input to the initial agent is visual observations of the page and historical context, and the output is the probability distribution of the next interactive action. During training, the cross-entropy loss between the agent's predicted actions and real user actions in the samples can be minimized, allowing the initial agent to gradually master the basic ability to perform reasonable interactive actions under a specific page layout. After several iterations, the initial agent converges to the pre-trained agent.
[0066] For example, given the observations and historical context, maximize the log-likelihood of real user actions:
[0067]
[0068] in, This represents the historical context information up to time step t, including the observation sequence and action sequence of previous time steps. This represents the policy model in the agent, parameterized by parameter θ, used to adjust based on the current observations. and historical context Predict the next move The loss function minimizes the difference between the predicted distribution and the actual actions, enabling the agent to learn the interaction patterns of real users.
[0069] Finally, the pre-trained agent is trained using reinforcement learning to obtain the target agent. For example, during training, the pre-trained agent generates multiple sampling trajectories based on page observations. For each generated trajectory, a trajectory-level reward signal is calculated. The parameters of the pre-trained agent are then updated based on the reward signal using a policy gradient algorithm (such as group relative policy optimization).
[0070] For example, given page observations, output a set of G responses. Through reward function The strength estimation formula is as follows: (The formula is then used to estimate the advantage.)
[0071]
[0072] Where mean represents the arithmetic mean, used to eliminate the effects of scaling and determine a relative benchmark, and std represents the standard deviation, used to normalize the odds values to stabilize the training process and reflect the superiority or inferiority of each response relative to the group average. Indicates the reward score. This represents the advantage estimate, used in policy updates to indicate whether the response is better or worse than the group average, thus guiding the direction of policy parameter optimization.
[0073] The strategy updates the objective function by truncating the proxy and incorporating a KL divergence regularization term:
[0074]
[0075] in, This represents the policy probability ratio for the i-th sampled trajectory, i.e., the current policy. Reference Strategy The ratio of the probability of an action on that trajectory. This indicates a truncation operation, which will... Limited to the range [Within] to prevent excessively large policy updates; This represents the truncation hyperparameter, used to control the tolerance range of policy updates; This represents the KL divergence regularization coefficient, used to balance the differences between the policy update and the reference policy; Indicates the current strategy Reference Strategy The KL divergence between the two policies is used to constrain the new policy from deviating too far from the reference policy, thus maintaining the stability and diversity of the generated policies.
[0076] By introducing a warm-up phase of imitation learning, the difference between the predicted distribution and real user actions is minimized using a strategy that minimizes cross-entropy loss. This allows the initial agent to initially grasp the basic interaction capabilities under a specific page layout, providing stable parameter initialization for subsequent optimization. Then, through a reinforcement learning phase, the relative policy optimization algorithm based on groups is used, combined with the advantage estimation formula, to evaluate the relative merits of the sampled trajectories. Furthermore, a truncated agent objective function and a KL divergence regularization term are used to limit the policy update magnitude, thereby improving the realism of the simulation and the accuracy of the algorithm test.
[0077] To improve the performance of the target agent, the algorithm testing method provided in Embodiment 1 of this application trains the target agent using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and a trajectory point in a real behavior trajectory includes at least: the current page element in the target platform and a real interaction action; performing multiple rounds of sampling on the target platform through a pre-trained agent to generate multiple predicted behavior trajectories, wherein a trajectory point in a predicted behavior trajectory includes at least: a page element, a predicted interaction action, and a predicted inference process; calculating the target trajectory reward value based on the multiple predicted behavior trajectories and real behavior trajectories; and performing reinforcement learning training on the pre-trained agent based on the target trajectory reward value to obtain the target agent.
[0078] Optionally, a training sample set and a pre-trained agent are obtained. The training sample set includes multiple real-world behavioral trajectories. A real-world behavioral trajectory consists of trajectory points arranged in chronological order. Each trajectory point includes visual observation data of the current page on the target platform, such as a page screenshot or DOM structure information, as well as the corresponding real-world user interaction actions, such as clicking, swiping, adding to cart, or purchasing.
[0079] For example, the actual behavioral trajectory is }, where T is the total time step of the session. For each time step t in the trajectory (1≤t≤T). This represents the state and action pair at time step t. This represents the visual observation of the target platform's page at time step t, such as a screenshot or structured interface data. This represents the interactive actions performed by a real user at that time step, such as clicking, swiping, adding to cart, or making a purchase.
[0080] The pre-trained agent can be a model that has already been trained through supervised training in the imitation learning phase. In the imitation learning phase, the initial agent is trained using a training sample set. By minimizing the cross-entropy loss between the agent's predicted actions and real user actions (or maximizing the log-likelihood of real user actions), the agent learns to output actions consistent with real data with a high probability, given visual observations of the page and historical context.
[0081] Then, the pre-trained agent performs multiple rounds of sampling in the interactive environment of the target platform. For example, based on the current visual observation of the page and the historical context, the pre-trained agent sequentially generates the prediction reasoning process and predicts the interaction actions for the corresponding time steps.
[0082] In some embodiments, the pre-trained agent generates a predictive inference process based on the current page elements, explaining its understanding of the page layout, recommended product attributes, and potential user intent. Based on this inference process and the predicted user intent, it generates corresponding predicted interactive actions, such as clicking, swiping, adding to cart, or purchasing. Based on the predicted interactive actions and environmental feedback, it updates the state of the new page elements at the current time step. By repeating the above process, the pre-trained agent can generate multiple predicted behavioral trajectories, including page elements, predicted interactive actions, and predictive inference processes.
[0083] The simulation fidelity is quantified by comparing and analyzing multiple predicted behavioral trajectories generated by the pre-trained agent with the real behavioral trajectories in the training sample set. This involves calculating rewards based on both the predicted and real behavioral trajectories.
[0084] In some embodiments, the reward value of the target trajectory can be quantified based on the similarity between the predicted and actual behavior trajectories in the intent evolution trajectory. First, using a pre-trained agent or a separate intent extraction model, the intent state is encoded for each time step in both the predicted and actual behavior trajectories. For the actual behavior trajectory, the user's potential shopping intent state at each time step is inferred based on page observations and actual interaction actions, resulting in the actual intent evolution path. Similarly, for the predicted behavior trajectory generated by the pre-trained agent, the predicted intent state at each step is inferred based on its generated predictive inference process and predicted interaction actions, resulting in the predicted intent evolution path. Finally, the reward value of the target trajectory is obtained based on the similarity between the actual and predicted intent evolution paths.
[0085] After obtaining the target trajectory reward values for a set of predicted behavioral trajectories, an advantage estimation method from the group relative policy optimization algorithm is employed to reduce variance and improve training stability. The mean and standard deviation of the target trajectory reward values for all predicted behavioral trajectories within the group are calculated to obtain the relative advantage value of that trajectory. Based on the calculated relative advantage value, a truncated surrogate objective function incorporating a KL divergence regularization term is constructed for policy optimization. Truncate the proxy target function It comprises two main parts: first, a probability ratio term, which measures the proportion of probability change in generating a specific action sequence relative to the old policy; and second, an advantage value weighting term, which adjusts the gradient direction of policy updates based on the relative advantage value, i.e., encouraging an increase in the probability of high-advantage trajectories and a decrease in the probability of low-advantage trajectories. To prevent performance crashes caused by excessively large policy updates, a truncation mechanism is introduced to limit the probability ratio to a small range. Simultaneously, a KL divergence regularization term is introduced to constrain the difference between the new policy and the reference policy (usually the pre-trained agent or the policy from the previous round), ensuring that policy updates do not deviate too far from the initial behavioral pattern. This maintains the diversity of simulated behaviors while gradually guiding the pre-trained agent to learn policies that more closely resemble real user behavior, resulting in a target agent with superior performance.
[0086] By using the target trajectory reward value calculated from the predicted behavior trajectory and the actual behavior trajectory to perform reinforcement learning training on the pre-trained agent, it is possible to guide the agent to focus not only on matching a single action when generating predicted interactive actions, but also on the coherence of the behavior trajectory, so that the generated predicted behavior trajectory is closer to the actual interactive action, thereby improving the simulation performance of the target agent.
[0087] To avoid the forgetting problem of the agent, in the algorithm testing method provided in Embodiment 1 of this application, during the reinforcement learning training of the pre-trained agent using a training sample set, the method further includes: setting a multi-layer memory architecture in the pre-trained agent, wherein the multi-layer memory architecture includes at least: working memory, episodic memory, and preference memory. The working memory is used to record visual impression information corresponding to a preset number of browsing steps within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information, the episodic memory is used to record interaction event information during a session, and the preference memory is used to record the preference information of the target object; adding a memory update operation to the action space of the pre-trained agent, so that when the pre-trained agent generates a prediction interaction action in the target platform, it simultaneously outputs a memory update action, wherein the memory update action includes at least: an episodic memory update action and a preference memory update action.
[0088] Optionally, during the training process of the pre-trained agent, a multi-layered memory architecture is introduced to maintain the coherence of information in long-term interactions. First, a multi-layered memory architecture is set up for the pre-trained agent, which includes at least: working memory, episodic memory, and preference memory.
[0089] Working memory is used to record visual impression information corresponding to a preset number of browsing steps within a preset time window, as well as the predictive reasoning process and predictive interaction actions corresponding to the visual impression information. In some embodiments, working memory simulates a visual spatial canvas by maintaining a limited-capacity first-in-first-out (FIFO) record that stores information from the most recent K browsing steps:
[0090]
[0091] in, This represents the visual impression information retained from the viewport in step t; This represents the predictive reasoning process corresponding to visual impression information (e.g., which items attracted attention, which attributes were being compared, and what concerns drove the next action). This indicates the predicted interaction action. When a new browsing step occurs, the working memory uses a first-in, first-out (FIFO) mechanism, deleting earlier records and adding the latest one. This ensures that the agent always makes decisions based on a limited recent context, avoiding context window overflow caused by the accumulation of historical data.
[0092] Episodic memory is used to record interactive events during a conversation. For example, episodic memory can record key interactive events that occur during a conversation in structured or textual form, such as product clicks, browsing of product detail pages, or adding items to the cart.
[0093] Preference memory is used to record preference information of a target audience. For example, preference memory can be used to store a user's intent and long-term preferences, such as brand preference, price sensitivity, or style preference.
[0094] Adding memory update operations to the action space of a pre-trained agent allows it to output not only predicted interactive actions but also contextual and preference memory update actions. During reinforcement learning training, the pre-trained agent can generate memory update actions in addition to outputting predicted interactive actions for the current page. Memory update actions can consist of two parts: a decision signal to determine whether to store the information of the current step into the corresponding memory space (e.g., contextual and preference memories); and a content signal, which is the information that needs to be stored in the multi-layered memory architecture.
[0095] The multi-layered memory architecture enables agents to distinguish between short-term visual context, long-term behavioral trajectories, and user preferences, thereby managing and utilizing historical information more effectively in long-term simulations, mitigating the forgetting problem caused by context window limitations, and improving the consistency and coherence of simulated behavior.
[0096] During the reinforcement learning training phase, a pre-trained agent performs multiple rounds of sampling on the target platform to generate multiple predicted behavior trajectories. This includes: for any round of sampling, obtaining the first page element corresponding to the first time step of the target platform and obtaining the current state information from the multi-layer memory architecture of the pre-trained agent; performing action prediction based on the first page element and the current state information to obtain the predicted interaction action and the predicted inference process corresponding to the first time step; executing the predicted interaction action corresponding to the first time step on the target platform to obtain the second page element; and repeatedly executing the step of obtaining the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met. Based on the currently obtained predicted interaction action, the predicted inference process, and the page element, the predicted behavior trajectory of the current round is obtained. The multi-layer memory architecture is used to store the memory information of the target agent.
[0097] Optionally, during the reinforcement learning training phase, the pre-trained agent performs multiple rounds of sampling on the target platform to generate predicted behavioral trajectories.
[0098] First, the first page element corresponding to the first time step is obtained from the target platform. This page element represents the visual observation data of the current page, such as a screenshot or structured interface information. Simultaneously, the current state information is read from the multi-layered memory architecture of the pre-trained agent. This current state information can include recent browsing history in working memory, historical interaction event summaries in episodic memory, and user preference descriptions in preference memory. It should be noted that in the initial stage, working memory, episodic memory, and preference memory can be empty.
[0099] In some embodiments, user historical behavior data can be input as prompts in the initial stage to compensate for information gaps when the memory architecture is empty. For example, static profile information of the target user and recent interaction history recorded in offline logs can be obtained in advance. At the beginning of the first round of sampling in reinforcement learning training, this structured or textual historical preference information is input into the pre-trained agent as system prompts or pre-context.
[0100] Then, based on the elements of the first page and the current state information, action prediction is performed to obtain the predicted interaction action and the prediction reasoning process corresponding to the first time step. The pre-trained agent fuses the visual features of the elements of the first page with the current state information, which includes user historical preference cues, working memory, and episodic memory. It focuses on key visual elements on the page related to the user's historical preferences through an attention mechanism, such as specific product categories or product tags that match the user's preferences. Based on the fused features, the policy network of the pre-trained agent outputs the probability distribution of the predicted interaction action, sampling specific actions such as "clicking a product" or "swiping up." Simultaneously, it generates the corresponding prediction reasoning process, such as "The user frequently buys these types of athletic shoes in the past; the current page displays options that match their price range, so click to view details."
[0101] Then, the predicted interaction action corresponding to the first time step is executed on the target platform to obtain the second page element. For example, the pre-trained agent executes a predicted interaction action on the target platform, the target platform simulates the execution of the action and returns the page state after execution, i.e., the second page element. For example, if the action is clicking on a product, the second page element is a screenshot of the product's details page.
[0102] Then, the process of retrieving the current state information for the next time step from the multi-layered memory architecture of the pre-trained agent is repeated until a preset time step is reached or the session termination condition is met. If the session has not terminated, the second page element is used as new input, and combined with the updated memory state (e.g., working memory shift update, new event added to episodic memory, new addition to preference memory) to construct the current state information for the next time step. The pre-trained agent then predicts and executes actions for the next time step based on the new state information.
[0103] Finally, based on the currently obtained predicted interaction actions, predicted inference processes, and page elements, the predicted behavior trajectory for the current round is obtained. Sampling stops when a preset time step is reached or when the session termination condition is met (such as performing a purchase action or timeout). The predicted interaction actions, predicted inference processes, memory update actions, and corresponding page elements for all time steps in this round are combined in chronological order to generate a complete predicted behavior trajectory.
[0104] In some embodiments, predicted interactive actions may be unexecutable in the current interface context. For example, predicted interactive actions generated by a pre-trained agent might include clicking on a non-existent element on the page, performing operations in a non-interactive area, or performing unreasonable operations in a specific page state (such as clicking on a page that has not yet finished loading). If a predicted interactive action is unexecutable in the current interface context, the current session can be terminated directly, or the prediction at the current time step can be repeated. That is, the agent self-corrects and re-predicts the action based on the same current state information (i.e., unchanged page elements and updated memory state). The agent generates a new predicted interactive action, and if the new predicted action is also unexecutable, the prediction at the current time step is repeated again. To prevent invalid loops, a retry threshold can be set. If multiple consecutive predicted interactive actions are unexecutable, the session termination condition is triggered. This approach allows the agent to self-correct when encountering unexecutable actions, simulating the retry behavior of real users when encountering interface anomalies, thereby enhancing the robustness of the simulation.
[0105] By combining visual page observations with multi-level memory states for action prediction, the agent can maintain the coherence of behavioral logic and the consistency of intent in long-term interactions, thereby generating predictive behavioral trajectories that are closer to the dynamic browsing behavior of real users.
[0106] To avoid unnecessary memory updates, in the algorithm testing method provided in Embodiment 1 of this application, after predicting the action based on the first page element and the current state information, the method further includes: detecting whether there is a difference between the second page element and the first page element; if there is a difference between the second page element and the first page element, updating the second page element, the predicted interactive action corresponding to the first time step, and the predicted inference process corresponding to the first time step to the working memory of the multi-layer memory architecture.
[0107] Optionally, after predicting actions based on the first page elements and current state information, the following steps are performed to optimize the memory update mechanism:
[0108] First, visual difference detection is performed on the second page element returned by the target platform and the first page element from the previous time step. For example, by comparing the image features or structured layout information of the two page elements, it is determined whether the page content has undergone substantial changes. For instance, if the predicted interaction action is clicking a product link, and the second page element is a product details page, which is significantly different from the first page element in the list page format, then a difference is determined to exist; if the predicted interaction action is only page scrolling, and the scrolling range is small so that the core content area of the page does not change significantly, or the page is in a loading waiting state and no new content is returned, then no difference is determined or the difference does not reach the update threshold.
[0109] Secondly, a memory update operation is performed based on the difference detection results. When there are differences between the second page element and the first page element, the second page element, the predicted interaction action corresponding to the first time step, and the predicted inference process corresponding to the first time step are treated as a unit and written into the working memory of the pre-trained agent's multi-layered memory architecture. The working memory can use a first-in, first-out (FIFO) queue structure to maintain the recent browsing context. New page element features, action types, and inference text are stored in the latest position of the queue. If the working memory capacity reaches a preset limit, the oldest record in the queue is removed to ensure that the working memory always retains valuable interaction fragments.
[0110] For example, if the predicted interaction is effective and results in a page state transition, such as moving from a search results page to a product details page, the working memory will be updated to include a screenshot of the new page, the click action, and the inferred description of "the user viewing product details." This difference-based update mechanism avoids repeatedly storing redundant information when the page has not undergone substantial changes (such as repeatedly swiping the same list page), thereby conserving memory storage resources and maintaining the compactness of the working memory. This allows the agent to more effectively utilize limited memory capacity to focus on key state change nodes.
[0111] Furthermore, if there are no differences between the elements on the second page and the elements on the first page, the working memory is not updated, reducing unnecessary memory usage and computational overhead. This ensures that the multi-layer memory architecture can focus on capturing semantically important interactive events, providing a clearer and denoised state reference for subsequent time step predictions.
[0112] By introducing a page visual difference detection mechanism, the working memory is updated only when there are substantial changes in the page content. This on-demand update strategy can effectively avoid redundant records in scenarios where there are no substantial state changes, such as page scrolling or loading. This reduces the resource consumption of memory storage and improves the compactness of the working memory, allowing the agent to focus more on key state change nodes and provide a clearer and denoised recent browsing context reference for subsequent action prediction.
[0113] To improve the effectiveness of contextual memory and preference memory, in the algorithm testing method provided in Embodiment 1 of this application, after predicting actions based on the first page element and the current state information, the method further includes: if a memory update action is output synchronously, if contextual memory information exists in the memory update action, then the contextual memory information is updated to the contextual memory of the multi-layer memory architecture; if preference memory information exists in the memory update action, then the preference memory information is updated to the preference memory of the multi-layer memory architecture.
[0114] After predicting actions based on the elements of the first page and the current state information, the memory update module of the pre-trained agent synchronously outputs action instructions containing update decisions. These instructions explicitly indicate whether to write new information into episodic memory or preferred memory, along with the specific text content.
[0115] First, regarding contextual memory When the pre-trained agent outputs an action command indicating that the context memory needs to be updated, it retrieves the context memory information and appends it as a new interaction event summary to the context memory sequence in the multi-layer memory architecture.
[0116] In some embodiments, ,in, This represents the set of contextual memories updated at time step t. It consists of the contextual memories from the previous time step. New memory entries generated at the current time step It is a combination of data, used to accumulate interactive event records in a session. This represents the episodic memory update operator or function. This function is derived from the policy model of the pre-trained agent, taking the current observation, working memory, and historical episodic memory as input, and outputting the episodic memory update for the current time step. The parameter θ represents the trainable weights in this function, which are optimized through reinforcement learning to determine when and what to remember. This represents the working memory state at the end of time step t-1.
[0117] The pre-trained agent is based on current observations Working memory and existing contextual memories Through function Generate new memory fragments And add it to historical memory, thus forming a renewed contextual memory. .
[0118] Then, for preference memory When the pre-trained agent outputs an action command indicating that the preference memory needs to be updated, it obtains the preference memory information and updates the preference memory sequence in the multi-layer memory architecture.
[0119] In some embodiments, ,in, This represents the preference memory state after the update at time step t. This represents the preference memory update operator or function. This function is derived from the policy model of the pre-trained agent and is used to generate or update preference descriptions based on current observations, historical contextual memories, and existing preferences. The parameter θ represents the trainable weights in this function, which are optimized through reinforcement learning, enabling the agent to adaptively learn when to revise preferences and what to revise them to.
[0120] In some embodiments, the pre-trained agent's acquisition of memory update capabilities can be achieved through large language model distillation learning. For example, firstly, a large language model with reasoning and summarization capabilities is used as the teacher model to simulate reasoning on browsing trajectory data. The teacher model generates contextual memory text summaries and preference memory extraction results based on current page observations, working memory, and historical memory, and determines whether to update them. Then, the generated memory update decisions, contextual memory content, and preference memory content are used as training targets to train the memory update operator in the pre-trained agent. and Supervised fine-tuning or distillation training is performed. The pre-trained agent, acting as a student model, learns and imitates the decision-making logic and content generation capabilities of the teacher model, thereby acquiring the ability to autonomously determine when and what to memorize. In this way, the pre-trained agent can internalize complex memory management strategies without relying on manual rules, improving the accuracy and effectiveness of episodic and preference-based memory generation, and ultimately enhancing the coherence and intentionality of the overall simulated behavior in long-term interactions. Figure 1 To the point of being responsive.
[0121] Through a conditional update mechanism based on memory update actions, the agent can autonomously determine and add interactive event summaries to the episodic memory or update high-level intentions to the preference memory only when needed. This on-demand writing helps avoid the redundant accumulation of irrelevant information, thereby improving the reference effectiveness and conversational coherence of the two types of memory in subsequent decisions.
[0122] To improve the accuracy of trajectory reward calculation, the algorithm testing method provided in Embodiment 1 of this application calculates the target trajectory reward value based on multiple predicted behavior trajectories and actual behavior trajectories. This includes: for any predicted behavior trajectory, comparing the action distribution between the predicted and actual behavior trajectories to obtain an action distribution reward value; comparing the product types of the interactive products between the predicted and actual behavior trajectories to obtain a product alignment reward value; verifying the format specification of the predicted behavior trajectory and obtaining a format reward value based on the verification results; and obtaining the target trajectory reward value based on the action distribution reward value, product alignment reward value, and format reward value.
[0123] Optionally, when calculating the target trajectory reward value based on multiple predicted behavior trajectories and actual behavior trajectories, for any generated predicted behavior trajectory, the following three dimensions are evaluated to obtain the reward value for the corresponding dimension:
[0124] First, an action distribution comparison is performed to obtain the action distribution reward value. The statistical distribution of various item-related actions (such as clicks, adding to cart, and purchases) in the predicted behavior trajectory is compared with the statistical distribution of the same action types in the corresponding real behavior trajectory. For example, for predefined related action types (such as clicks, adding to cart, and purchases), the frequency of occurrence of the action in the predicted trajectory and the corresponding real trajectory is counted, and the absolute value of the difference between the two is calculated. The absolute differences of all action types are summed to obtain a total distribution difference measure. Finally, a smoothing constant is added to this total difference measure, and the reciprocal or negative value is taken as the action distribution reward value.
[0125] Secondly, product alignment comparisons are performed to obtain product alignment reward values. The consistency between decisions made regarding specific items in the predicted behavioral trajectory and the actual user's shopping intent is evaluated. For example, the target product indicated by the predicted action is compared to the corresponding real product in the actual behavioral trajectory. The category similarity between the predicted product and the real product is calculated, and the obtained similarity score is used as the product alignment reward value.
[0126] Finally, a format specification check is performed to obtain the format reward value. This verifies whether the output of the predicted behavioral trajectory conforms to the preset structural specification and execution validity. Specifically, it checks whether the action instructions output by the agent can be correctly parsed and whether the proposed environmental action is executable in the current page context (e.g., performing the "buy" action on a list page might be considered invalid). A positive format reward value is only given when the output format is correct and the action is executable in the current context; otherwise, the reward value is zero. This helps maintain the stability of the policy and the rationality of the output during the exploration phase.
[0127] After obtaining the action distribution reward value, product alignment reward value, and format reward value, these three are weighted and summed based on preset weighting coefficients to obtain the target trajectory reward value for the predicted behavioral trajectory. For example, the target trajectory reward value can be the sum of the action distribution reward value, the weighted product alignment reward value, and the format reward value. This target trajectory reward value is then used for advantage estimation in the reinforcement learning algorithm to guide the update of the agent's policy, enabling it to optimize simultaneously at both the macro-level of behavioral distribution and the micro-level of intent alignment, thereby generating a simulated trajectory that is more faithful to real user behavior.
[0128] In some embodiments, the formula for calculating the target trajectory reward value is as follows:
[0129]
[0130] in, The reward value is the reward value distributed across actions. Align reward values for products. Assign a weight value to the product to align the reward value. The reward value is in format.
[0131] By combining action distribution comparison, product category alignment verification, and format specification validation, the predicted trajectory can be comprehensively evaluated from three dimensions: macro-interaction pattern, micro-shopping intent, and output effectiveness. This guides the agent to improve intent while maintaining the authenticity of behavior distribution during the reinforcement learning optimization process. Figure 1 This ensures consistency and stability of the output structure, thereby generating simulated trajectories that more closely resemble real-world actions.
[0132] To improve the accuracy of the action distribution reward value, the algorithm testing method provided in Embodiment 1 of this application compares the action distribution between the predicted behavior trajectory and the actual behavior trajectory to obtain the action distribution reward value. This includes: calculating the predicted action frequency corresponding to each of the multiple interactive action types in the predicted behavior trajectory; calculating the actual action frequency corresponding to each of the multiple interactive action types in the actual behavior trajectory; and calculating the predicted action frequency and the actual action frequency to obtain the action distribution reward value.
[0133] Optionally, when calculating the reward value for action distribution to achieve more accurate macro-behavioral alignment, a set of action types for evaluation is determined. For example, product-related actions with clear intent, such as clicking, entering the details page, adding to cart, and purchasing, are included, while purely navigational actions (such as scrolling and going back) are excluded.
[0134] Then, the frequency of predicted actions in the predicted behavior trajectory is counted. For each action type determined above, the predicted behavior trajectory generated by the agent is traversed, and the total number of times each action type appears in the trajectory is counted, which is recorded as the predicted action frequency (for example, the predicted action frequency for action type a is...). For example, count how many times the "click" action occurred in the predicted trajectory, and how many times the "add to cart" action occurred. Count the frequency of actual actions in the actual behavior trajectory. For each type of action, iterate through the corresponding actual user behavior trajectory and count the total number of times that action type appears in the actual trajectory, denoted as the actual action frequency (e.g., the actual action frequency for action type 'a' is...). For example, counting how many times the "click" action and the "add to cart" action occurred in the actual user's behavior.
[0135] Next, a measure of motion distribution difference is calculated. For any motion type, the absolute value of the difference between the predicted motion frequency and the actual motion frequency is calculated to quantify the deviation of the predicted trajectory from the actual trajectory for that motion type. The absolute differences for all motion types are summed to obtain a total distribution difference measure; the smaller this value, the closer the overall motion distribution of the predicted trajectory is to the actual trajectory.
[0136] Finally, the action distribution reward value is obtained based on the total distribution difference metric. To convert the difference metric into a reward signal, a negative correlation or inverse relationship is typically used. For example, a smoothing constant can be added to the total distribution difference metric, and the negative value can be taken as the action distribution reward value. Alternatively, other monotonically decreasing functions can be used to map the difference to the reward value. This calculation method ensures that the closer the action distribution of the predicted trajectory is to the real trajectory (i.e., the smaller the difference), the higher the action distribution reward value, thus encouraging the agent to generate trajectories that conform to the macroscopic behavioral patterns of real users in reinforcement learning optimization.
[0137] In some embodiments, the formula for calculating the action distribution reward value is as follows:
[0138]
[0139] in, A smoothing constant (such as 0.1) is used to ensure numerical stability, preventing the denominator from approaching zero when the number of times a certain type of action occurs in the actual trajectory is zero or very few, which would lead to numerical instability or large gradients in the reward value calculation.
[0140] By statistically analyzing the frequency of various interactive actions in the predicted and actual behavioral trajectories, and calculating the action distribution reward value based on the difference between the two, the consistency between the simulated behavior and the actual behavior pattern of the agent can be quantified at the macro level, thereby reducing the deviation of the simulated trajectory in behavior distribution.
[0141] To improve the accuracy of product alignment reward values, the algorithm testing method provided in Embodiment 1 of this application compares the product types of interactive products between the predicted behavior trajectory and the actual behavior trajectory to obtain product alignment reward values. This includes: determining the target class target tag corresponding to the interactive product in the predicted behavior trajectory and the reference class target tag corresponding to the interactive product in the actual behavior trajectory based on a preset hierarchical product category system; calculating the matching score for the target class target tag and the reference class target tag; and calculating the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0142] Optionally, when calculating product alignment reward values to achieve more accurate micro-intent alignment, a pre-defined hierarchical product category system is first constructed or invoked. The hierarchical product category system can contain multiple levels (e.g., L-level), ranging from coarse-grained first-level categories (e.g., "clothing") to fine-grained third-level subcategories (e.g., "dresses").
[0143] Then, the interactive products and their action information are extracted from the predicted behavior trajectory. For actions related to specific products in the predicted trajectory (such as clicking, adding to cart, and purchasing), the target product to which the action points is determined, and according to the preset hierarchical product category system, the target category target tag sequence corresponding to the target product at each level is determined. At the same time, the intent intensity weight corresponding to the interactive action is obtained. For example, the weight of purchasing behavior is usually higher than that of clicking behavior to reflect the certainty of the user's decision. For example, the intent intensity weight of purchasing behavior is 0.6, and the intent intensity weight of clicking behavior is 0.4, etc.
[0144] This involves extracting reference product information from actual user behavior patterns. The actual product is identified within the corresponding real user behavior patterns, and based on the same hierarchical product category system, the corresponding reference category target sequence for that actual product at each level is determined.
[0145] Furthermore, the matching score is calculated. For the target product indicated by the predicted action and the reference product in the actual trajectory, their class labels at each level are compared. For example, the matching score can be determined by calculating the depth of overlap in the category level prefixes. For instance, if the target product and the reference product are identical in the first and second level categories and differ only in the third level category, the matching score is high; if they differ even in the first level category, the matching score is low, avoiding overly strict exact matching that could lead to sparse reward signals.
[0146] Finally, the product alignment reward value is calculated based on the intent intensity weight and the matching score. The intent intensity weight of each interaction action is multiplied by the corresponding product matching score to obtain the local alignment score for that action. The local alignment scores of all relevant interactions in the trajectory are then summed to obtain the product alignment reward value.
[0147] In some embodiments, the product alignment reward value is calculated using the following formula:
[0148]
[0149]
[0150] in, This represents the summation of all actions (denoted as item) related to the interactive product in the predicted behavioral trajectory. 'a' represents the specific action in the trajectory (e.g., clicking on a product, adding a product to the cart, etc.). This represents the intent intensity weight corresponding to action 'a'. This weight is set based on empirical behavior distribution and is used to reflect the strength of the user's intent implied by different interactive actions. For example, the weight of a purchase action is usually higher than that of a click action, and the weight of adding to cart is lower. This represents the matching score corresponding to action 'a', which measures the similarity between the item targeted by action 'a' and the category of the corresponding product in the actual user intent. This represents the reference product set corresponding to the actual behavioral trajectory. In the process, we find the real product y that matches the predicted product to obtain a higher matching score. It is the collection of all real products contained in the real trajectory. This indicates the target product to be predicted in relation to action 'a'. 'L' represents the depth of the predefined hierarchical product category system (e.g., 3 levels: Level 1, Level 2, Level 3). This indicates an indicator function. The function evaluates to 1 if the condition within the parentheses is true, and 0 otherwise. This indicates that the information obtained for a certain interactive product in the [number]th [month] is [number]. Category labels at different levels. For example, Indicates predictive interactive products In the Layer category labels, Indicates the real interactive product y in the first... Layer category labels.
[0151] By calculating the category tag matching score between predicted products and real products through a hierarchical product category system, and combining it with the intention intensity weight of interactive actions for weighted summation, the consistency between the agent's specific item decisions and the real user's shopping intentions can be quantified at the micro level. This allows the agent to be guided to generate interactive behaviors that are more consistent with the user's deep intentions and the correlation of product attributes during the reinforcement learning optimization process, thereby improving the fidelity of the simulated trajectory at the intention level.
[0152] In some embodiments, such as Figure 3 The diagram illustrates reinforcement learning for a pre-trained agent. The pre-trained agent makes predictions and outputs predicted behavioral trajectories, including: predicted interactive actions (action space includes: swiping, clicking, adding, returning, and purchasing), the prediction reasoning process, and memory updates. Simultaneously, the pre-trained agent needs to retrieve current state information from a multi-layered memory architecture during prediction, including working memory, episodic memory, and preference memory.
[0153] The pre-trained agent outputs the updated contextual memory content for the current time step based on the current observation (i.e., page elements), working memory, and historical contextual memory. The pre-trained agent also generates or updates the preference memory content based on the current observation, historical contextual memory, and existing preferences.
[0154] Finally, based on the predicted and actual behavioral trajectories, the action distribution reward, product alignment reward, and format reward are calculated to iterate the pre-trained agent, gradually bringing the predicted behavioral trajectory closer to the actual behavioral trajectory (e.g., ...). Figure 3 The solid green line in the diagram corresponds to the user's actual behavior trajectory, while the dashed red line corresponds to the agent's predicted behavior trajectory, thus obtaining the target agent.
[0155] In the algorithm testing method provided in Embodiment 1 of this application, the target intelligent agent predicts the interactive action trajectory of the target product on the target platform to obtain the interactive action trajectory; based on the interactive action trajectory, the task indicator data corresponding to the target product is obtained; based on the task indicator data, the target strategy algorithm is tested to obtain the test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm, which solves the technical problem of low algorithm testing efficiency in related technologies.
[0156] In this application, a target intelligent agent predicts the interaction trajectory of a target product on a target platform, obtaining the interaction trajectory. Based on this trajectory, task indicator data corresponding to the target product is acquired, and this data is used to test the target policy algorithm to obtain test results characterizing its policy performance. By using the interaction trajectory generated by the intelligent agent to simulate real-world interactions, time-consuming manual operations or long-term online experiments in related technologies are replaced. This allows for rapid and low-cost evaluation of the target policy algorithm's performance without requiring significant online resources, thereby improving the efficiency of algorithm testing.
[0157] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0158] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0159] Example 2
[0160] According to embodiments of this application, an algorithm testing apparatus for implementing the above-described algorithm testing method is also provided, such as... Figure 4 As shown, the device includes: a prediction unit 401, a first acquisition unit 402, and a testing unit 403.
[0161] Prediction unit 401 is used to predict the interactive action trajectory of the target product on the target platform through the target intelligent agent, and obtain the interactive action trajectory.
[0162] The first acquisition unit 402 is used to acquire task indicator data corresponding to the target product based on the interaction action trajectory;
[0163] Test unit 403 is used to test the target policy algorithm based on task indicator data and obtain test results, wherein the test results are used to characterize the policy performance of the target policy algorithm.
[0164] In the algorithm testing device provided in Embodiment 2 of this application, the prediction unit 401 predicts the interactive action trajectory of the target product on the target platform through the target intelligent agent to obtain the interactive action trajectory; the first acquisition unit 402 acquires the task indicator data corresponding to the target product based on the interactive action trajectory; the testing unit 403 tests the target strategy algorithm based on the task indicator data to obtain the test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm, which solves the technical problem of low algorithm testing efficiency in related technologies.
[0165] In this application, a target intelligent agent predicts the interaction trajectory of a target product on a target platform, obtaining the interaction trajectory. Based on this trajectory, task indicator data corresponding to the target product is acquired, and this data is used to test the target policy algorithm to obtain test results characterizing its policy performance. By using the interaction trajectory generated by the intelligent agent to simulate real-world interactions, time-consuming manual operations or long-term online experiments in related technologies are replaced. This allows for rapid and low-cost evaluation of the target policy algorithm's performance without requiring significant online resources, thereby improving the efficiency of algorithm testing.
[0166] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the target agent is trained using the following device: a second acquisition unit, used to acquire a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and a real interactive action; a first training unit, used to perform imitation behavior training on the initial agent through the training sample set to obtain a pre-trained agent; and a second training unit, used to perform reinforcement learning training on the pre-trained agent through the training sample set to obtain the target agent.
[0167] Optionally, in the algorithm testing apparatus provided in Embodiment 2 of this application, the target agent is trained using the following apparatus: a third acquisition unit, used to acquire a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and a trajectory point in a real behavior trajectory includes at least: the current page element in the target platform and a real interactive action; a sampling unit, used to perform multiple rounds of sampling in the target platform through a pre-trained agent to generate multiple predicted behavior trajectories, wherein a trajectory point in a predicted behavior trajectory includes at least: a page element, a predicted interactive action, and a predicted inference process; a calculation unit, used to calculate based on multiple predicted behavior trajectories and real behavior trajectories to obtain a target trajectory reward value; and a training unit, used to perform reinforcement learning training on the pre-trained agent based on the target trajectory reward value to obtain the target agent.
[0168] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the device further includes: a setting unit, used to set a multi-layer memory architecture in the pre-trained agent during reinforcement learning training using a training sample set, wherein the multi-layer memory architecture includes at least: working memory, contextual memory, and preference memory, the working memory being used to record at least a preset number of browsing steps corresponding to visual impression information within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information, the contextual memory being used to record interaction event information during a session, and the preference memory being used to record preference information of the target object; and an adding unit, used to add memory update operations to the action space of the pre-trained agent, so that when the pre-trained agent generates prediction interaction actions in the target platform, it simultaneously outputs memory update actions, wherein the memory update actions include at least: contextual memory update actions and preference memory update actions.
[0169] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the sampling unit includes: an acquisition subunit, used to acquire the first page element corresponding to the first time step of the target platform for any round of sampling, and acquire the current state information from the multi-layer memory architecture of the pre-trained agent; a prediction subunit, used to perform action prediction based on the first page element and the current state information, to obtain the predicted interactive action and the predicted inference process corresponding to the first time step; an execution subunit, used to execute the predicted interactive action corresponding to the first time step in the target platform, to obtain the second page element; and a first determination subunit, used to repeatedly execute the step of acquiring the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met, and to obtain the predicted behavior trajectory of the current round based on the currently obtained predicted interactive action, predicted inference process and page element, wherein the multi-layer memory architecture is used to store the memory information of the target agent.
[0170] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the device further includes: a detection unit, used to detect whether there is a difference between the second page element and the first page element after performing action prediction based on the first page element and the current state information; and a first update unit, used to update the second page element, the predicted interactive action corresponding to the first time step, and the predicted inference process corresponding to the first time step to the working memory of the multi-layer memory architecture when there is a difference between the second page element and the first page element.
[0171] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the device further includes: a second update unit, used to update the context memory information to the context memory of the multi-layer memory architecture if context memory information exists in the memory update action after the action prediction is performed based on the first page element and the current state information; and a third update unit, used to update the preference memory information to the preference memory of the multi-layer memory architecture if preference memory information exists in the memory update action.
[0172] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the calculation unit includes: a first comparison subunit, used to compare the action distribution between the predicted behavior trajectory and the actual behavior trajectory for any predicted behavior trajectory, and obtain an action distribution reward value; a second comparison subunit, used to compare the product type of the interactive product between the predicted behavior trajectory and the actual behavior trajectory, and obtain a product alignment reward value; a verification subunit, used to verify the format specification of the predicted behavior trajectory, and obtain a format reward value based on the verification result; and a second determination subunit, used to obtain a target trajectory reward value based on the action distribution reward value, the product alignment reward value, and the format reward value.
[0173] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the first comparison subunit includes: a first calculation module, used to calculate the predicted action frequency corresponding to each of the multiple interactive action types in the predicted behavior trajectory; a second calculation module, used to calculate the actual action frequency corresponding to each of the multiple interactive action types in the actual behavior trajectory; and a third calculation module, used to calculate the predicted action frequency and the actual action frequency to obtain the action distribution reward value.
[0174] Optionally, in the algorithm testing device provided in Embodiment 2 of this application, the second comparison subunit includes: a determination module, used to determine the target class target tag corresponding to the interactive product in the predicted behavior trajectory and the reference class target tag corresponding to the interactive product in the actual behavior trajectory based on a preset hierarchical product category system; a fourth calculation module, used to calculate the target class target tag and the reference class target tag to obtain a matching score; and a fifth calculation module, used to calculate the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0175] It should be noted that the prediction unit 401, the first acquisition unit 402, and the testing unit 403 mentioned above correspond to steps S201 to S203 in Embodiment 1. The three units and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should also be noted that the above units, as part of the device, can run in the computer terminal 10 provided in Embodiment 1.
[0176] It should be noted that the preferred implementation schemes involved in the above embodiments of this application are the same as the schemes, application scenarios and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0177] Example 3
[0178] Embodiments of this application may provide an electronic device, which may be any one of a group of electronic device terminals. Optionally, in this embodiment, the aforementioned electronic device may also be replaced by a terminal device such as a mobile terminal.
[0179] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0180] In this embodiment, the above-mentioned electronic device can execute the program code of the following steps in the algorithm testing method: predict the interaction trajectory of the target product on the target platform through the target intelligent agent to obtain the interaction trajectory; obtain the task indicator data corresponding to the target product based on the interaction trajectory; test the target strategy algorithm based on the task indicator data to obtain the test result, wherein the test result is used to characterize the strategy performance of the target strategy algorithm.
[0181] The aforementioned electronic device can execute the program code for the following steps in the algorithm testing method: The target intelligent agent is trained using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; training the initial intelligent agent to imitate behavior using the training sample set to obtain a pre-trained intelligent agent; and training the pre-trained intelligent agent to reinforcement learning using the training sample set to obtain the target intelligent agent.
[0182] The aforementioned electronic device can execute the following steps in the algorithm testing method: The target agent is trained using the following steps: A training sample set is obtained, wherein the training sample set includes at least multiple real behavior trajectories, and a trajectory point in each real behavior trajectory includes at least: the current page element in the target platform and a real interactive action; Multiple rounds of sampling are performed on the target platform by the pre-trained agent to generate multiple predicted behavior trajectories, wherein a trajectory point in each predicted behavior trajectory includes at least: a page element, a predicted interactive action, and a predicted inference process; The target trajectory reward value is calculated based on the multiple predicted behavior trajectories and the real behavior trajectories; The pre-trained agent is trained using reinforcement learning based on the target trajectory reward value to obtain the target agent.
[0183] The aforementioned electronic device can execute the program code for the following steps in the algorithm testing method: In the reinforcement learning training of the pre-trained agent using a training sample set, the method further includes: setting a multi-layer memory architecture in the pre-trained agent, wherein the multi-layer memory architecture includes at least: working memory, episodic memory, and preference memory, the working memory is used to record at least a preset number of browsing steps corresponding to visual impression information within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information, the episodic memory is used to record interaction event information during a session, and the preference memory is used to record the preference information of the target object; adding a memory update operation to the action space of the pre-trained agent, so that when the pre-trained agent generates a prediction interaction action in the target platform, it simultaneously outputs a memory update action, wherein the memory update action includes at least: episodic memory update action and preference memory update action.
[0184] The aforementioned electronic device can execute the following steps in the algorithm testing method: Performing multiple rounds of sampling on the target platform using a pre-trained agent to generate multiple predicted behavior trajectories, including: for any round of sampling, obtaining the first page element corresponding to the first time step of the target platform, and obtaining the current state information from the multi-layer memory architecture of the pre-trained agent; performing action prediction based on the first page element and the current state information to obtain the predicted interactive action and the predicted inference process corresponding to the first time step; executing the predicted interactive action corresponding to the first time step on the target platform to obtain the second page element; repeatedly executing the step of obtaining the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met, and obtaining the predicted behavior trajectory of the current round based on the currently obtained predicted interactive action, predicted inference process, and page element, wherein the multi-layer memory architecture is used to store the memory information of the target agent.
[0185] The aforementioned electronic device can execute the following steps in the algorithm testing method: After predicting the action based on the first page element and the current state information, the method further includes: detecting whether there is a difference between the second page element and the first page element; if there is a difference between the second page element and the first page element, updating the second page element, the predicted interactive action corresponding to the first time step, and the predicted reasoning process corresponding to the first time step to the working memory of the multi-layer memory architecture.
[0186] The aforementioned electronic device can execute the following steps of the algorithm testing method: After predicting the action based on the first page element and the current state information, the method further includes: if a memory update action is output synchronously, if contextual memory information exists in the memory update action, then the contextual memory information is updated to the contextual memory of the multi-layer memory architecture; if preference memory information exists in the memory update action, then the preference memory information is updated to the preference memory of the multi-layer memory architecture.
[0187] The aforementioned electronic device can execute the following steps in the algorithm testing method: calculating the target trajectory reward value based on multiple predicted behavior trajectories and actual behavior trajectories, including: for any predicted behavior trajectory, comparing the action distribution between the predicted behavior trajectory and the actual behavior trajectory to obtain an action distribution reward value; comparing the product types of the interactive products between the predicted behavior trajectory and the actual behavior trajectory to obtain a product alignment reward value; verifying the format specification of the predicted behavior trajectory and obtaining a format reward value based on the verification result; and obtaining the target trajectory reward value based on the action distribution reward value, product alignment reward value, and format reward value.
[0188] The aforementioned electronic device can execute the following steps in the algorithm testing method: comparing the action distribution between the predicted behavior trajectory and the actual behavior trajectory to obtain the action distribution reward value, including: calculating the predicted action frequency corresponding to each of the multiple interactive action types in the predicted behavior trajectory; calculating the actual action frequency corresponding to each of the multiple interactive action types in the actual behavior trajectory; and calculating the action distribution reward value by combining the predicted action frequency and the actual action frequency.
[0189] The aforementioned electronic device can execute the following steps in the algorithm testing method: comparing the product types of the interactive products between the predicted behavioral trajectory and the actual behavioral trajectory to obtain a product alignment reward value, including: determining the target class target tag corresponding to the interactive product in the predicted behavioral trajectory and the reference class target tag corresponding to the interactive product in the actual behavioral trajectory based on a preset hierarchical product category system; calculating the target class target tag and the reference class target tag to obtain a matching score; and calculating the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0190] Optionally, Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (Only one is shown in the image) Processor 502 and memory 504. The electronic device may also include a memory controller to control and manage the memory 504; the electronic device may also include a peripheral interface to connect to a radio frequency module, an audio module, and a display screen, etc.
[0191] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the algorithm testing method and apparatus in this application embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the aforementioned algorithm testing method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to electronic devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0192] The processor can access the information and application programs stored in the memory via the transmission device to perform the following steps: predict the interaction trajectory of the target product on the target platform through the target intelligent agent to obtain the interaction trajectory; obtain the task indicator data corresponding to the target product based on the interaction trajectory; test the target policy algorithm based on the task indicator data to obtain the test results, wherein the test results are used to characterize the policy performance of the target policy algorithm.
[0193] Optionally, the processor may also execute program code for the following steps: The target agent is trained using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; training the initial agent to imitate behavior using the training sample set to obtain a pre-trained agent; and training the pre-trained agent to reinforcement learning using the training sample set to obtain the target agent.
[0194] Optionally, the processor may also execute program code for the following steps: The target agent is trained using the following steps: obtaining a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and a trajectory point in a real behavior trajectory includes at least: the current page element in the target platform and the real interaction action; performing multiple rounds of sampling in the target platform through a pre-trained agent to generate multiple predicted behavior trajectories, wherein a trajectory point in a predicted behavior trajectory includes at least: a page element, a predicted interaction action, and a predicted inference process; calculating the target trajectory reward value based on the multiple predicted behavior trajectories and the real behavior trajectories; and performing reinforcement learning training on the pre-trained agent based on the target trajectory reward value to obtain the target agent.
[0195] Optionally, the processor may also execute program code for the following steps: In the reinforcement learning training of the pre-trained agent using a training sample set, the method further includes: setting a multi-layer memory architecture in the pre-trained agent, wherein the multi-layer memory architecture includes at least: working memory, episodic memory, and preference memory, the working memory being used to record at least a preset number of browsing steps corresponding to visual impression information within a preset time window, the prediction reasoning process and prediction interaction actions corresponding to the visual impression information, the episodic memory being used to record interaction event information during a session, and the preference memory being used to record preference information of the target object; adding memory update operations to the action space of the pre-trained agent, so that when the pre-trained agent generates prediction interaction actions on the target platform, it simultaneously outputs memory update actions, wherein the memory update actions include at least: episodic memory update actions and preference memory update actions.
[0196] Optionally, the processor may also execute program code with the following steps: performing multiple rounds of sampling on the target platform through a pre-trained agent to generate multiple predicted behavior trajectories, including: for any round of sampling, obtaining the first page element corresponding to the first time step of the target platform, and obtaining the current state information from the multi-layer memory architecture of the pre-trained agent; performing action prediction based on the first page element and the current state information to obtain the predicted interaction action and the predicted inference process corresponding to the first time step; executing the predicted interaction action corresponding to the first time step on the target platform to obtain the second page element; repeatedly executing the step of obtaining the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent until a preset time step is reached or the session termination condition is met, and obtaining the predicted behavior trajectory of the current round based on the currently obtained predicted interaction action, predicted inference process and page element, wherein the multi-layer memory architecture is used to store the memory information of the target agent.
[0197] Optionally, the processor may also execute program code with the following steps: after predicting the action based on the first page element and the current state information, the method further includes: detecting whether there is a difference between the second page element and the first page element; if there is a difference between the second page element and the first page element, updating the second page element, the predicted interactive action corresponding to the first time step, and the predicted inference process corresponding to the first time step to the working memory of the multi-layer memory architecture.
[0198] Optionally, the processor may also execute program code with the following steps: after predicting the action based on the first page element and the current state information, the method further includes: if a memory update action is output synchronously, if contextual memory information exists in the memory update action, then the contextual memory information is updated to the contextual memory of the multi-layer memory architecture; if preference memory information exists in the memory update action, then the preference memory information is updated to the preference memory of the multi-layer memory architecture.
[0199] Optionally, the processor may also execute program code that performs the following steps: calculating a target trajectory reward value based on multiple predicted behavior trajectories and actual behavior trajectories, including: for any predicted behavior trajectory, comparing the action distribution between the predicted behavior trajectory and the actual behavior trajectory to obtain an action distribution reward value; comparing the product types of the interactive products between the predicted behavior trajectory and the actual behavior trajectory to obtain a product alignment reward value; verifying the format specification of the predicted behavior trajectory and obtaining a format reward value based on the verification result; and obtaining the target trajectory reward value based on the action distribution reward value, the product alignment reward value, and the format reward value.
[0200] Optionally, the processor may also execute program code that performs the following steps: comparing the action distribution between the predicted behavior trajectory and the actual behavior trajectory to obtain the action distribution reward value, including: calculating the predicted action frequency corresponding to each of the multiple interaction action types in the predicted behavior trajectory; calculating the actual action frequency corresponding to each of the multiple interaction action types in the actual behavior trajectory; and calculating the action distribution reward value by comparing the predicted action frequency and the actual action frequency.
[0201] Optionally, the processor may also execute program code for the following steps: comparing the product types of interactive products between the predicted behavioral trajectory and the actual behavioral trajectory to obtain a product alignment reward value, including: determining the target class target tag corresponding to the interactive product in the predicted behavioral trajectory and the reference class target tag corresponding to the interactive product in the actual behavioral trajectory based on a preset hierarchical product category system; calculating the target class target tag and the reference class target tag to obtain a matching score; and calculating the product alignment reward value based on the weight of the interactive action corresponding to the interactive product and the matching score.
[0202] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.
[0203] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0204] Example 4
[0205] Embodiments of this application also provide a computer program product. Optionally, in this embodiment, the computer program product can be used to store the program code executed by the algorithm testing method provided in Embodiment 1.
[0206] Optionally, in this embodiment, the computer program product may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0207] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0208] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0209] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0210] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0211] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0212] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several 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 methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0213] 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. An algorithm testing method, characterized in that, include: The interaction trajectory is obtained by predicting the interaction action trajectory of the target product on the target platform by the target intelligent agent. Based on the interaction action trajectory, obtain the task indicator data corresponding to the target product; The target strategy algorithm is tested based on the task indicator data to obtain test results, wherein the test results are used to characterize the strategy performance of the target strategy algorithm.
2. The method according to claim 1, characterized in that, The target agent is trained using the following steps: Obtain a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; The initial agent is trained to mimic behavior using the training sample set to obtain a pre-trained agent. The target agent is obtained by performing reinforcement learning training on the pre-trained agent using the training sample set.
3. The method according to claim 1, characterized in that, The target agent is trained using the following steps: Obtain a training sample set, wherein the training sample set includes at least multiple real behavior trajectories, and one trajectory point in the real behavior trajectory includes at least: the current page element in the target platform and the real interactive action; By performing multiple rounds of sampling on the target platform through a pre-trained agent, multiple predicted behavior trajectories are generated. Each trajectory point in the predicted behavior trajectory includes at least: page elements, predicted interactive actions, and predicted inference processes. The target trajectory reward value is calculated based on the multiple predicted behavior trajectories and the actual behavior trajectories. The pre-trained agent is trained using reinforcement learning based on the target trajectory reward value to obtain the target agent.
4. The method according to claim 3, characterized in that, In the reinforcement learning training of the pre-trained agent, the method further includes: A multi-layer memory architecture is set in the pre-trained agent, wherein the multi-layer memory architecture includes at least: working memory, contextual memory and preference memory. The working memory is used to record visual impression information corresponding to a preset number of browsing steps within a preset time window, the prediction reasoning process and prediction interaction action corresponding to the visual impression information, the contextual memory is used to record interaction event information during a session, and the preference memory is used to record the preference information of the target object. The memory update operation is added to the action space of the pre-trained agent so that when the pre-trained agent generates a predicted interaction action in the target platform, it simultaneously outputs a memory update action, wherein the memory update action includes at least: a context memory update action and a preference memory update action.
5. The method according to claim 3, characterized in that, Multiple rounds of sampling are performed on the target platform by a pre-trained agent to generate multiple predicted behavior trajectories, including: For any round of sampling, obtain the first page element corresponding to the first time step of the target platform, and obtain the current state information from the multi-layer memory architecture of the pre-trained agent; Based on the first page element and the current state information, action prediction is performed to obtain the predicted interactive action and the prediction reasoning process corresponding to the first time step. Execute the predicted interactive action corresponding to the first time step in the target platform to obtain the second page element; The process of repeatedly retrieving the current state information of the next time step from the multi-layer memory architecture of the pre-trained agent is repeated until a preset time step is reached or the session termination condition is met. Based on the currently obtained predicted interactive actions, prediction inference process, and page elements, the predicted behavior trajectory of the current round is obtained. The multi-layer memory architecture is used to store the memory information of the target agent.
6. The method according to claim 5, characterized in that, After performing action prediction based on the first page element and the current state information, the method further includes: Detect whether there are differences between the second page element and the first page element; If there is a difference between the second page element and the first page element, the second page element, the predicted interactive action corresponding to the first time step, and the predicted inference process corresponding to the first time step are updated to the working memory of the multi-layer memory architecture.
7. The method according to claim 5, characterized in that, After performing action prediction based on the first page element and the current state information, the method further includes: If a memory update action is output synchronously, and if contextual memory information exists in the memory update action, then the contextual memory information is updated to the contextual memory of the multi-layer memory architecture. If the memory update action contains preference memory information, the preference memory information is updated to the preference memory of the multi-layer memory architecture.
8. The method according to claim 3, characterized in that, The target trajectory reward value is calculated based on the multiple predicted behavioral trajectories and the actual behavioral trajectories, including: For any predicted behavior trajectory, the action distribution between the predicted behavior trajectory and the actual behavior trajectory is compared to obtain the action distribution reward value; The product types of the interactive products between the predicted behavioral trajectory and the actual behavioral trajectory are compared to obtain the product alignment reward value; The format specification of the predicted behavioral trajectory is checked, and a format reward value is obtained based on the check result; The target trajectory reward value is obtained based on the action distribution reward value, the product alignment reward value, and the format reward value.
9. The method according to claim 8, characterized in that, The action distribution between the predicted behavior trajectory and the actual behavior trajectory is compared to obtain the action distribution reward value, including: Calculate the predicted action frequency corresponding to each of the multiple interaction action types in the predicted behavior trajectory; Calculate the frequency of the actual action corresponding to each of the multiple interaction action types in the actual behavior trajectory; The predicted action frequency and the actual action frequency are calculated to obtain the action distribution reward value.
10. The method according to claim 8, characterized in that, The product types of the interactive products between the predicted behavioral trajectory and the actual behavioral trajectory are compared to obtain a product alignment reward value, including: Based on a pre-defined hierarchical product category system, the target category target tags corresponding to the interactive products in the predicted behavior trajectory and the reference category target tags corresponding to the interactive products in the actual behavior trajectory are determined respectively. A matching score is obtained by calculating the target class target tag and the reference class target tag; The product alignment reward value is calculated based on the weight of the interactive action corresponding to the interactive product and the matching score.
11. An algorithm testing device, characterized in that, include: The prediction unit is used to predict the interactive action trajectory of the target product on the target platform through the target intelligent agent, and obtain the interactive action trajectory. The first acquisition unit is used to acquire task indicator data corresponding to the target product based on the interaction action trajectory. The testing unit is used to test the target policy algorithm based on the task indicator data and obtain test results, wherein the test results are used to characterize the policy performance of the target policy algorithm.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the storage medium is located to perform the algorithm testing method according to any one of claims 1 to 10.
13. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program executes the algorithm testing method according to any one of claims 1 to 10 when it runs.
14. A computer program product, characterized in that, Includes a computer program or instructions that, when executed by a processor, implement the algorithm testing method according to any one of claims 1 to 10.
