How dj-22/csd358-hackathon works
BridgeHop is a multi-hop retrieval system for HotpotQA paragraphs. Its principal workflow parses a question, retrieves first-hop documents, derives and ranks bridge entities (or comparison slots), searches a second hop, scores reasoning chains, and returns ranked documents with a trace. The graph also preserves the documented single-shot, pseudo-relevance-feedback, sparse/dense, and result-fusion capabilities. Pipeline calls are visible in agent/pipeline.py; other relationships rely on README statements. Unread source is represented only where documented, so some internal wiring is omitted.
Main entry points: demo.py Demo interface · parser.py Question parser · bridge.py Bridge candidates · hop2.py Second-hop retrieval
Components 21
Question entry
- Demo interface
demo.py - Ranked results and trace
demo.py
Index and retrieval
- Index builder
index/build_index.py - Positional index
index/inverted_index.py - Boolean retrieval
retrieval/boolean.py - BM25 retrieval
retrieval/bm25.py - Cosine retrieval
retrieval/cosine.py - Pseudo-feedback
retrieval/prf.py - Dense embeddings
index/embed.py
Multi-hop reasoning
- Question parser
agent/parser.py - Research state
agent/state.py - Bridge candidates
agent/bridge.py - Entity linking
agent/entities.py - Learned bridge ranker
agent/bridge_ranker.py - Ranker features
agent/features.py - Second-hop retrieval
agent/hop2.py
Ranking and output
- Chain scoring
agent/chains.py - List fusion
agent/fusion.py
Resources
- Loaded resources
agent/resources.py
Other components
- Questioner
- MiniLM encoder
Connections 22
- Questioner → Demo interface: asks
demo.py - Demo interface → Question parser: runs system
- Question parser → Research state: initializes
agent/pipeline.py - Question parser → Positional index: analyzes terms
README.md - Index builder → Positional index: builds
README.md - Question parser → Boolean retrieval: filters hop one
README.md - Question parser → BM25 retrieval: retrieves hop one
agent/pipeline.py - Question parser → Cosine retrieval: scores baseline
agent/pipeline.py - Demo interface → Pseudo-feedback: optionally expands
- Demo interface → Bridge candidates: selects bridges
- Bridge candidates → Entity linking: uses linked entities
- Bridge candidates → Learned bridge ranker: optionally ranks
agent/pipeline.py - Learned bridge ranker → Ranker features: scores features
- Demo interface → Second-hop retrieval: retrieves second hop
demo.py - Second-hop retrieval → BM25 retrieval: uses sparse scoring
README.md - Second-hop retrieval → Dense embeddings: uses dense scoring
README.md - Dense embeddings → MiniLM encoder: encodes text
index/embed.py - Demo interface → Chain scoring: scores chains
- Chain scoring → List fusion: supports list fusion
- Demo interface → Loaded resources: loads resources
demo.py - Loaded resources → Positional index: provides index
- Demo interface → Ranked results and trace: returns and traces
README.md