Method, device and product for managing a reward

WO2025184777A8PCT designated stage Publication Date: 2025-10-02BEIJING YOUZHUJU NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/079951
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-03-04
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

Existing reinforcement learning from human feedback (RLHF) methods for aligning language models (LMs) with human preferences face challenges in accurately representing underlying human preferences due to reward overoptimization, leading to misalignment and performance degradation.

Method used

Adversarial Policy Optimization (ADVPO) employs lightweight uncertainty estimation based on the last layer embeddings of the reward model to mitigate overoptimization by formulating a distributionally robust optimization problem, using confidence intervals to adjust rewards and update the language model with more accurate feedback.

Benefits of technology

ADVPO effectively mitigates reward overoptimization, ensuring that language models align better with human preferences without the computational burden of ensemble methods, resulting in improved policy performance and response quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024079951_02102025_PF_FP_ABST
    Figure CN2024079951_02102025_PF_FP_ABST
Patent Text Reader

Abstract

There are proposed methods, devices, and computer program products for managing a reward. In the method, a first reward associated with a prompt and a response to the prompt is obtained by a reward model. The first reward indicates a matching degree between the prompt and the response. A latent representation of the prompt and response is determined at a layer in a plurality of layers in the reward model. An uncertainty degree of the first reward is acquired based on the latent representation and a latent representation space associated with the layer. A second reward is generated based on the first reward and the uncertainty degree. With these implementations of the present disclosure, the reward output by the reward model may be more accurate by utilizing the uncertainty degree.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD, DEVICE AND PRODUCT FOR MANAGING A REWARDFIELD

[0001] The present disclosure generally relates to computer technology, and more specifically, to methods, devices, and computer program products for managing a reward.BACKGROUND

[0002] Machine learning models (such as Language Models (LMs) ) are capable of performing a wide range of natural language processing (NLP) tasks, including but not limited to text generation, summarization, translation, question answering, and sentiment analysis. Reinforcement Learning from Human Feedback (RLHF) is proven to be effective for aligning LMs with human preferences. RLHF typically involves three main steps. The first step is Supervised Fine Tuning (SFT) of a pretrained LM using high-quality data. The second step is Reward Modelling to capture human preferences that the LM should follow. The third step is Reinforcement Learning (RL) based policy optimization where a policy initialized from the SFT model is further improved, guided by the reward model as a proxy for human feedback. However, in the above process, the reward model, built from a finite dataset of human preferences, often fails to accurately represent the underlying human preference. At this point, it is desired to represent the underlying human preference accurately.SUMMARY

[0003] In a first aspect of the present disclosure, there is provided a method for managing a reward. In the method, a first reward associated with a prompt and a response to the prompt is obtained by a reward model. The first reward indicates a matching degree between the prompt and the response. A latent representation of the prompt and response is determined at a layer in a plurality of layers in the reward model. An uncertainty degree of the first reward is acquired based on the latent representation and a latent representation space associated with the layer. A second reward is generated based on the first reward and the uncertainty degree.

[0004] In a second aspect of the present disclosure, there is provided an electronic device. The electronic device comprises: a computer processor coupled to a computer-readable memory unit, the memory unit comprising instructions that when executed by the computer processor implements a method according to the first aspect of the present disclosure.

[0005] In a third aspect of the present disclosure, there is provided a computer program product, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by an electronic device to cause the electronic device to perform a method according to the first aspect of the present disclosure.

[0006] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

[0007] BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

[0008] Through the more detailed description of some implementations of the present disclosure in the accompanying drawings, the above and other objects, features and advantages of the present disclosure will become more apparent, wherein the same reference generally refers to the same components in the implementations of the present disclosure.

[0009] Fig. 1 illustrates an example environment for updating LMs according to the machine learning technique;

[0010] Fig. 2 illustrates an example diagram for managing a reward according to implementations of the present disclosure;

[0011] Fig. 3 illustrates an example diagram of the reward model according to implementations of the present disclosure;

[0012] Fig. 4 illustrates an example diagram of the latent representation space according to implementations of the present disclosure;

[0013] Fig. 5 illustrates an example diagram for the objective of updating the language model according to implementations of the present disclosure;

[0014] Figs. 6A-6D illustrate experiment results of the proposed solution according to implementations of the present disclosure;

[0015] Fig. 7 illustrates an example flowchart of a method for managing a reward according to implementations of the present disclosure; and

[0016] Fig. 8 illustrates a block diagram of a computing device in which various implementations of the present disclosure can be implemented.DETAILED DESCRIPTION

[0017] Principle of the present disclosure will now be described with reference to some implementations. It is to be understood that these implementations are described only for the purpose of illustration and help those skilled in the art to understand and implement the present disclosure, without suggesting any limitation as to the scope of the disclosure. The disclosure described herein can be implemented in various manners other than the ones described below.

[0018] In the following description and claims, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skills in the art to which this disclosure belongs.

[0019] References in the present disclosure to “one implementation, ” “an implementation, ” “an example implementation, ” and the like indicate that the implementation described may include a particular feature, structure, or characteristic, but it is not necessary that every implementation includes the particular feature, structure, or characteristic. Moreover, such phrases are not necessarily referring to the same implementation. Further, when a particular feature, structure, or characteristic is described in connection with an example implementation, it is submitted that it is within the knowledge of one skilled in the art to affect such feature, structure, or characteristic in connection with other implementations whether or not explicitly described.

[0020] It shall be understood that although the terms “first” and “second” etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element, and similarly, a second element could be termed a first element, without departing from the scope of example implementations. As used herein, the term “and / or” includes any and all combinations of one or more of the listed terms.

[0021] The terminology used herein is for the purpose of describing particular implementations only and is not intended to be limiting of example implementations. As used herein, the singular forms “a” , “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” , “comprising” , “has” , “having” , “includes” and / or “including” , when used herein, specify the presence of stated features, elements, and / or components etc., but do not preclude the presence or addition of one or more other features, elements, components and / or combinations thereof.

