How snap-stanford/memorilla works
Memorilla trains a question-conditioned memory module that compresses document embeddings into a fixed set of tokens for a frozen LLM. Its main use path loads a collection and question, encodes them, reads memory tokens, and generates an answer; separate training and benchmark workflows prepare data, train the module, and score results. The repository also includes PersonalizationV4 data generation, TextWorld reinforcement-learning tools, and memory-cache profiling. Some of these are represented by directory-level nodes because their source was not sampled; their internal call relationships are therefore not asserted.
Main entry points: vllm.py Inference wrapper · data.py Dataset access · memory.py Memory module · evaluate.py Benchmark runner
Components 22
Memory and inference
- Inference wrapper
memorilla/vllm.py - Embedding encoder
memorilla/embeddings.py - Memory module
memorilla/memory.py - Memory cache
memorilla/memory.py - Training wrapper
memorilla/llm.py
Training and data
- Training entrypoint
train.py - Dataset access
memorilla/data.py - Embedding store
memorilla/embeddings.py - Data paths
memorilla/paths.py
Evaluation
- Benchmark runner
evaluate.py - Baseline runner
evaluate_baselines.py - Benchmark protocols
memorilla/benchmarks.py - Scoring
memorilla/metrics.py
Data generation and tools
- PersonalizationV4 generation
personalizationv4/generate.py - Generation prompts
personalizationv4/prompts.py - Personalization dataset build
personalizationv4/build_dataset.py - TextWorld RL tools
rl - Memory profiling
profiling/run.py - FP8 cache profiling
profiling/fp8_cache.py
Other components
- User
- Benchmark data
- Frozen LLM
Connections 25
- User → Inference wrapper: asks question
README.md - Inference wrapper → Embedding encoder: encodes text
memorilla/vllm.py - Inference wrapper → Memory module: reads memory
memorilla/vllm.py - Inference wrapper → Frozen LLM: generates answer
README.md - Inference wrapper → Memory cache: writes collection
README.md - Training entrypoint → Dataset access: prepares batches
train.py - Training entrypoint → Embedding store: loads embeddings
train.py - Training entrypoint → Training wrapper: trains through
train.py - Training wrapper → Memory module: computes tokens
memorilla/llm.py - Training wrapper → Frozen LLM: runs decoder
memorilla/llm.py - Dataset access → Data paths: resolves data
memorilla/data.py - Embedding store → Data paths: uses data root
memorilla/embeddings.py - Benchmark runner → Dataset access: loads examples
evaluate.py - Benchmark runner → Inference wrapper: runs inference
evaluate.py - Benchmark runner → Benchmark protocols: selects protocol
evaluate.py - Benchmark runner → Scoring: scores results
evaluate.py - Baseline runner → Dataset access: loads examples
evaluate_baselines.py - Baseline runner → Benchmark protocols: uses protocol
evaluate_baselines.py - Baseline runner → Scoring: scores results
evaluate_baselines.py - Benchmark data → Dataset access: supplies splits
README.md - PersonalizationV4 generation → Generation prompts: uses prompts
personalizationv4/generate.py - Personalization dataset build → PersonalizationV4 generation: uses generation
personalizationv4/build_dataset.py - Memory profiling → Memory module: profiles module
profiling/run.py - FP8 cache profiling → Memory module: profiles cache
profiling/fp8_cache.py - TextWorld RL tools → Memory module: uses memory
rl/export_memory.py