Multimodal Retrieval in Minecraft
Goal
A RAG system that grounds an LLM-driven agent in domain-specific knowledge to reliably execute complex, open-ended tasks in Minecraft.
The Problem
State-of-the-art embodied agents like Voyager leverage LLMs to autonomously explore, learn skills, and complete tasks in open-world environments. However, these systems suffer from three critical failure modes:
- Hallucination of impossible game mechanics, e.g., attempting to craft items with incorrect materials or in the wrong shape.
- Grounding inaccuracies in detecting task success or interacting with the Minecraft API.
- High operational costs due to reliance on proprietary black-box models like GPT-4.
On complex milestones like crafting Iron Tools, Voyager achieved only a 33% success rate across trials, making it unreliable for any production-like or research setting requiring consistent performance.
Methodology
We augmented Voyager's existing framework—comprising an automatic curriculum for task selection and a skill library for storing successful code—with a domain-specific RAG module that retrieves and injects relevant knowledge before each code-generation step. Our approach proceeded through the following stages:
1. Knowledge Base Construction
- From the MineDojo multimodal dataset, extracted 7,000 unstructured Wiki pages covering game mechanics, item recipes, and world rules.
- Deliberately excluded noisy sources like Reddit posts to maintain data quality.
- Cleaned each document to remove markup artifacts.
- Segmented each clean document into semantic chunks using recursive character text splitting with overlap to preserve context across boundaries.
2. Embedding and Indexing
- Each chunk was embedded into a 1,536-dimensional vector using OpenAI's
text-embedding-ada-002model—the same embedder used by Voyager to ensure compatibility. - Stored the resulting embeddings alongside their source text and metadata in a ChromaDB vector database, enabling efficient approximate nearest-neighbor search via cosine similarity.
- The database was persisted to disk for reuse across experiments.
3. Retrieval-Enhanced Prompting
- At each iteration, the automatic curriculum proposed a task T (e.g., "craft a stone pickaxe").
- Transformed T into a natural-language query q, embedded it to obtain a query vector vq, and performed a k-nearest-neighbor search against our indexed knowledge base.
- Retrieved top-k most semantically similar chunks (k=3–5) and prepended them as context to the LLM prompt.
- This context included explicit instructions, crafting recipes, and API usage examples directly from the wiki.
4. Iterative Code Generation
- Fed augmented prompt to DeepSeek v3.2 (open-source frontier LLM).
- DeepSeek generated executable JavaScript code using Mineflayer API.
- If execution failed (e.g., API errors, invalid actions), agent iteratively refined code with error feedback for up to four attempts.
- Successful programs were stored in the skill library for future reuse, creating a positive feedback loop where retrieved knowledge compounded with learned skills.
5. Experimental Protocol
- We evaluated both the baseline Voyager and our RAG-enhanced agent across four metrics:
- Exploration performance (unique items discovered over 25 iterations)
- Tech tree mastery (iterations required to unlock Wooden, Stone, Iron, and Diamond tool milestones)
- Map coverage (distance traveled from origin)
- Zero-shot generalization (success rate on unseen tasks like crafting buttons and trapdoors)
- Each condition was run across three independently seeded Minecraft worlds to account for environmental randomness.
6. Implementation Details
- Our RAG module was implemented as a drop-in replacement for Voyager's context provider, modifying only the
get_task_context()method in the curriculum agent. - We wrote custom log parsers to extract inventory states, positional data, and milestone achievements from simulation traces.
- All experiments were containerized with fixed random seeds and temperature=0 for deterministic, reproducible outputs.
Results
Tech Tree Mastery
Both systems achieved 100% success on Wooden and Stone Tools, but the RAG agent consistently succeeded across all trials. The critical divergence occurred at the Iron Tools milestone: the baseline succeeded in only 1 out of 3 trials (33% success), while the RAG agent succeeded in all 3 trials (100%), achieving a mean completion of 10.33 ± 6.60 episodes compared to the baseline's single success at 6 episodes.
Consistency and Reliability
The 100% success rate at the Iron milestone demonstrates that domain-specific retrieval dramatically reduces task failure—the knowledge base provided the exact crafting sequences and API calls needed, preventing the hallucination-driven failures that plagued the baseline. This consistency is critical for any real-world deployment where failure carries a cost.
Exploration Performance
The RAG agent required slightly more iterations to complete earlier milestones (6 vs. 4 episodes for Wooden Tools, 12.33 vs. 6.67 for Stone Tools), reflecting the agent's tendency to attempt more complex, validated strategies retrieved from the wiki rather than guessing. The additional iterations were a small price for the dramatic improvement in high-tier task completion.
Zero-Shot Generalization
Preliminary results on unseen tasks (crafting wooden buttons and trapdoors) showed that retrieved wiki context enabled the agent to reason about novel crafting recipes without prior experience, outperforming the baseline's trial-and-error approach.
Limitations and Future Potential
Computational constraints forced filtering out console-specific files (e.g., entries tagged "Xbox" and "Nintendo"), reducing the knowledge base's breadth. With the complete unfiltered dataset, even stronger gains are projected—potentially unlocking the Diamond Tools milestone, which neither system achieved in this study.
Visual Results