[0022] Principle of the present disclosure will now be described with reference to some implementations. It is to be understood that these implementations are described only for the  purpose of illustration and help those skilled in the art to understand and implement the present disclosure, without suggesting any limitation as to the scope of the disclosure. The disclosure described herein can be implemented in various manners other than the ones described below. In the following description and claims, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skills in the art to which this disclosure belongs.

[0023] It may be understood that data involved in the present technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with requirements of corresponding laws and regulations and relevant rules.

[0024] It may be understood that, before using the technical solutions disclosed in various implementation of the present disclosure, the user should be informed of the type, scope of use, and use scenario of the personal information involved in the present disclosure in an appropriate manner in accordance with relevant laws and regulations, and the user’s authorization should be obtained.

[0025] For example, in response to receiving an active request from the user, prompt information is sent to the user to explicitly inform the user that the requested operation will need to acquire and use the user’s personal information. Therefore, the user may independently choose, according to the prompt information, whether to provide the personal information to software or hardware such as electronic devices, applications, servers, or storage media that perform operations of the technical solutions of the present disclosure.

[0026] As an optional but non-limiting implementation, in response to receiving an active request from the user, the way of sending prompt information to the user, for example, may include a pop-up window, and the prompt information may be presented in the form of text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose “agree” or “disagree” to provide the personal information to the electronic device.

[0027] It may be understood that the above process of notifying and obtaining the user authorization is only illustrative and does not limit the implementation of the present disclosure. Other methods that satisfy relevant laws and regulations are also applicable to the implementation of the present disclosure.

[0028] As mentioned above, in the process of updating LMs (especially, a large language model) , the reward model often fails to accurately represent the underlying human preference. For ease of illustration, an example environment in Fig. 1 may be taken as an example to illustrate the issue in the reward model. Fig. 1 illustrates an example environment 100 for updating LMs  according to the machine learning technique. As illustrated in Fig. 1, the environment 100 may include a language model 120 which may output a response 122 based on a prompt 110. Here, the prompt 110 may be a piece of text or instruction provided to the language model 120 which aims to guide output or behavior of the language model 120. By way of example, the prompt 110 may be a simple question, a description, an instruction, or a scenario designed to elicit a response 122 from the language model 120.

[0029] The environment 100 further includes a reward model 130 which may generate a reward 132 based on the prompt 110 and the corresponding response 122 output by the language model 120. The reward 132 may represent whether the response 122 matches the prompt 110. For example, if the response 122 matches the prompt 110, the value of the reward 132 may be high (for example, 1) , otherwise the value of the reward 132 may be low (for example, 0) . Then, the reward 132 may be used to update the language model 120 so that the language model 120 may output an updated response which better matches the prompts.

[0030] However, the reward model 130, built from a finite dataset of human preferences, often fails to accurately represent the underlying human preference. This approximation error, worsened by the distribution shifts during policy updates, leads to unreliable rewards during the RL stage. This directly causes the phenomenon of “reward over-optimization” , where the LM (as an example of the language model 120) exploits erroneous high-reward states, artificially inflating the estimated proxy reward, while the ground-truth reward decreases. This misalignment leads LMs to prioritize reward maximization over actual content quality and user alignment, as seen in phenomena like “length bias” , where longer responses are erroneously favored regardless of their relevance.

[0031] Current mitigation strategies against reward overoptimization focus on penalizing samples with high reward uncertainty during RL-based policy training. These approaches utilize ensembles of different reward models trained with different seeds, either during pre-training or fine-tuning phases, and leverage the variance in estimated rewards across ensembles to quantify uncertainty. Nevertheless, while in theory, these uncertainty estimates may identify unreliable rewards, the computational cost associated with training and maintaining multiple reward models in memory during policy optimization makes them impractical in real-world settings. What is worse, this computational constraint also hinders achieving the maximum performance potential, given that the “scaling laws” generally advocate for larger reward models.

[0032] In some related works, RLHF has been a crucial approach for fine-tuning language models to align with human preferences. However, the standard RLHF pipeline optimizes the policy towards the estimated reward model as a proxy for human feedback, a method shown to be susceptible to overoptimization issue. This vulnerability leads to potential misalignments with true user preferences and subsequent degradation in performance.

[0033] Several recent works aim to directly learn the policy model without RL optimization, either through directly learning the policy model from preference data without involving reward modelling, or continuously mimicking responses ranked high by the reward model. However, due to the inherent limitations of supervised learning, these approaches face challenges in generalization and are particularly vulnerable to out-of-preference data.

[0034] In addition to approaches countering over-optimization, recent work proposes an adversarial optimization framework to update the reward and policy models iteratively. However, they utilize a min-max objective, where the inner optimization learns a policy to maximize rewards, while the outer minimization refines reward models based on provided gold preference data. Their inner optimization still directly relies on estimated rewards, thus suffering from the overoptimization problem. In contrast, the framework proposed by the present disclosure employs a max-min objective, where the inner minimization with a confidence region searches for rewards conservatively, based on which the policy is then maximized.

[0035] Before diving into the solution proposed by implementations of the present disclosure to remediate the reward overoptimization issue in Reinforcement Learning from Human Feedback (RLHF) , the present disclosure starts by providing an overview of the most popularly studied RLHF workflow. This may establish the notations and conceptual groundwork necessary for understanding the proposed solution. RLHF consists of three main steps: Supervised Fine Tuning, Reward Modelling, and RL optimization.

[0036] RLHF typically begins with Supervised Fine Tuning (SFT) , which fine-tunes a pre-trained model through supervised learning on high-quality samples from downstream tasks, such as summarization or dialogue generation. The resulting model is denoted as πSFT.

[0037] The second phase of RLHF involves learning a reward model to capture human preferences through annotated preference data where and denote  the chosen and rejected responses to prompt xi. The preferences are assumed to be generated by some unknown reward model r* (x, y) following the Bradley-Terry (BT) model:

