This application claims the benefit of and priority to Korean Patent Application No. 10-2023-0193642, filed on Dec. 27, 2023, the entire disclosure(s) of which is hereby incorporated herein by reference in its entirety.
The present disclosure a prompt ensemble method and a computing device based on contrastive learning, which enable an agent to be adapted to a zero-shot even in a new domain, and a recording medium thereof.
In a study on vision-based reinforcement learning (hereinafter referred to as RL), a decoupled structure which separately trains a visual encoder and uses the visual encoder for policy learning later gains a popularity with the development of unsupervised learning and a large-scale pretrained model for a computer vision. Such decoupling shows high efficiency in a low data system with a lack of reward signals compared to end-to-end RL.
In this regard, various studies are introduced, which adopt the decoupling structure in an agent (e.g., a delivery robot) (embedded agent) which interacts with an environment, and in particular, a pre-trained vision model (e.g., ResNet) or a vision language model (e.g., CLIP) is utilized for visual state representation encoders.
However, it is not easy to achieve zero shot adaptation to the visual area change of the environment through the high variety and abnormalities encapsulated in the agent. In order to ensure a zero shot function of the agent, few methods of optimizing the popular pre-trained model are developed.
The agent has a variety of environments and physical properties, such as self-centered camera positions, strides, and lighting, which is a domain element that creates important changes in the perception and observation of agents. In a target environment where the setting for the domain element is not corrected, the RL policy, which depends on the pre-learned visual encoder, remains vulnerable to the domain change.
In
As illustrated in
The present disclosure is contrived in response the technical background, and the present disclosure has been made in an effort to enable an agent to be adapted to a zero shot for a domain change by using prompt based learning for a pretrained model in a decoupling RL structure.
In an aspect, provided is a prompt ensemble method based on contrastive learning, which includes: a first step of generating a prompt for each domain factor given as an input while an encoder is optimized through prompt based contrastive learning offline; and a second step of predicting a task specific state representation for an unseen domain by giving an output of the encoder to which each prompt generated in the first step is reflected as an input of an attention module online, in which the online is an environment in which an agent may learn a policy for a task through an interaction with an environment, and the offline is an environment in which the interaction with the environment is limited, and there is only pre-created data, and the domain factor as an attribute which causes a domain change in the environment is a minimum unit constituting the domain.
In the first step, the encoder is trained through image data obtained in a demonstration and a training set in which a cluster is labeled to each image data, and the cluster notifies a domain factor of the image data given as an input.
The encoder is a CLIP visual language model.
In the second step, the output of the encoder includes an image embedding in which the prompt is not reflected to an unseen domain and a prompted embedding in which the prompt is reflected to the unseen domain.
In the second step, the attention module optimizes an attention weight based on the image embedding and the prompted embedding, and the attention weight is optimized by reflecting a guidance score based on a cosine similarity between the image embedding and the prompted embedding.
The guidance score gi is defined as
where z0 represents the image embedding and zi represents the prompted embedding.
The attention weight ωi is defined as
where ki represents a projection of zi, d represents a dimension of z, and τ represents a Softmax temperature.
The task specific state representation z is defined as
The present disclosure also discloses a computing device for a prompt ensemble method based on contrastive learning and a recording medium having the prompt ensemble method based on contrastive learning recorded therein.
It is confirmed that the present disclosure has the following effects through an experiment.
First, the RL policy learned through the present disclosure achieve a competitive zero shot performance in am embodied agent task such as a navigation task of AI2THOR, a vision-based robot operation task of Meta-World, and an autonomous driving task of CARLA.
Second, the present disclosure achieves high sample efficiency in a decoupled RL structure. For example, in the present disclosure, in order to achieve a similar performance to a target domain in a seen domain and a new unseen domain in an AI2THOR object navigation, samples less than 50.0% and 16.7% are required compared to ATC and samples less than 60% and 50% are required compared to EmbCLIP.
Hereinafter, embodiments of the present disclosure will be described specifically with reference to drawings. However, the description of publicly-known function and construction that may make the gist of the present disclosure unnecessarily ambiguous will be omitted. Throughout the present disclosure, unless explicitly described to the contrary, the word “comprise” and variations such as “comprises” or “comprising”, will be understood to imply the inclusion of stated elements but not the exclusion of any other elements.
Further, terms including as first, second, and the like are used for describing various components, but the components are not limited by the terms. The terms may be used only for distinguishing one component from the other component. For example, a first component may be named as a second component and similarly, the second component may also be named as the first component without departing from the scope of the present disclosure.
Terms used in the present disclosure are used only to describe specific embodiments, and are not intended to limit the present disclosure. A singular form includes a plural form if there is no clearly opposite meaning in the context. In the present disclosure, it should be understood that term “include” or “have” indicates that a feature, a number, a step, an operation, a component, a part or the combination thereof described in the specification is present, but does not exclude a possibility of presence or addition of one or more other features, numbers, steps, operations, components, parts or combinations thereof, in advance.
If it is not particularly contrarily defined, all terms used herein including technological or scientific terms have the same meanings as those generally understood by a person with ordinary skill in the art. Terms which are defined in a generally used dictionary should be interpreted to have the same meaning as the meaning in the context of the related art, and are not interpreted as an ideal meaning or excessively formal meanings unless clearly defined in the present application.
The present disclosure relates to an RL policy adaptation technology that enables an agent to be adapted to a zero shot for a domain change by using prompt based learning for a pretrained model in a decoupled RL structure. In the present disclosure, the policy is an representation in performing a task given to the agent.
To this end, the present disclosure discloses a new contrastive prompt ensemble framework which uses a CLIP vision language model as a visual encoder, and facilitates active adjustment of visual state representations for the domain change through a contrastive learned visual prompt ensemble.
In other words, in the present disclosure, a CLIP visual language model is trained based on a prompt through expert demonstration data to generate a prompt for a domain factor given as an input, and an ensemble module is trained with the generated prompt to predict an optimal representation based on the prompt even for a new domain, which enables the agent to be adapted to the zero shot.
In the present disclosure, the ensemble uses an attention-based state composition for various visual embeddings of the same input observation. Here, each embedding corresponds to a state representation individually triggered by a specific domain factor.
In the present disclosure, a cosine similarity between the input observation and each prompted embedding is used for effectively calculating an attention weight.
The contrastive learning based prompt ensemble method according to the present disclosure includes a first step (S10) of generating a prompt for each domain factor given as an input while an encoder is optimized through prompt based contrastive learning offline as illustrated in
Each of the first and second steps of the contrastive learning based prompt ensemble method of the present disclosure become further embodied through the following description.
The present disclosure is constructed to generally include (i) a process (hereinafter, referred to as a first process) based on a prompt using a CLIP visual encoder generating a prompt pool, and (ii) a process (hereinafter, referred to as a second process) of learning an ensemble module which predicts a representation of an agent for a new domain based on the acquired prompt.
In the present disclosure, the CLIP visual encoder to generate a prompt for each domain factor while being optimized through contrastive learning based on the prompt offline, and the attention module is learned online based on the attention-based prompt ensemble to predict an optimal representation by reflecting the acquired prompt to a new domain.
Here, the online and the offline are classifications according to there is the environment which is enabled to interact with the environment of the agent. Here, the online means is an environment in which the agent may learn the policy for the task through the interaction with the environment, and the offline means an environment in which the interaction with the environment is limited, and there is only pre-created data.
In the first process, the CLIP visual encoder is optimized by using various visual prompts contrastively learned through expert demonstration for various domain factors, and through this, process, a visual prompt pool is created. Then, the prompt the prompt is used for training the attention-based ensemble jointly with the environment.
In the second process, the attention module uses a cosine similarity of embedding in order to increase learning efficiency and an analysis ability of an attention weight. Since the attention module and the policy are learned commonly for a specific task, a state representation is normalized over various domains, and optimized to task learning.
Hereinafter, each component constituting the present disclosure will be described in Detail as Follows.
The prompt based contrastive learning is used for optimizing the CLIP visual encoder. In the present disclosure, the prompt of the CLIP visual encoder is learned through prompt based representation learning based on expert demonstration data for various domain factors.
The prompt of the CLIP visual encoder is learned through image data obtained in expert demonstration and a training set constructed in which a cluster is constructed in a labeled form in the image data, and the cluster is a value representing a domain factor of image data given as an input. The CLIP visual encoder learns a prompt corresponding to the cluster, i.e., the domain factor through the input training dataset.
Through the contrastive learning, the CLIP visual encoder learns a prompt robust to the domain factor, and one prompt is created for each domain factor. That is, when n domain factors are given to the CLIP visual encoder, the CLIP visual encoder creates the numerically same n prompts through learning.
Consequently, through the contrastive learning, the CLIP visual encoder creates a prompt pool having a size corresponding to the number of domain factors (clusters) given as the input.
The process of contrastively learning the prompt of the CLIP visual encoder is described in more detail as follows.
In order to construct domain-invariant representations for self-centered recognition data, several contrast tasks for visual prompt learning may be adopted, which may be learned through expert demonstration (or demo), and the prompt may be defined as in Equation 1.
It is assumed that a pretrained model (CLIP visual encoder) T∅ parameterized to ∅ maps an observation value o∈Ω to an embedding space Z.
In order to distinguish whether an observation pair is positive, observation pair placement βP={(oi, oi′)}i≤m having a size of m includes one positive pair {(ok, ok′)|P(ok, ok′)=1} with respect to some k≤m by using a contrast function (P: Ω×Ω→{0, 1}).
Then, a visual prompt Pv is learned through the contrastive learning to optimize T∅. Here, a contrast loss function is defined as in Equation 2.
In the case of a latent vector x, y∈Z, a similarity in an embedding space Z is calculated as S(x, y). Here, λ represents a hyper parameter. The prompt based contrast learning is performed with respect to n different domain factors to obtain a visual prompt pool having n visual prompts as in Equation 3.
Through this process, each visual prompt encapsulates a specific domain-invariant knowledge.
The present disclosure proposes an attention based prompt ensemble structure illustrated in with respect to each observation.
When an observation (and the learned visual prompt pool Pv are given, an image embedding z0=(o) and a prompted embedding z=[z1=
(o, p1v), . . . , zn] are calculated. In the present disclosure, the observation refers to a domain which is not used when contrastively learning the prompt of the CLIP visual encoder.
Here, the image embedding z0 is an output of a CLIP visual encoder to which the prompt is not reflected, and the prompted embedding zi is an output of the CLIP visual encoder
in which the prompt is reflected to each observation.
Then, zo and Z are input into the attention module, and here, an attention weight ωi for each prompted embedding zi is optimized.
Here, since immediately calculating the attention weight by using zo and z may cause a localization which is impossible to analyze, a guidance score is introduced which is based on a cosine similarity between the input image and a visual prompted image embedding . Here, the guidance score is defined as in Equation 4.
By considering that as the guidance score becomes larger, the guidance score has a stronger association with the domain factor related to the prompted embedding zi, the guidance score is introduced to adjust the attention weight for a purpose of enhancing learning efficiency and increasing an analysis possibility.
When the guidance score is considered, the attention weight ωi is calculated as in Equation 5.
Next, a state embedding Z (or policy) may be obtained as in Equation 6.
Hereinafter, an effect of the present disclosure described above will be described.
In order to find out the effect, an inventor uses task specific AI2THOR, Metaworld, and CARLA environments of the agent having a dynamic domain change. Such an environment enables various domain factors such as camera setting, stride, rotation, gravity, lighting, wind speed, etc. In the prompt based contrastive learning (first process), a small-scale expert demonstration data set (i.e., 10 episodes per domain factor) for each domain factor is used. In the policy learning (second process), several source domains which are randomly generated are used through combination variation of seen domain factors (e.g., four source domains).
For performance comparison, the following models are compared in an experiment. LUSR as a reconstruction based domain adaptation method of RL uses a variational autoencoder structure for a strong representation. CURL and ACT use the contrastive learning in an RL framework for high sample efficiency and normalization for a visual area. ACO utilizes augmentation-driven and behavior-driven contrastive learnings in a context of RL. EmbCLIP is a state-of-the-art implementation AI model which utilizes the CLIP visual encoder pretrained for the visual state representation.
In this experiment, CONPE which is a frame according to the present disclosure is implemented by using a CLIP model jointly with ViT-B/32 similar to VPT and CoOp. In the prompt based contrastive learning, various contrastive learning schemes including augmentation-driven and behavior-driven contrastive learnings in which a prompt length is set to 8 are adopted. In the policy learning, online learning (e.g., PPO) for AI2THOR and imitation learning (e.g., DAGGER) for egocentric-Metaworld and CARLA are utilized.
Table 1 show comparisons of zero-shot performances and of CONPE and performances of comparison target models for a source domain, a seen domain, and an unseen domain.
In an experiment, CONPE was compared with three other models, and an average performance thereof (e.g., task success rates in AI2THOR and Metaworld, and a compensation sum in CARLA) was seen.
As shown in Table 1(a), CONPE showed a better performance than AI2THOR. In particular, a success rate of a seen target domain was 5.2 to 5.7% and a success rate of an unseen target domain was 6.9 to 20.7%, which surpassed EmbCLIP which is a most competitive baseline.
In the case of Metaworld, as shown in Table 1(b), CONPE showed higher performances than EmbCLIP by 17.3 to 24.0% and 18.0 to 20.0%, respectively in both the seen target domain and the unseen target domain.
For autonomous driving of CARLA, external environmental elements such as a weather condition and a time zone were set to a domain factor which may affect an operation task.
In Table 1(c), CONPE surpassed a reference by consistently maintaining a competitive zero-shot performance under all conditions.
A reconstruction-based representation model reduces some task-specified information in an observation, so LUSR shows a relatively low success rate. EmbCLIP shows a most prominent performance among the comparison target models, but does not compare the zero-shot performance for the target domain with CONPE.
In contrast, CONPE effectively estimated domain movement related to each domain factor by using a guided attention weight, and showed a strongest performance in both the seen target domain and the unseen domain.
When compared with EmbCLIP which is the most competitive model, CONPE required a smaller time step (online samples) than 60% with respect to the seen target domain, and required a time step smaller than 50% for the unseen target domain in order to obtain a competitive success rate.
The visual prompts may be exchanged and obtained between the prompted embeddings, and with respect to each prompt, the inventor used observations which are changed in the domain factor suitable for the prompt. This refers to a case where the embedding forms the cluster based on the visual prompt.
Joint learning for the policy and the attention module is presented previously, but here, a method which makes the policy to be adapted to the domain change by updating
for a pretrained policy π is also presented. In this case, in order to concentrate on a task related feature in observing the pretrained policy π, a prompted embedding {tilde over (z)}0 including the task related feature is integrated into an attention based ensemble, i.e., π(
({tilde over (z)}0, z)), where {tilde over (z)}0=τϕ(o, ppolv) by adding a policy prompt ppolv.
Table 2 shows a zero-shot performance for a scenario providing the pretrained policy. The inventor evaluated two different cases. A first case (aligned) is a case where prompt based contrastive learning is performed for data output from the same task of the pretrained policy, and a second case (not aligned) is an opposite case.
In AI2THOR, data through an object goal navigation task was used for the prompt based contrastive learning, while each pretrained policy was individually learned through one of object goal navigation, point goal navigation, image goal navigation, and room rearrangement. Similarly, in Metaworld, data through a reach task was used for the prompt based contrastive learning, while each pretrained policy was individually learned through one of tasks including reach, reach-wall, button-press, and door-open.
In Table 2(a), CONPE enhanced the zero-shot performance of the pretrained policy by 3.5 to 7.0% for the unseen target domain in AI2THOR. Only 400 K samples corresponding to 10% of all samples used for the policy learning were required for the adaptation of the prompt ensemble. In Table 2(b), CONPE significantly enhanced the zero-shot performance of the pretrained policy by approximately 9.0 to 57.6% in Metaworld.
Hereinafter, a computing device that implements the above-described contrastive learning based prompt ensemble will be described with reference to
The computing device 800 includes a memory 830 storing a program 820 coded so as for a computer to read the above-described contrastive learning based prompt ensemble method, and a processor 810 executing the program.
The contrastive learning based prompt ensemble method includes a first step of generating a prompt for each domain factor given as an input while an encoder is optimized through prompt based contrastive learning offline as illustrated in
Meanwhile, it is possible to implement the contrastive learning based prompt ensemble method according to the present disclosure described above with a code a computer-readable code in a computer readable recording medium. The computer readable recording medium includes all kinds of recording devices storing data which may be deciphered by a computer system.
Examples of the computer readable recording medium include a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. Further, the computer readable recording media may be stored and executed as codes which may be distributed in the computer system connected through a network and read by a computer in a distribution method. In addition, functional programs, codes, and code segments for implementing the present disclosure may be easily inferred by programmers in technical field to which the present disclosure pertains.
Hereinabove, the present disclosure has been described above based on various embodiments thereof. It is understood to those skilled in the art that the present disclosure may be implemented as a modified form without departing from an essential characteristic of the present disclosure. Therefore, the disclosed embodiments should be considered in an illustrative viewpoint rather than a restrictive viewpoint. The scope of the present disclosure is defined by the appended claims rather than by the foregoing description, and all differences within the scope of equivalents thereof should be construed as being included in the present disclosure.
| Number | Date | Country | Kind |
|---|---|---|---|
| 10-2023-0193642 | Dec 2023 | KR | national |