Background

PPO(Proximal Policy Optimization)

Since solving TRPO’s Surrogate Objective Function is complicated, the idea is to simplify it using methods like Clipping and approximate it with a First-order (first derivative) approach. In TRPO, a Constraint is defined to satisfy the Trust Region and the Surrogate Objective Function is derived, but in PPO, the constraint is simply handled via Clipping. The epsilon value is a hyper-parameter, and values of around 0.1 or 0.2 are reportedly used.

\[\begin{aligned} r_t(\theta) &= \frac{\pi_\theta(a_t \mid s_t)}{\pi_{\theta_{\text{old}}}(a_t \mid s_t)} \\[2mm] L^{CLIP}(\theta) &= \hat{\mathbb{E}}_t\left[\min(r_t(\theta)\hat{A}_t, \operatorname{clip}(r_t(\theta), 1-\epsilon, 1+\epsilon)\hat{A}_t)\right] \end{aligned}\]

Clipping means cutting off the portion that exceeds a certain region to a constant value. When A<0, it’s a bad action, so that action should be done less, which means r needs to be decreased. However, rather than decreasing it indefinitely, it is only decreased down to the clipped boundary. Based on this principle, the final Objective Function, which incorporates the State-Value and the Action Entropy for Exploration, is optimized.

\[L_t^{CLIP+VF+S}(\theta) = \hat{\mathbb{E}}_t\left[L_t^{CLIP}(\theta) - c_1 L_t^{VF}(\theta) + c_2 S[\pi_\theta](s_t)\right],\]

PPO is a variant of Advantage Actor-critic, where N Actors each perform actions for T Time-Steps to accumulate Data, and the Advantage is computed for each Time-Step. Updates are continuously performed with L-Clip (theta) over several Epochs. In this process, because updates are only made within the region that can be trusted thanks to Clipping, the accumulated data can be reused multiple times in a stable manner.

Source: https://engineering-ladder.tistory.com/69

CLIP(Contrastive Language-Image Pre-training)

The limitation of existing vision models was that each image required a label. To overcome the limitations of labeling, they collected image data from the internet and used natural language simply as supervision (a way to describe images to the model), building a dataset of about 400 million images.

Figure

After that, the model is trained with Contrastive Learning. This is one of the self-supervised learning methods that learn from data without labels, training an embedding network that places related data features close together in the feature space. Text and image are each passed through their encoders to extract features, and at the final output, fixed-size embedding vectors are generated to align the dimensionality, then the similarity between image and text is computed. During this, the model is trained so that the feature vectors of image and text align with each other.

Motivation

  1. Why Minecraft?

    Defines no specifie weard nor specific fixed storyline to follow β‡’ suitable for developing open-ended environments for embodied AI research

❓

Embodied Agents & Embodied AI Research

Embodied Agent:

  • Has a β€œbody” (physical or virtual) situated in an environment
  • Perceives the world through sensors (cameras, microphones, etc.)
  • Takes actions that affect the environment
  • Learns from the consequences of its actions

Embodied AI Research:

The field of study focused on developing AI systems that learn through physical interaction with their environment, rather than just processing static datasets.

Why β€œEmbodiment” Matters?

  • The Symbol Grounding Problem
    • Disembodied AI: β€œapple” ←associated withβ†’ β€œred”, β€œfruit”, β€œsweet” (Just statistical word associations)

    • Embodied AI: Sees apple β†’ Picks it up β†’ Feels texture β†’ Bites it β†’ Tastes sweetness (Grounded understanding through experience)

  • Learning Through Interaction

Method

Figure

Figure

MineCLIP

Architecture