[0038] Typically, a reward model is parameterized based on a model (usually πSFT) , with an additional linear layer added to the final transformer layer that projects the last embedding layer to obtain a scalar reward. To be more specific, let e (x, y) ∶ denote the last layer embedding of the prompt and response pair (x, y) , and φ∶ denote the additional projection layer. The reward model is defined as where includes all the tunable parameters in φ and e (x, y) . Given the annotated preference data D, the reward model is trained to assign higher rewards to the chosen answer yc compared to the rejected one yr, by minimizing the negative log-likelihood under the BT model:

[0039] In formula (1) , σ denotes the sigmoid function.

[0040] Lastly, the learned reward model is employed to provide feedback in an RL policy optimization phase. Intuitively, the aim is to learn a policy πθ that maximizes the reward while not drifting too far away from πSFT:

[0041] In the above formula, β controls the deviation from the reference policy πSFT, thereby maintaining a balance between reward maximization and adherence to the SFT policy behavior.

[0042] A notable limitation of RLHF lies in the fact that the RL optimization process relies on the estimated reward as opposed to the oracle or gold reward r*. Though widely adopted, it overlooks the potential discrepancies between and r*, which may arise due to inaccuracies during the reward model training. Empirical solutions have reported that the RL  optimization tends to “hack” the reward such that while the estimated reward (i.e., proxy reward) increases, the oracle or gold reward decreases. This phenomenon is referred to as overoptimization.

[0043] To mitigate this problem, in addition to the KL penalty in the original RL objective, several recent solutions propose to leverage an ensemble of K reward models Given a prompt x and its response y, these methods use the variance of rewards from different reward models to measure uncertainty in the estimated reward, i.e.,  The reward is then penalized by the uncertainty before feeding into policy optimization:

[0044] In formula (2) , γ controls the degree of uncertainty-based penalty. Intuitively, samples with high uncertainty during policy training are penalized to reduce the risk of overoptimizing imperfect reward signals.

[0045] However, the use of reward ensembles, especially with LMs, leads to significant computational overhead. This is due to the necessity of maintaining multiple reward models in memory throughout the policy optimization process, where each model is a separate LM with billions of parameters. What is worse, it imposes limitations on the performance ceiling that can be achieved under given computational resources, as larger reward models are especially more powerful as suggested by the scaling law. Therefore, it is desired to use lightweight uncertainty estimation in reward modelling to handle the overoptimization issue without burdensome ensembles.

[0046] In view of the above, the present disclosure proposes a solution for managing a reward based on the recent advancements in understanding the representation learning abilities in LMs, particularly the internal layer (s) (such as the last layer) of a neural network. Numerous previous solutions have shown that the internal layer contains crucial information about the network’s prediction deviation from original training data. Inspired by these findings, the present disclosure begins by inspecting lightweight uncertainty estimation methods in reward modelling, relying solely on the internal layer embedding of the reward model. Subsequently, the present disclosure proposes Adversarial Policy Optimization (ADVPO) , addressing  overoptimization by solving a distributionally robust optimization problem centered around the reward model’s prediction confidence interval for policy improvement.

[0047] This approach has proven to be a less conservative strategy for leveraging uncertainty in policy optimization compared to the utilization of uncertainty in previous work addressing overoptimization. In a variety of experiments, the present disclosure shows how ADVPO effectively mitigates reward overoptimization without the computational burden as in the ensemble-based methods. Additionally, the present disclosure demonstrates that ADVPO results in an improved policy overall, as evaluated through human-assisted assessments.

[0048] Referring to Fig. 2 for more details about the solution for managing a reward. Fig. 2 illustrates an example diagram 200 for managing a reward according to implementations of the present disclosure. As illustrated in Fig. 2, a first reward 132 associated with a prompt 110 and a response 122 to the prompt 110 is obtained by a reward model 130. Here, the first reward 132 indicates a matching degree between the prompt 110 and the response 122. A latent representation 230 (sometime also referred to as embedding) of the prompt 110 and response 122 at a layer in a plurality of layers 210 to 220 in the reward model 130 is determined. An uncertainty degree 240 of the first reward 132 (which is caused by the reward model 130) is acquired based on the latent representation 230 and a latent representation space associated with the layer. Then, a second reward (also referred to as an updated reward) is generated based on the first reward 132 and the uncertainty degree 240. In an example, the second reward may be computed by subtracting the uncertainty degree 240 from the first reward 132. With these implementations of the present disclosure, the reward output by the reward model 130 may be more accurate by utilizing the uncertainty degree to correcting the first reward 132.

[0049] In implementations of the present disclosure, the layer may be an internal layer in the plurality of layers in the reward model 130. Latent representations at the internal layers (especially the last layer) may affect the final output of the reward model 130. Referring to Fig. 3 for more details about the last layer in the reward model 130. Fig. 3 illustrates an example diagram 300 of the reward model 130 according to implementations of the present disclosure. As illustrated in Fig. 3, the layers 210, …, and 212 in in the plurality of layers 210 to 220 before the last layer 220 may generate the latent representation 230, which acts as the input to the last  layer 220. At this point, the layers 210, …, and 212 may act as the encoder (which encodes the prompt and response into the latent representation 230) , and the last layer 220 may act as a decoder (which decodes the latent representation 230 into the reward) . There is an association between last layer embeddings and reward uncertainty, and the last layer embedding of the reward model 130 encapsulates crucial information regarding uncertainties in the model’s predictions.

[0050] As discussed, reward modelling may be decomposed into two parts: learning a good representation e (x, y) for the prompt and response pair through a pre-trained LM; and projecting the learnt representation to yield a scalar reward using a mapping φ. The training of LMs on extensive text corpora, coupled with their vast number of parameters, enables these models to develop versatile representations that may even be used in zero / few-shot tasks, which demonstrate the adaptability of these representations.

[0051] However, the second part, which involves learning the projection weight φ, is strictly tied to the preference data provided during the reward model training. Consequently, the reliability of rewards is closely linked to the accuracy and adaptability of the projection weight.

