Associated paper:
N. Mukund et al., MARVEL: A Multi-Agent Research Validator and Enabler using LLMs, arXiv:2601.03436
https://arxiv.org/abs/2601.03436
MARVEL ligogpt.mit.edu/marvel is a locally deployable, open-source framework for domain-aware question answering and assisted research.
It combines a fast path for straightforward queries with a DeepSearch mode that integrates retrieval‑augmented generation (RAG) and Monte‑Carlo Tree Search to explore complementary sub‑queries and synthesise evidence without duplication. It draws on a curated semantic index of literature, internal/public documents, and (optionally) targeted web searches, with stable citation tracking throughout.
Developed by: Nikhil Mukund, Yifang Luo, Fan Zhang, Erik Katsavounidis and Lisa Barsotti, with support from the MIT Kavli Institute for Astrophysics and Space Research & LIGO Laboratory, and the NSF AI Institute for Artificial Intelligence and Fundamental Interactions.
An automatically generated, browsable overview of the MARVEL source code is available at:
https://deepwiki.com/Nikhil-Mukund/marvel
This documentation is generated directly from the GitHub repository using an automated code analysis tool, and is intended to help developers and contributors quickly navigate the codebase, understand module structure, and trace key execution paths.
For authoritative details, the source code in this repository remains the primary reference.
marvel.py— main Streamlit appconfig/— YAML configuration (models, retrieval, data, server, prompts, …)RAG_DataSets/— your local corpora, grouped by dataset type (e.g.DocPDF,LatexData, …)faiss/— persisted FAISS vector stores (./faiss/<DatasetName>/)environments/— conda environment definitions (Linux/macOS/Windows)scripts/setup/setup_conda_env.py— helper for creating the conda envscripts/evaluation/datasets/— evaluation datasets + schema docs (seescripts/evaluation/datasets/README.md)
- Create the conda environment
- Configure inference
- Local LLMs with Ollama (recommended)
- Optional cloud LLM inference via Groq
- Optional web search via Tavily
- Select/build your FAISS vector store via
config/data.yaml - Launch the Streamlit app
Environment definitions live in ./environments/:
- Linux:
environments/environment.yml - macOS:
environments/environment_mac.yml - Windows:
environments/environment_windows.yml
A helper script is provided at:
scripts/setup/setup_conda_env.py
The helper script runs:
conda env create -f environment.yml --prefix ~/miniconda/envs/marvelSo it expects an environment.yml in your current working directory.
From the repo root:
Linux
cp environments/environment.yml environment.yml
python scripts/setup/setup_conda_env.py
conda activate ~/miniconda/envs/marvelmacOS
cp environments/environment_mac.yml environment.yml
python scripts/setup/setup_conda_env.py
conda activate ~/miniconda/envs/marvelWindows
copy environments\environment_windows.yml environment.yml
python scripts\setup\setup_conda_env.py
conda activate $HOME\miniconda\envs\marvelNote: If your conda installation is not under
~/miniconda/(common:~/miniconda3/), either:
- edit
scripts/setup/setup_conda_env.pyto point at your preferred env directory, or- use Option B below.
This avoids hard-coding an env path:
Linux
conda env create -f environments/environment.yml -n marvel
conda activate marvelmacOS
conda env create -f environments/environment_mac.yml -n marvel
conda activate marvelWindows
conda env create -f environments\environment_windows.yml -n marvel
conda activate marvelMARVEL uses LangChain’s Ollama integration. You need:
- Ollama installed and running
- The model weights pulled locally
config/models.yamlpointing to those model names
Install Ollama for your OS using the official installer (macOS, Linux, Windows). After install, confirm:
ollama --version
ollama serveOn many systems Ollama runs as a background service automatically;
ollama serveis only needed if it is not already running.
Your config/models.yaml indicates:
primary_llm_model: gemma3:27b-it-qat
secondary_llm_model: qwen2.5:latest
tertiary_llm_model: mistral-nemo:latestPull them once:
ollama pull gemma3:27b-it-qat
ollama pull qwen2.5:latest
ollama pull mistral-nemo:latestMARVEL reads the Ollama server URL from config/server.yaml (typically http://localhost:11434). If you run Ollama elsewhere, update that value.
If you want cloud inference (instead of / in addition to Ollama):
- Create a Groq account at groq.com
- Generate an API key in your Groq dashboard
- Add it to
config/retrieval.yaml
In config/retrieval.yaml, set:
GROQ_API_KEY: "YOUR_GROQ_API_KEY"
enable_groq_inference_for_public_docs: trueIn
marvel.py, the app exportsGROQ_API_KEYinto the environment at runtime, based on the value inconfig/retrieval.yaml.
To enable web search:
- Create an account at tavily.com
- Generate an API key
- Add it to
config/retrieval.yaml
In config/retrieval.yaml, set:
TAVILY_API_KEY: "YOUR_TAVILY_API_KEY"
enable_tavily_web_search: true(Exact flag names may vary by config version; the key point is that MARVEL’s Tavily retriever needs the API key.)
MARVEL stores your source documents under ./RAG_DataSets/<DatasetName>/ and stores the corresponding FAISS vector database under ./faiss/<DatasetName>/.
Which dataset is active is controlled by config/data.yaml:
datasets: "DocPDF" # or "LatexData", "TextData", "JSONLData", "ALL_V2", ...- If
./faiss/<DatasetName>/exists, MARVEL will load it. - If
./faiss/<DatasetName>/does not exist, MARVEL will create it by embedding the data found in./RAG_DataSets/<DatasetName>/.
If you add new files and want to regenerate embeddings, delete the persisted vector store folder first:
rm -rf ./faiss/<DatasetName>This deletion is only needed if you want to regenerate embeddings. If nothing new was added, do not delete.
In config/data.yaml you can choose the PDF extraction backend:
pdf_extraction_method: surya # or "tesseract"This value is used when building DocPDF vector stores.
MARVEL’s dataset selection is case‑sensitive (it is used to form folder paths like ./RAG_DataSets/<datasets>/).
Goal: ingest PDFs.
-
Put PDFs in:
./RAG_DataSets/DocPDF/ -
(Optional) delete the existing vectorstore to re-embed:
rm -rf ./faiss/DocPDF
-
Select the dataset in
config/data.yaml:datasets: "DocPDF"
-
Launch MARVEL (see below). If
./faiss/DocPDF/is missing, it will be created automatically.
Goal: ingest LaTeX sources (e.g., paper source trees / .tex content).
-
Put LaTeX source files or folders in:
./RAG_DataSets/LatexData/ -
(Optional) delete the existing vectorstore to re-embed:
rm -rf ./faiss/LatexData
-
Select the dataset in
config/data.yaml:datasets: "LatexData"
-
Launch MARVEL.
Goal: ingest plain text (notes, markdown, logs, etc).
-
Put text files in:
./RAG_DataSets/TextData/ -
(Optional) delete the existing vectorstore to re-embed:
rm -rf ./faiss/TextData
-
Select the dataset in
config/data.yaml:datasets: "TextData"
-
Launch MARVEL.
Goal: ingest JSONL corpora (one JSON object per line).
-
Put
.jsonlfiles in:./RAG_DataSets/JSONLData/ -
(Optional) delete the existing vectorstore to re-embed:
rm -rf ./faiss/JSONLData
-
Select the dataset in
config/data.yaml:datasets: "JSONLData"
-
Launch MARVEL.
If your JSONL schema is custom, you may need to adapt the JSONL extractor in
libs/extractors.py.
If you want to run RAG over multiple datasets at once (e.g., PDFs + LaTeX + text + JSONL), MARVEL provides a combined store:
datasets: "ALL_V2"When datasets: "ALL_V2", MARVEL will merge existing FAISS vectorstores listed in config/data.yaml under faiss_vector_store_merges, and then persist the merged store to:
./faiss/ALL_V2/
-
Make sure each underlying store exists (build them once):
./faiss/DocPDF/./faiss/LatexData/./faiss/TextData/./faiss/JSONLData/- (and any other datasets you include)
-
Configure the merge list in
config/data.yaml:datasets: "ALL_V2" faiss_vector_store_merges: - TextData - DocPDF - LatexData - JSONLData # - AudioTextData # include if you use it
-
If you want to regenerate the merged store, delete it first:
rm -rf ./faiss/ALL_V2
-
Launch MARVEL. The merged store will be created and saved.
To add a new input type (e.g., DocText, CSVData, etc.):
-
Create a folder:
./RAG_DataSets/<NewDataSetName>/ -
Implement an extractor in
libs/extractors.py(convert files → LangChainDocuments). -
Add a new branch in
marvel.pywhere datasets are handled (search forRAG_DataSet_directoryand theelif os.path.normpath(...)chain). -
Add the dataset name to
config/data.yaml:vec_store_options- and (optionally)
faiss_vector_store_mergesif you want it included inALL_V2.
If you want to reproduce or inspect the benchmark results, MARVEL includes per‑sample RAGAS metrics and the corresponding QA examples + model answers under:
scripts/evaluation/datasets/(seescripts/evaluation/datasets/README.mdfor full details)
All evaluation files are newline‑delimited JSON (.jsonl) with one JSON object per line (UTF‑8). Each
record includes the QA sample (question, context, reference/ground‑truth answer), the baseline model answer(s),
MARVEL answer(s), and RAGAS metrics (typically floats in [0, 1]; higher is better). Some metric values may be
null if they could not be computed.
Full sets (Baseline vs MARVEL‑Standard)
eval_ArxivData_gpt4o-mini_vs_MARVEL-Standard.jsonl— N = 910 (ArXiv‑derived set; in this repo the same corpus is typically referred to asLatexData)eval_LogbookData_gpt4o-mini_vs_MARVEL-Standard.jsonl— N = 696
DeepSearch subset (Baseline vs MARVEL‑Standard vs MARVEL‑DeepSearch)
eval_ArxivData_gpt4o-mini_vs_MARVEL-Standard_vs_MARVEL-DeepSearch.jsonl— N = 168eval_LogbookData_gpt4o-mini_vs_MARVEL-Standard_vs_MARVEL-DeepSearch.jsonl— N = 135
import pandas as pd
df = pd.read_json(
"scripts/evaluation/datasets/eval_ArxivData_gpt4o-mini_vs_MARVEL-Standard.jsonl",
lines=True
)
print(df.columns)From the repository root (with the conda environment activated):
streamlit run marvel.pyFor fast access, LLMs and vector databases are loaded and kept in Streamlit session state.
Typical loop:
- Launch the service.
- Edit code in your editor.
- Refresh the Streamlit webpage to re-run the app.
If you change
config/data.yaml(e.g., switch datasets) or you delete/rebuild FAISS folders, you may need to restart Streamlit (or clear the session) to force re-loading the vectorstore.