How litllm/litllms-for-literature-review-tmlr works
Project Type and Purpose
• This is a full-stack research toolkit (“LitLLMs”) for automated literature review, decomposed into two main subsystems:
a. Retrieval: Given a paper abstract, extract keywords, search and re‐rank relevant papers.
b. Generation: Plan and generate the narrative literature review using LLMs.
• The README confirms a two‐step workflow (retrieve then generate) plus evaluation and interface components.
File Structure
• Top‐level directories:
• generation/: generation subsystem—including data creation, model wrappers, evaluation, interface, and notebooks.
• retrieval/: retrieval subsystem—including data ingestion, FAISS indexing, reranking, paper management, and utilities.
• Each subsystem has its own README, requirements, scripts, and tests.
• Supporting components: shell_scripts/, tests/, notebooks/, setup scripts.
• Configuration & resources: JSON prompt files, token configs, model configs.
• Interface: gradio_app.py under generation/interface providing a simple UI.
README Insights
• Describes retrieval (two‐step keyword + search + re‐rank) and generation (plan‐based + step execution).
• Mentions evaluation protocols, human‐in‐the‐loop app (generation/eval/human_eval).
• Lists external dependencies: arXiv API, FAISS, LLM endpoints (OpenAI, Llama2 via Anyscale or local).
Components
a. Main Components
1. User Interface
• Gradio front‐end (generation/interface).
2. Retrieval Service
• Keyword Extraction (LLM agent)
• Vector Index Search (FAISS indexer)
• External API Search (e.g., SerpAPI)
• Re‐Ranking Module (LLM reranker)
• Data Sources (arXiv scraper, local HF datasets)
3. Generation Service
• Plan Generator (LLM wrapper)
• Review Generator (LLM pipeline)
• Model Orchestration (chatGPT, Llama2, custom pipelines)
4. Storage & Data
• Raw data (S2ORC, arXiv metadata)
• Processed dataset (HuggingFace)
• FAISS indices
• Prompt & config resources (JSON files)
5. Evaluation
• Automatic metrics (ROUGE, ELO, word‐count)
• Human‐in‐the‐loop app (Flask/Streamlit under generation/eval/human_eval)
6. Orchestration & Scripts
• Shell scripts to finetune or zero‐shot run models
• Setup scripts and requirements files
7. External Services
• OpenAI/Anyscale endpoints
• arXiv API
• SerpAPI (if used)
b. Relationships & Interactions
• User → UI (Gradio) → calls Retrieval Service and Generation Service via Python functions/APIs.
• Retrieval Service:
• Sends abstract to LLM Keyword Extractor.
• Uses keywords to query FAISS index and/or external search API.
• Passes candidates to LLM Reranker.
• Outputs ranked paper list.
• Generation Service:
• Accepts ranked papers + abstract.
• Calls Plan Generator LLM → receives outline.
• Feeds outline to Review Generator LLM → produces final review text.
• Evaluation:
• Takes outputs + ground truth → computes metrics.
• Human eval app fetches model outputs for annotation.
• Data flows back into stored datasets or indices.
c. Architectural Patterns & Principles
• Modular pipeline design: clear separation of retrieval vs generation.
• Adapter pattern for different LLM endpoints (base_model, chatgpt_model, llama2_*, anyscale_endpoint).
• Data layer abstraction: FAISS index, HF dataset, JSON configs.
• Reusable utilities: toolkit_utils, data_utils, ml_utils shared across subsystems.
• Microservice‐like separation: each top‑level module can run independently with its own requirements.
d. Technologies & Frameworks
• Python 3, HuggingFace datasets, FAISS, LangChain, vLLM.
• LLMs: OpenAI ChatGPT, Llama2 (zero‐shot & finetuning via flash), AnyScale endpoints.
• Web UI: Gradio.
• Evaluation: Flask/Streamlit app in human_eval.
• Shell/Bash for orchestration, Jupyter notebooks for exploration.
Final Recommendations
• Two‐step decomposition at the highest level, then expand each step.
• Don’t overcomplicate; aim for clarity. More components = better granularity.