[0052] The above theory has been widely supported in previous solutions in deep neural networks. For instance, a solution demonstrates that by freezing the network up to its last layer and retraining only the projection head with a smaller data set, where spurious correlation is absent, it can greatly improve robustness of the neural network model against these spurious correlations. In the context of language models, recent experiments on weak-to-strong generalization further reinforce this theory. Their findings reveal that, despite the fine-tuning of an LM’s last layer embedding with noisy labels from weak supervision, the model can still excel in later classification tasks if the projection weight is accurately derived from ground-truth labels. This highlights the adaptability and the rich information encapsulated in the embeddings, accessible through simple projection weights.

[0053] Building upon the notion of generalized representations with specialized projection weights, the present disclosure shifts focus to the last layer’s ability for uncertainty estimation. The projection weight is strictly estimated based on the preference data encountered during  reward model training. Therefore, when evaluating the prompt and response pairs during the RL stage, the pairs might deviate from what was observed during reward training (suggesting it undergo distribution shift) , hence rendering the predicted rewards unreliable as they might be outside the support of training set. With these implementations, the uncertainty degree may be acquired efficiently and effectively, and the computational cost may be reduce relying solely on the last layer embeddings of the reward model.

[0054] It is to be noted that the last layer is merely an example of the layer. The layer may further include one or more layers (e.g., the last two layer) or a single layer (e.g., the last but one layer) .

[0055] In the following, the present disclosure may show how the last layer embedding of a reward model, based on preference data (as an example of reference samples to train the reward model) , may act as a feature map for an underlying kernel. This kernel then allows to determine whether new prompt response pairs are similar to the ones seen during training. If not, the corresponding uncertainty should be higher, and therefore penalized during policy optimization.

[0056] In implementations of the present disclosure, the latent representation space may be obtained based on a plurality of reference samples for obtaining the reward model, here a reference sample in the plurality of reference samples comprise a reference prompt, a reference response, a reference reward. In an example, the reference reward may be a value given by a human. Referring to Fig. 4 for more details about the latent representation space associated with the layer. Fig. 4 illustrates an example diagram 400 of the latent representation space according to implementations of the present disclosure. As illustrated in Fig. 4, a dataset 410 may include a plurality of reference samples 412 to 414. Here, the dataset 410 may be used to train the reward model 130 in Fig. 1. The plurality of reference samples 412 to 414 may be mapped to a plurality of latent representations 422 to 424, respectively, and the plurality of latent representations 422 to 424 may form a latent representation space.

[0057] In implementations of the present disclosure, the uncertainty degree may be determined based on a deviation of the latent representation from the latent representation space. Still referring to Fig. 4, after obtaining the latent representation space 420, the deviation 430 of the latent representation 230 from the latent representation space 420 may be computed and the  uncertainty degree may be determined based on the deviation 430. In an example, the uncertainty degree may be directly proportional to the deviation 430. With these implementations, a more accurate uncertainty degree may be determined based on the computed deviation and thus a more accurate reword may be generated based on uncertainty degree.

[0058] In implementations of the present disclosure, the latent representation space may be represented by a distribution of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation may be represented by the latent representation and an inverse of the distribution.

[0059] Many solutions for quantifying uncertainty in a neural network’s output, guided by the similarity derived from the model’s final layer embeddings, have demonstrated their effectiveness both in theory and in practice. Implementations of the present disclosure provide the following two methods (i.e., uncertainty quantification in neural bandits and Bayesian uncertainty modelling) due to their computational efficiency and theoretical soundness.

[0060] Regarding uncertainty quantification in neural bandits, with probability 1-δ, the following inequality concerning the uncertainty degree, or the width of the confidence interval (also referred to as deviation) of the estimated reward, holds:

[0061] In formula (3) , b is a function of δ (typically the smaller δ is, the larger b is) and e (x, y) T represents latent representation (i.e., embedding) of a prompt and a response. In addition, MD (also referred to as the distribution of the plurality of reference latent representations of the plurality of reference samples) summarizes all last layer embeddings observed in the training data for the reward model, i.e.,  For ease of illustration, the present disclosure denotes Intuitively, if the new prompt-response pair (x, y) is similar to samples in the training data, applying the inverse of MD would result in a small uncertainty otherwise, the uncertainty will be high. With these implementations, the latent representation space may be accurately represented by the distribution of the plurality of reference latent representations and thus the uncertainty degree may be determined accurately.

[0062] In implementations of the present disclosure, the latent representation space may be represented by a mean and a covariance of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation may be represented by the latent representation and the mean and the covariance.

[0063] Bayesian uncertainty modelling, such as Bayesian Linear Regression (BLR) or Gaussian Processes (GP) , also offers an elegant method to quantify uncertainty degree in closed form. For simplicity of illustration, the present disclosure first considers BLR and subsequently describe GPs. In BLR, the projection weights φ are presumed to follow a Gaussian prior, expressed as  with m0 being the prior mean and S0 being the prior covariance matrix.

[0064] Then the predictive posterior mean μpost and variance of the reward for a new datapoint (x, y) in BLR can be expressed in closed form as follows: μpost =e (x, y) TmD        (5)

[0065] In the above formulas, ε represents the aleatoric noise, SD and mD represent the closed form posterior mean and variance of the projection weights φ calculated based on the reward training data D. The present disclosure has presented BLR, it should be noted for GPs, the mean and covariance can be derived analogously by replacing every e (x, y) Te (x, , y, ) computation with k (e (x, y) , e (x, , y, ) ) , where k is a kernel function. It is to be noted that both aforementioned uncertainty estimation methods are used to determine distances in the embedding spaces, with different scaling covariances.

[0066] The present disclosure empirically investigates the effectiveness of the two lightweight uncertainty estimation methods introduced above. Since the objective of the present disclosure is to harness uncertainty in reward modelling to mitigate the overoptimization issue in RLHF, the present disclosure specifically examines whether the two methods can identify discrepancies between estimated proxy rewards and gold rewards during the RL stage. The present disclosure adopts a synthetic setup widely, where a significantly larger “gold- standard” reward model is trained that simulates human preferences and provides labels for training a proxy reward model.