Full ASCII MineCLIP architecture
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Complete MINECLIP Architecture               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  VIDEO PATH:                                                    β”‚
β”‚  ───────────                                                    β”‚
β”‚  16 Frames                                                      β”‚
β”‚      β”‚                                                          β”‚
β”‚      β–Ό                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚ Image Encoder (Ο†I)     β”‚                                     β”‚
β”‚  β”‚ [ViT-B/16 from CLIP]   β”‚                                     β”‚
β”‚  β”‚                        β”‚                                     β”‚
β”‚  β”‚ Layers 1-10: FROZEN    β”‚ ← Keep general visual features      β”‚
β”‚  β”‚ Layers 11-12: FINETUNE β”‚ ← Adapt to Minecraft                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚              β”‚                                                  β”‚
β”‚              β–Ό                                                  β”‚
β”‚  16 Γ— [512-dim frame features]                                  β”‚
β”‚              β”‚                                                  β”‚
β”‚              β–Ό                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚ Temporal Aggregator(φₐ)β”‚                                     β”‚
β”‚  β”‚ [Avg pool OR Attention]β”‚ ← Combine frames into one feature   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚              β”‚                                                  β”‚
β”‚              β–Ό                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚ CLIP Adapter Layer 1   β”‚ ← Learn Minecraft adjustments       β”‚
β”‚  β”‚ (Residual connection)  β”‚                                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚              β”‚                                                  β”‚
β”‚              β–Ό                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚ CLIP Adapter Layer 2   β”‚ ← Further refinement                β”‚
β”‚  β”‚ (Residual connection)  β”‚                                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚              β”‚                                                  β”‚
β”‚              β–Ό                                                  β”‚
β”‚     [512-dim video feature] ─────────┐                          β”‚
β”‚                                      β”‚                          β”‚
β”‚                                      β”‚                          β”‚
β”‚  TEXT PATH:                          β”‚                          β”‚
β”‚  ──────────                          β”‚                          β”‚
β”‚  "shear a sheep"                     β”‚                          β”‚
β”‚      β”‚                               β”‚                          β”‚
β”‚      β–Ό                               β”‚                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚                          β”‚
β”‚  β”‚ Text Encoder (Ο†G)      β”‚          β”‚                          β”‚
β”‚  β”‚ [GPT from CLIP]        β”‚          β”‚                          β”‚
β”‚  β”‚                        β”‚          β”‚                          β”‚
β”‚  β”‚ Layers 1-10: FROZEN    β”‚          β”‚                          β”‚
β”‚  β”‚ Layers 11-12: FINETUNE β”‚          β”‚                          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚                          β”‚
β”‚              β”‚                       β”‚                          β”‚
β”‚              β–Ό                       β”‚                          β”‚
β”‚     [512-dim text feature] ───────────                          β”‚
β”‚                                      β”‚                          β”‚
β”‚                                      β–Ό                          β”‚
β”‚                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚                            β”‚ Cosine          β”‚                  β”‚
β”‚                            β”‚ Similarity      β”‚                  β”‚
β”‚                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚                                     β”‚                           β”‚
β”‚                                     β–Ό                           β”‚
β”‚                              Correlation Score                  β”‚
β”‚                              (0.0 to 1.0)                       β”‚
β”‚                                     β”‚                           β”‚
β”‚                                     β–Ό                           β”‚
β”‚                              Used as REWARD                     β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • pre-trained text encoder \(\phi_{G}\): forms the language goal embedding
  • video encoder \(\phi_{V}\): moving window of 16 consecutive frames w/ 160x256 resolution

    Architecture

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ MINECLIP Video Encoder β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ 16 RGB Frames β”‚ β”‚ β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”‚ β”‚ β”‚ 1 β”‚ β”‚ 2 β”‚ β”‚ 3 β”‚ β”‚ 4 β”‚ . . . . β”‚16 β”‚ β”‚ β”‚ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”Œβ”€β”€β”€β” β”‚ β”‚ β”‚Ο†I β”‚ β”‚Ο†I β”‚ β”‚Ο†I β”‚ β”‚Ο†I β”‚ . . . . β”‚Ο†I β”‚ ← Image Encoder β”‚ β”‚ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ (same weights) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β–Ό β–Ό β”‚ β”‚ [512] [512] [512] [512] . . . [512] ← Per-frame features β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Temporal β”‚ β”‚ β”‚ β”‚ Aggregator β”‚ β”‚ β”‚ β”‚ (φₐ) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β”‚ β”‚ [512] ← Single video feature β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    • frame-wise image encoder \(\phi_I\)
    • temporal aggregator \(\phi_a\): summarize the sequence of 16 image features into a single video embedding
      • average pooling: it’s fast since it’s a simple algebraic operation, but temporal order information is lost

         Frame features:   [0.2, 0.5, ...]  [0.4, 0.3, ...]  [0.1, 0.6, ...]
                                 β”‚               β”‚               β”‚
                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                 β–Ό
                                       Average all values
                                                 β–Ό
                                      [0.23, 0.47, ...]
        
      • self-attention transformer: it can capture temporal relationships, but it is slow and increases the number of parameters

         Frame features:   [f1]    [f2]    [f3]    ...    [f16]
                             β”‚       β”‚       β”‚             β”‚
                             β–Ό       β–Ό       β–Ό             β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚         Transformer Layer 1             β”‚
                       β”‚   (Self-attention: frames look at       β”‚
                       β”‚    each other to understand context)    β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚       β”‚       β”‚             β”‚
                             β–Ό       β–Ό       β–Ό             β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚         Transformer Layer 2             β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚       β”‚       β”‚             β”‚
                             β–Ό       β–Ό       β–Ό             β–Ό
                           [f1']   [f2']   [f3']   ...   [f16']
                             β”‚       β”‚       β”‚             β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                             β–Ό
                                       Pool/Aggregate
                                             β–Ό
                                     [video feature]
        
      • residual CLIP Adaptor: its purpose is to make domain-specific adjustments by additionally training only a small residual mlp module on top of a frozen pre-trained model.

      ❓

      Why β€œResidual”?

      Because the residual itself means the adapter learns the difference from the original model, so it only learns what needs to change while keeping the pre-trained knowledge as a baseline.