[0067] The present disclosure runs a standard RLHF pipeline on the open datasets, with reward and policy models established from LMs. The preference dataset is labelled by the gold reward model. During the PPO (Proximal Policy Optimization) training stage, the present disclosure logs the generated samples every 10 steps. Subsequently, the present disclosure computes their gold reward, proxy reward, as well as reward uncertainties associated with the proxy reward. The present disclosure compares the following uncertainty methods: CI (The uncertainty quantified through formula (3) ) , GP (Gaussian Process uncertainty through formula (6) ) , and other reward determination methods. As a result, the lightweight uncertainty estimation methods proposed by the present disclosure (i.e., CI and GP) are effective in adjusting over-optimization. The lightweight uncertainty estimation methods proposed by the present disclosure surpasses reward ensembles with comparable parameter sizes.

[0068] In implementations of the present disclosure, the second reward may be generated based on a difference between the first reward and the uncertainty degree. In an example, the second reward may be generated by subtracting the uncertainty degree from the first reward. With these implementations, by removing the uncertainty degree, the updated uncertainty degree may better capture human preference.

[0069] Given that the lightweight uncertainty estimation methods (i.e., CI and GP) in the above capture the reliability of estimated rewards and demonstrate potential in mitigating the overoptimization issue, the following devises an effective way to leverage them to improve policy optimization. In the following, CI in formula (3) is primarily adopted to quantify uncertainties in reward modelling.

[0070] The reward uncertainties enable the construction of a confidence interval containing the golden reward with high probability, as defined in formula (3) . This motivates to formulate a distributionally robust optimization problem centered around the reward model’s prediction confidence interval for policy improvement. Moving from a naive point estimate of reward to an interval estimate, this approach prevents the policy optimization from being misled by high rewards with high uncertainty, which is the main cause of overoptimization.

[0071] In implementations of the present disclosure, the layer in the reward model 130 may be updated based on the uncertainty degree 240. In a case where the layer is the last layer in the reward model, only the last layer may be updated and other layers in the reward may be frozen. As the lightweight uncertainty estimation focuses solely on the last layer embeddings, the reward uncertainty (also referred to uncertainty degree) implies uncertainty in the learnt projection weight in the reward model. Specifically, let and denote the optimal and estimated projection weights for the last layer to predict rewards, respectively. The present disclosure has that:  Recall that MD summarizes all last layer embeddings observed during the training of the reward model and can thus be precomputed. With these implementations, the reward model may output more accurate reward and the reward over-optimization issue may be mitigated.

[0072] In implementations of the present disclosure, the response 122 may be generated by a language model 120 based on the prompt 110, and the language model 120 describing an association relationship between a prompt 110 and a response 122. In an example, the prompt 110 may be a piece of text or instruction provided to the language model 120 that serves as a starting point or context for generating a response 122. When provided with the prompt 110, the language model 120 analyzes the text and attempts to generate a relevant and appropriate response 122. With these implementations, the language model 120 is guided by the prompt 110 to generate a response 122 so that the quality and appropriateness of the generated response 122 may be guaranteed.

[0073] In implementations of the present disclosure, the language model 120 may be updated based on the second reward. As mentioned above, an issue in RL optimization phase in the RLHF workflow is to use an overoptimized reward (i.e., the first reward which includes the uncertainty degree 240) to update the language model 120. Implementations of the present disclosure may use the second reward (i.e., the reward has removed the uncertainty degree 240) to update the language model 120, therefore the language model 120 may be updated based on an accurate reward. With these implementations, the reward overoptimization issue may be mitigated and the language model 120 may be updated based on a more precious reward.

[0074] In implementations of the present disclosure, the language model 120 may be updated by determining, by the reward model 130, a pessimistic reward corresponding to the prompt and response base on the uncertainty degree; and updating the language model 120 based on an objective function associated with the pessimistic reward. Within the confidence interval of learnt projection weight, ADVPO searches for reward predictions that are most pessimistic about the current policy and then improve the policy against such rewards. Since the gold reward is guaranteed to be covered by the confidence interval with high probability, using the most pessimistic reward (i.e., the lowest possible reward) naturally avoids over-optimization. Formally, this formulates a distributionally robust optimization problem. Referring to Fig. 5 for more details about the optimization problem. Fig. 5 illustrates an example diagram 500 for the objective 510 of optimizing the language model 120 according to implementations of the present disclosure. As illustrated in Fig. 5, the objective 520 of optimizing the reward model 130 may be included in the objective 510. An example of the objective 510 including the objective 520 may be as follows:

[0075] In formula (7) , rφ (·) denotes the reward obtained when using the projection weight φ, while keeping the representation encoder unchanged. With these implementations, reward over-optimization may be avoided by using the most pessimistic reward and the language model 120 may get a better update.

[0076] Furthermore, to better align the adversarial search with how the reward model is obtained in formula (1) , the present disclosure also incorporates a reference response through pairwise preference comparison in our objective function. The reference response may be any acceptable answer, such as an annotated good response from users or a response generated by the SFT model. Intuitively, the inclusion of a reference also prevents ADVPO from being overly conservative, as it ensures that the model is optimized along the direction that can at least yield a policy better than where the reference is collected.

[0077] The inner minimization of formula (7) has a closed-form solution, and thus the optimization problem in formula (7) has an equivalent but easier to operate form:

[0078] In formula (8) ,  and

[0079] The above has illustrated respective steps of the present disclosure and the following will describe an experimental environment of implementing these steps. In the following, the present disclosure empirically assesses ADVPO’s effectiveness. The experiments focus on evaluating whether ADVPO may mitigate the overoptimization issue; and whether ADVPO results in an improved policy in practice. The experiments utilized multiple widely adopted datasets for RLHF to carry out the empirical investigation. Referring to Figs 6A-6D for more details about the experiment result. As illustrated in Figs 6A-6D, the gold reward is represented by the solid line, while the dashed line corresponds to the proxy reward. The x-axis of Fig. 6B and Fig. 6D have a square-root scale. Fig. 6A and Fig. 6C illustrate how the golden reward (solid lines) and proxy reward (dashed lines) progress concerning policy optimization steps on multiple datasets, respectively, while Fig. 6B and Fig. 6D capture the dynamics with respect to the square root KL divergence, i.e.,  Firstly, it is to be noted that that PPO (i.e., an existing solution) exhibits the issue of overoptimization across both datasets, characterized by a significant increase in proxy reward (dashed line) , while the golden reward (solid line) begins to decline after reaching certain steps for the multiple datasets. However, by taking the estimated proxy reward conservatively, i.e. using ADVPO (i.e., the proposed solution) , the present disclosure may mitigate overoptimization towards high but unreliable rewards, ensuring it stays within a reliable region (small KL divergence) with high golden rewards.

[0080] In addition, the algorithm’s performances of ADVPO and some baselines are subsequently assessed by evaluating the quality of responses generated from the resulting policy. As a result, ADVPO may consistently outperforms all baselines and result an improved policy.

[0081] Overall, the present disclosure proposes Adversarial Policy Optimization (ADVPO) , a novel approach designed to tackle reward overoptimization in RLHF. First, the present disclosure showcases the effectiveness of lightweight uncertainty quantification that relies solely on the last layer embeddings. Subsequently, the present disclosure proposes ADVPO to tackle a distributionally robust optimization problem centered around the reward model’s prediction confidence interval for policy improvement. Empirical experiments conducted on the multiple datasets demonstrate that ADVPO effectively mitigates the overoptimization issue without incurring the computational burden associated with ensembles. This results in improved policy in practical scenarios.

[0082] The above paragraphs have described details for managing a reward. According to implementations of the present disclosure, a method is provided for managing a reward. Reference will be made to Fig. 7 for more details about the method, where Fig. 7 illustrates an example flowchart of a method 700 for managing a reward according to implementations of the present disclosure. At block 710, a first reward associated with a prompt and a response to the prompt is obtained by a reward model. The first reward indicates a matching degree between the prompt and the response. At block 720, a latent representation of the prompt and response is determined at a layer in a plurality of layers in the reward model. At block 730, an uncertainty degree of the first reward is acquired based on the latent representation and a latent representation space associated with the layer. At block 740, a second reward is generated based on the first reward and the uncertainty degree.

[0083] In implementations of the present disclosure, the layer is a last layer in the plurality of layers in the reward model.

[0084] In implementations of the present disclosure, determining the uncertainty degree comprises: obtaining the latent representation space based on a plurality of reference samples for obtaining the reward model, a reference sample in the plurality of reference samples comprise a reference prompt, a reference response, a reference reward; and determining the uncertainty degree based on a deviation of the latent representation from the latent representation space.

[0085] In implementations of the present disclosure, the latent representation space is represented by a distribution of a plurality of reference latent representations of the plurality of  reference samples, and the deviation of the latent representation is represented by the latent representation and an inverse of the distribution.

[0086] In implementations of the present disclosure, the latent representation space is represented by a mean and a covariance of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and the mean and the covariance.

[0087] In implementations of the present disclosure, generating the second reward comprises: determining the second reward based on a difference between the first reward and the uncertainty degree.

[0088] In implementations of the present disclosure, the method 700 further comprises updating the layer in the reward model based on the uncertainty degree.

[0089] In implementations of the present disclosure, the response is generated by a language model based on the prompt, and the language model describing an association relationship between a prompt and a response.

[0090] In implementations of the present disclosure, the method 700 further comprises updating the language model based on the second reward.

[0091] In implementations of the present disclosure, the method 700 further comprises updating the language model by: determining, by the reward model, a pessimistic reward corresponding to the prompt and response base on the uncertainty degree; and updating the language model based on an objective function associated with the pessimistic reward.

[0092] According to implementations of the present disclosure, an apparatus is provided for managing a reward. The apparatus comprises: an obtaining module, configured for obtaining, by a reward model, a first reward associated with a prompt and a response to the prompt, the first reward indicating a matching degree between the prompt and the response; a determining module, configured for determining a latent representation of the prompt and response at a layer in a plurality of layers in the reward model; an acquiring module, configured for acquiring an uncertainty degree of the first reward based on the latent representation and a latent representation space associated with the layer; and a generating module, configured for generating a second reward based on the first reward and the uncertainty degree. The apparatus  further comprise other modules being configured for implementing other steps in the above method.

[0093] According to implementations of the present disclosure, an electronic device is provided for implementing the method 700. The electronic device comprises: a computer processor coupled to a computer-readable memory unit, the memory unit comprising instructions that when executed by the computer processor implements a method for managing a reward. The method comprises: obtaining, by a reward model, a first reward associated with a prompt and a response to the prompt, the first reward indicating a matching degree between the prompt and the response; determining a latent representation of the prompt and response at a layer in a plurality of layers in the reward model; acquiring an uncertainty degree of the first reward based on the latent representation and a latent representation space associated with the layer; and generating a second reward based on the first reward and the uncertainty degree.

[0094] In implementations of the present disclosure, the layer is a last layer in the plurality of layers in the reward model.

[0095] In implementations of the present disclosure, determining the uncertainty degree comprises: obtaining the latent representation space based on a plurality of reference samples for obtaining the reward model, a reference sample in the plurality of reference samples comprise a reference prompt, a reference response, a reference reward; and determining the uncertainty degree based on a deviation of the latent representation from the latent representation space.

[0096] In implementations of the present disclosure, the latent representation space is represented by a distribution of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and an inverse of the distribution.

[0097] In implementations of the present disclosure, the latent representation space is represented by a mean and a covariance of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and the mean and the covariance.

[0098] In implementations of the present disclosure, generating the second reward comprises: determining the second reward based on a difference between the first reward and the uncertainty degree.

[0099] In implementations of the present disclosure, the method 700 further comprises updating the layer in the reward model based on the uncertainty degree.

[0100] In implementations of the present disclosure, the response is generated by a language model based on the prompt, and the language model describing an association relationship between a prompt and a response.

[0101] In implementations of the present disclosure, the method 700 further comprises updating the language model based on the second reward.