β‡’ Among these, only the last two layers of \(\phi_I, \phi_G\) are finetuned (i.e., only the layers related to high-level, semantic concepts, that is, the most task-specific features, are finetuned)

❓

How MineCLIP play a role of β€œautomatic evaluation metric” and why the β€œnon-trivial computational overhead”?

Figure

During training it plays the role of a reward function, but at the same time it can function as an automatic evaluation metric for creative tasks.

  • The agent is trained by trial & error
  • A reward signal is provided at regular intervals

    β‡’ Policy improvement

At evaluation time, the agent’s performance must be evaluated, which requires judging β€œDid it successfully perform the task?”

However, creative tasks, for example, β€œbuild a beautiful house,” require semantic understanding. In such cases, MineCLIP can function as an evaluation metric for these creative tasks as well as for training: it outputs a correlation score, which is compared against a threshold to judge whether the task was performed well or not. It was confirmed that this matches human evaluation results well. The reason this is possible is that MineCLIP was trained to answer the question β€œDoes the video match the text description well?”!

However, if used naively it can cause a bottleneck. This is because the reward signal can only be obtained by passing through the model, rather than through a predefined manual function.

PPO on MineCLIP rewards

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    What RL Training Requires                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  1. States (s):        What the agent observes                  β”‚
β”‚                        β†’ RGB frames, GPS, inventory, etc.       β”‚
β”‚                                                                 β”‚
β”‚  2. Actions (a):       What the agent does                      β”‚
β”‚                        β†’ Move, attack, use item, camera turn    β”‚
β”‚                                                                 β”‚
β”‚  3. Rewards (r):       Feedback signal (THIS IS WHERE MINECLIP  β”‚
β”‚                        COMES IN!)                               β”‚
β”‚                                                                 β”‚
β”‚  4. Policy (Ο€):        Agent's brain β€” maps states to actions   β”‚
β”‚                                                                 β”‚
β”‚  5. Value Function (V): Estimates "how good is this state?"     β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The Complete Training Loop

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Complete Training Loop                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                    INITIALIZATION                       β”‚   β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚
β”‚  β”‚  β€’ Load pretrained MINECLIP model (frozen during RL)    β”‚   β”‚
β”‚  β”‚  β€’ Initialize policy network Ο€_ΞΈ                        β”‚   β”‚
β”‚  β”‚  β€’ Initialize value function V_ψ                        β”‚   β”‚
β”‚  β”‚  β€’ Precompute text features for task goal G             β”‚   β”‚
β”‚  β”‚  β€’ Initialize empty Self-Imitation buffer               β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                              β”‚                                 β”‚
β”‚                              β–Ό                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              MAIN LOOP (repeat until done)              β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                              β”‚                                 β”‚
β”‚          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚          β–Ό                                       β–Ό             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  PHASE 1: COLLECT β”‚                 β”‚  PHASE 2: UPDATE  β”‚   β”‚
β”‚  β”‚     ROLLOUTS      β”‚ ──────────────▢ β”‚     POLICY        β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚          β”‚                                       β”‚             β”‚
β”‚          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                              β”‚                                 β”‚
β”‚                              β–Ό                                 β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚                    β”‚ PHASE 3: SELF   β”‚                         β”‚
β”‚                    β”‚ IMITATION       β”‚                         β”‚
β”‚                    β”‚ (periodically)  β”‚                         β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β”‚                                                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        COMPLETE MINEDOJO TRAINING ALGORITHM                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                             β”‚
β”‚  OUTER LOOP: Repeat until convergence                                       β”‚
β”‚  ════════════════════════════════════                                       β”‚
β”‚      β”‚                                                                      β”‚
β”‚      β–Ό                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ STEP 1: COLLECT EXPERIENCE                                           β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚   for step in range(batch_size):                                     β”‚   β”‚
β”‚  β”‚       β”‚                                                              β”‚   β”‚
β”‚  β”‚       β–Ό                                                              β”‚   β”‚
β”‚  β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚
β”‚  β”‚   β”‚  State   │───▢│  Policy  │───▢│  Action  │───▢│ Environment  β”‚   β”‚   β”‚
β”‚  β”‚   β”‚  (RGB,   β”‚    β”‚   Ο€_ΞΈ    β”‚    β”‚ (move,   β”‚    β”‚  (Minecraft) β”‚   β”‚   β”‚
β”‚  β”‚   β”‚   GPS,   β”‚    β”‚          β”‚    β”‚  attack) β”‚    β”‚              β”‚   β”‚   β”‚
β”‚  β”‚   β”‚  voxel)  β”‚    β”‚          β”‚    β”‚          β”‚    β”‚              β”‚   β”‚   β”‚
β”‚  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚
β”‚  β”‚                                                          β”‚           β”‚   β”‚
β”‚  β”‚                                                          β–Ό           β”‚   β”‚
β”‚  β”‚                                                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚   β”‚
β”‚  β”‚                                                   β”‚ Next State β”‚     β”‚   β”‚
β”‚  β”‚                                                   β”‚ + RGB Frameβ”‚     β”‚   β”‚
β”‚  β”‚                                                   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β”‚   β”‚
β”‚  β”‚                                                          β”‚           β”‚   β”‚
β”‚  β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚   β”‚
β”‚  β”‚       β”‚                                                              β”‚   β”‚
β”‚  β”‚       β–Ό                                                              β”‚   β”‚
β”‚  β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚   β”‚
β”‚  β”‚   β”‚ Last 16 frames   │────▢│    MINECLIP     β”‚                       β”‚   β”‚
β”‚  β”‚   β”‚ (video snippet)  β”‚     β”‚                 β”‚                       β”‚   β”‚
β”‚  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  + Task text:   β”‚                       β”‚   β”‚
β”‚  β”‚                            β”‚  "shear sheep"  β”‚                       β”‚   β”‚
β”‚  β”‚                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚   β”‚
β”‚  β”‚                                     β”‚                                β”‚   β”‚
β”‚  β”‚                                     β–Ό                                β”‚   β”‚
β”‚  β”‚                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚   β”‚
β”‚  β”‚                            β”‚ Correlation     β”‚                       β”‚   β”‚
β”‚  β”‚                            β”‚ Score: 0.73     β”‚                       β”‚   β”‚
β”‚  β”‚                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚   β”‚
β”‚  β”‚                                     β”‚                                β”‚   β”‚
β”‚  β”‚                                     β–Ό                                β”‚   β”‚
β”‚  β”‚                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚   β”‚
β”‚  β”‚                            β”‚ DIRECT or DELTA β”‚                       β”‚   β”‚
β”‚  β”‚                            β”‚ formulation     β”‚                       β”‚   β”‚
β”‚  β”‚                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚   β”‚
β”‚  β”‚                                     β”‚                                β”‚   β”‚
β”‚  β”‚                                     β–Ό                                β”‚   β”‚
β”‚  β”‚                              Reward r_t = 0.48                       β”‚   β”‚
β”‚  β”‚                                     β”‚                                β”‚   β”‚
β”‚  β”‚                                     β–Ό                                β”‚   β”‚
β”‚  β”‚   Store in buffer: (s_t, a_t, r_t, log_prob_t, s_{t+1}, done)        β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚      β”‚                                                                      β”‚
β”‚      β–Ό                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ STEP 2: COMPUTE ADVANTAGES (GAE)                                     β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚   For each transition in buffer:                                     β”‚   β”‚
β”‚  β”‚       Ξ΄_t = r_t + Ξ³Β·V(s_{t+1}) - V(s_t)                              β”‚   β”‚
β”‚  β”‚       A_t = Ξ΄_t + (Ξ³Ξ»)Β·Ξ΄_{t+1} + (Ξ³Ξ»)Β²Β·Ξ΄_{t+2} + ...                 β”‚   β”‚
β”‚  β”‚                 └──── MINECLIP reward is here!                       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚      β”‚                                                                      β”‚
β”‚      β–Ό                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ STEP 3: PPO UPDATE (multiple epochs)                                 β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚   for epoch in range(K):                                             β”‚   β”‚
β”‚  β”‚       for minibatch in buffer:                                       β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Probability ratio                                        β”‚   β”‚
β”‚  β”‚           r(ΞΈ) = Ο€_ΞΈ(a|s) / Ο€_old(a|s)                               β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Clipped surrogate objective                              β”‚   β”‚
β”‚  β”‚           L_policy = -min(r(ΞΈ)Β·A, clip(r(ΞΈ),1-Ξ΅,1+Ξ΅)Β·A)              β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Value function loss                                      β”‚   β”‚
β”‚  β”‚           L_value = (V(s) - R_target)Β²                               β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Entropy bonus                                            β”‚   β”‚
β”‚  β”‚           L_entropy = -H(Ο€(Β·|s))                                     β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Action smoothing                                         β”‚   β”‚
β”‚  β”‚           L_smooth = KL between consecutive action distributions     β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Total loss                                               β”‚   β”‚
β”‚  β”‚           L = L_policy + 0.5Β·L_value + 0.005Β·L_entropy + 1e-7Β·L_smoothβ”‚  β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚           # Gradient descent                                         β”‚   β”‚
β”‚  β”‚           ΞΈ ← ΞΈ - Ξ±Β·βˆ‡L                                               β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚      β”‚                                                                      β”‚
β”‚      β–Ό                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ STEP 4: SELF-IMITATION (every N steps)                               β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚   If episode was successful OR return > threshold:                   β”‚   β”‚
β”‚  β”‚       Add trajectory to SI buffer                                    β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β”‚   Sample trajectories from SI buffer                                 β”‚   β”‚
β”‚  β”‚   Supervised learning: maximize log Ο€(a|s) for successful actions    β”‚   β”‚
β”‚  β”‚                                                                      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚      β”‚                                                                      β”‚
β”‚      └──────────────────────────────────────────────────────────────────┐   β”‚
β”‚                                                                         β”‚   β”‚
β”‚                                    Repeat β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Discussion

  • Is Attn necessary? There are cases where Avg shows better performance even on complex tasks. What is the reason?
  • I’m curious whether the β€œworld model” framing is correct. As I understand it, MineCLIP itself is closer to semantic understanding, and there seems to be no future state prediction or model-based element. The key point seems to be that it can perform multiple actions in a generalizable way with a single network.
  • I understood that the wiki and reddit corpora are not used for training MineCLIP but are released as benchmark resources. Is this correct? I’m curious how they could be utilized in future research.