[0102] In implementations of the present disclosure, the method 700 further comprises updating the language model by: determining, by the reward model, a pessimistic reward corresponding to the prompt and response base on the uncertainty degree; and updating the language model based on an objective function associated with the pessimistic reward.

[0103] According to implementations of the present disclosure, a computer program product, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by an electronic device to cause the electronic device to perform the method 700.

[0104] Fig. 8 illustrates a block diagram of a computing device 800 in which various implementations of the present disclosure can be implemented. It would be appreciated that the computing device 800 shown in Fig. 8 is merely for purpose of illustration, without suggesting any limitation to the functions and scopes of the present disclosure in any manner. The computing device 800 may be used to implement the above method in implementations of the present disclosure. As shown in Fig. 8, the computing device 800 may be a general-purpose computing device. The computing device 800 may at least comprise one or more processors or processing units 810, a memory 820, a storage unit 830, one or more communication units 840, one or more input devices 850, and one or more output devices 860.

[0105] The processing unit 810 may be a physical or virtual processor and can implement various processes based on programs stored in the memory 820. In a multi-processor system, multiple processing units execute computer executable instructions in parallel so as to improve the parallel processing capability of the computing device 800. The processing unit 810 may  also be referred to as a central processing unit (CPU) , a microprocessor, a controller, or a microcontroller.

[0106] The computing device 800 typically includes various computer storage medium. Such medium can be any medium accessible by the computing device 800, including, but not limited to, volatile and non-volatile medium, or detachable and non-detachable medium. The memory 820 can be a volatile memory (for example, a register, cache, Random Access Memory (RAM) ) , a non-volatile memory (such as a Read-Only Memory (ROM) , Electrically Erasable Programmable Read-Only Memory (EEPROM) , or a flash memory) , or any combination thereof. The storage unit 830 may be any detachable or non-detachable medium and may include a machine-readable medium such as a memory, flash memory drive, magnetic disk, or another other media, which can be used for storing information and / or data and can be accessed in the computing device 800.

[0107] The computing device 800 may further include additional detachable / non-detachable, volatile / non-volatile memory medium. Although not shown in Fig. 8, it is possible to provide a magnetic disk drive for reading from and / or writing into a detachable and non-volatile magnetic disk and an optical disk drive for reading from and / or writing into a detachable non-volatile optical disk. In such cases, each drive may be connected to a bus (not shown) via one or more data medium interfaces.

[0108] The communication unit 840 communicates with a further computing device via the communication medium. In addition, the functions of the components in the computing device 800 can be implemented by a single computing cluster or multiple computing machines that can communicate via communication connections. Therefore, the computing device 800 can operate in a networked environment using a logical connection with one or more other servers, networked personal computers (PCs) or further general network nodes.

[0109] The input device 850 may be one or more of a variety of input devices, such as a mouse, keyboard, tracking ball, voice-input device, and the like. The output device 860 may be one or more of a variety of output devices, such as a display, loudspeaker, printer, and the like. By means of the communication unit 840, the computing device 800 can further communicate with one or more external devices (not shown) such as the storage devices and display device, with one or more devices enabling the user to interact with the computing device 800, or any devices (such as a network card, a modem, and the like) enabling the computing device 800 to communicate with one or more other computing devices, if required. Such communication can be performed via input / output (I / O) interfaces (not shown) .

[0110] In some implementations, instead of being integrated in a single device, some, or all components of the computing device 800 may also be arranged in cloud computing architecture. In the cloud computing architecture, the components may be provided remotely and work together to implement the functionalities described in the present disclosure. In some implementations, cloud computing provides computing, software, data access and storage service, which will not require end users to be aware of the physical locations or configurations of the systems or hardware providing these services. In various implementations, the cloud computing provides the services via a wide area network (such as Internet) using suitable protocols. For example, a cloud computing provider provides applications over the wide area network, which can be accessed through a web browser or any other computing components. The software or components of the cloud computing architecture and corresponding data may be stored on a server at a remote position. The computing resources in the cloud computing environment may be merged or distributed at locations in a remote data center. Cloud computing infrastructures may provide the services through a shared data center, though they behave as a single access point for the users. Therefore, the cloud computing architectures may be used to provide the components and functionalities described herein from a service provider at a remote location. Alternatively, they may be provided from a conventional server or installed directly or otherwise on a client device.

[0111] The functionalities described herein can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-Programmable Gate Arrays (FPGAs) , Application-specific Integrated Circuits (ASICs) , Application-specific Standard Products (ASSPs) , System-on-a-chip systems (SOCs) , Complex Programmable Logic Devices (CPLDs) , and the like.

[0112] Program code for carrying out the methods of the subject matter described herein may be written in any combination of one or more programming languages. The program code may be provided to a processor or controller of a general-purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely or partly on a machine, executed as a stand-alone software package partly on the machine, partly on a remote machine, or entirely on the remote machine or server.

[0113] In the context of this disclosure, a machine-readable medium may be any tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include but not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random-access memory (RAM) , a read-only memory (ROM) , an erasable programmable read-only memory (EPROM or Flash memory) , an optical fiber, a portable compact disc read-only memory (CD-ROM) , an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0114] Further, while operations are illustrated in a particular order, this should not be understood as requiring that such operations are performed in the particular order shown or in sequential order, or that all illustrated operations are performed to achieve the desired results. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are contained in the above discussions, these should not be construed as limitations on the scope of the subject matter described herein, but rather as descriptions of features that may be specific to particular implementations. Certain features that are described in the context of separate implementations may also be implemented in combination in a single implementation. Rather, various features described in a single implementation may also be implemented in multiple implementations separately or in any suitable sub-combination.

[0115] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter specified in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

[0116] From the foregoing, it will be appreciated that specific implementations of the presently disclosed technology have been described herein for purposes of illustration, but that various modifications may be made without deviating from the scope of the disclosure. Accordingly, the presently disclosed technology is not limited except as by the appended claims.

[0117] Implementations of the subject matter and the functional operations described in the present disclosure can be implemented in various systems, digital electronic circuitry, or in computer software, firmware, or hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of one or more of them. Implementations of the subject matter described in this specification can be implemented as one or more computer program products, i.e., one or more modules of computer program instructions encoded on a tangible and non-transitory computer readable medium for execution by, or to control the operation of, data processing apparatus. The computer readable medium can be a machine-readable storage device, a machine-readable storage substrate, a memory device, a composition of matter effecting a machine-readable propagated signal, or a combination of one or more of them. The term “data processing unit” or “data processing apparatus” encompasses all apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, or multiple processors or computers. The apparatus can include, in addition to hardware, code that creates an execution environment for the computer program in question, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.

[0118] A computer program (also known as a program, software, software application, script, or code) can be written in any form of programming language, including compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program does not necessarily correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document) , in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub programs, or portions of code) . A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a communication network.

[0119] Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read only memory or a random access memory or both. The essential elements of a computer are a processor for performing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from  or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto optical disks, or optical disks. However, a computer need not have such devices. Computer readable media suitable for storing computer program instructions and data include all forms of nonvolatile memory, media, and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices. The processor and the memory can be supplemented by, or incorporated in, special purpose logic circuitry.

[0120] It is intended that the specification, together with the drawings, be considered exemplary only, where exemplary means an example. As used herein, the use of “or” is intended to include “and / or” , unless the context clearly indicates otherwise.

[0121] While the present disclosure contains many specifics, these should not be construed as limitations on the scope of any disclosure or of what may be claimed, but rather as descriptions of features that may be specific to particular implementations of particular disclosures. Certain features that are described in the present disclosure in the context of separate implementations can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented in multiple implementations separately or in any suitable sub-combination. Moreover, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a sub-combination or variation of a sub-combination.

[0122] Similarly, while operations are illustrated in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. Moreover, the separation of various system components in the implementations described in the present disclosure should not be understood as requiring such separation in all implementations. Only a few implementations and examples are described and other implementations, enhancements and variations can be made based on what is described and illustrated in the present disclosure.

Claims

1.A method for managing a reward, comprising:obtaining, by a reward model, a first reward associated with a prompt and a response to the prompt, the first reward indicating a matching degree between the prompt and the response;determining a latent representation of the prompt and response at a layer in a plurality of layers in the reward model;acquiring an uncertainty degree of the first reward based on the latent representation and a latent representation space associated with the layer; andgenerating a second reward based on the first reward and the uncertainty degree.2.The method according to claim 1, wherein the layer is a last layer in the plurality of layers in the reward model.3.The method according to claim 1, wherein determining the uncertainty degree comprises:obtaining the latent representation space based on a plurality of reference samples for obtaining the reward model, a reference sample in the plurality of reference samples comprise a reference prompt, a reference response, a reference reward; anddetermining the uncertainty degree based on a deviation of the latent representation from the latent representation space.4.The method according to claim 3, wherein the latent representation space is represented by a distribution of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and an inverse of the distribution.5.The method according to claim 3, wherein the latent representation space is represented by a mean and a covariance of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and the mean and the covariance.6.The method according to claim 1, wherein generating the second reward comprises: determining the second reward based on a difference between the first reward and the uncertainty degree.7.The method according to claim 1, further comprising updating the layer in the reward model based on the uncertainty degree.8.The method according to claim 1, wherein the response is generated by a language model based on the prompt, and the language model describing an association relationship between a prompt and a response.9.The method according to claim 8, further comprising: updating the language model based on the second reward.10.The method according to claim 8, further comprising: updating the language model by:determining, by the reward model, a pessimistic reward corresponding to the prompt and response base on the uncertainty degree; andupdating the language model based on an objective function associated with the pessimistic reward.11.An electronic device, comprising a computer processor coupled to a computer-readable memory unit, the memory unit comprising instructions that when executed by the computer processor implements a method for managing a reward, the method comprising:obtaining, by a reward model, a first reward associated with a prompt and a response to the prompt, the first reward indicating a matching degree between the prompt and the response;determining a latent representation of the prompt and response at a layer in a plurality of layers in the reward model;acquiring an uncertainty degree of the first reward based on the latent representation and a latent representation space associated with the layer; andgenerating a second reward based on the first reward and the uncertainty degree.12.The device of claim 11, wherein the layer is a last layer in the plurality of layers in the reward model.13.The device of claim 11, wherein determining the uncertainty degree comprises:obtaining the latent representation space based on a plurality of reference samples for obtaining the reward model, a reference sample in the plurality of reference samples comprise a reference prompt, a reference response, a reference reward; anddetermining the uncertainty degree based on a deviation of the latent representation from the latent representation space.14.The device of claim 13, wherein the latent representation space is represented by a distribution of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and an inverse of the distribution.15.The device of claim 13, wherein the latent representation space is represented by a mean and a covariance of a plurality of reference latent representations of the plurality of reference samples, and the deviation of the latent representation is represented by the latent representation and the mean and the covariance.16.The device of claim 11, wherein generating the second reward comprises: determining the second reward based on a difference between the first reward and the uncertainty degree.17.The device of claim 11, the method further comprising updating the layer in the reward model based on the uncertainty degree.18.The device of claim 11, wherein the response is generated by a language model based on the prompt, and the language model describing an association relationship between a prompt and a response.19.The device of claim 18, the method further comprising: updating the language model based on the second reward or the method further comprising: updating the language model by: determining, by the reward model, a pessimistic reward corresponding to the prompt and response base on the uncertainty degree; and updating the language model based on an objective function associated with the pessimistic reward.20.A non-transitory computer program product, the non-transitory computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by an electronic device to cause the electronic device to perform a method for managing a reward, the method comprising:obtaining, by a reward model, a first reward associated with a prompt and a response to the prompt, the first reward indicating a matching degree between the prompt and the response;determining a latent representation of the prompt and response at a layer in a plurality of layers in the reward model;acquiring an uncertainty degree of the first reward based on the latent representation and a latent representation space associated with the layer; andgenerating a second reward based on the first reward and the uncertainty degree.