maniscope 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wen G. Gong, Albert Gong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,497 @@
1
+ Metadata-Version: 2.4
2
+ Name: maniscope
3
+ Version: 1.1.0
4
+ Summary: Efficient neural reranking via geodesic distances on k-NN manifolds
5
+ Home-page: https://github.com/digital-duck/maniscope
6
+ Author: Wen G. Gong, Albert Gong
7
+ Author-email: "Wen G. Gong" <wen.gong.research@gmail.com>, Albert Gong <ag2435@cornell.edu>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://github.com/digital-duck/maniscope
10
+ Project-URL: Documentation, https://maniscope.readthedocs.io
11
+ Project-URL: Repository, https://github.com/digital-duck/maniscope.git
12
+ Project-URL: Bug Tracker, https://github.com/digital-duck/maniscope/issues
13
+ Keywords: information-retrieval,reranking,manifold-learning,geodesic-distance,neural-search,rag
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Text Processing :: Indexing
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.21.0
28
+ Requires-Dist: networkx>=2.6.0
29
+ Requires-Dist: scikit-learn>=1.0.0
30
+ Requires-Dist: sentence-transformers>=2.2.0
31
+ Requires-Dist: torch>=1.10.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
35
+ Requires-Dist: black>=22.0.0; extra == "dev"
36
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
37
+ Requires-Dist: mypy>=0.950; extra == "dev"
38
+ Dynamic: author
39
+ Dynamic: home-page
40
+ Dynamic: license-file
41
+ Dynamic: requires-python
42
+
43
+ # Maniscope: A Novel RAG Reranker via Geodesic Distances on k-NN Manifolds
44
+
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
46
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
47
+
48
+ **Maniscope** is a lightweight geometric reranking method that leverages geodesic distances on k-nearest neighbor manifolds for efficient and accurate information retrieval. It combines global cosine similarity (telescope) with local manifold geometry (microscope) to achieve state-of-the-art retrieval quality with sub-20ms latency.
49
+
50
+
51
+
52
+ ## Key Features
53
+
54
+ - **🚀 Ultra-Fast**: 3.2× faster than HNSW, 10-45× faster than cross-encoder rerankers, sub-10ms latency
55
+ - **🎯 Accurate**: MRR 0.9642 on 8 BEIR benchmarks (1,233 queries), within 2% of best cross-encoder
56
+ - **💡 Efficient**: 4.7ms average latency, outperforms HNSW on hardest datasets (NFCorpus: +7.0%, TREC-COVID: +1.6%, AorB: +2.8% NDCG@3)
57
+ - **🌍 Practical**: Achieves near-theoretical-maximum accuracy (within 1.8% of LLM-Reranker) at 420× faster speed
58
+ - **📊 Robust**: Handles disconnected graph components gracefully via hybrid scoring, CUDA error resilience with CPU fallback
59
+ - **🔧 Comprehensive**: 14 priority-ranked embedding models, 32+ validated LLM models, 5 reranker types, custom dataset support
60
+ - **💾 Smart Caching**: GPU acceleration with automatic CPU fallback, persistent embedding cache, environment variable controls
61
+ - **📱 Interactive**: Full-featured Streamlit app with enhanced data management, real-time benchmarking, and end-to-end RAG evaluation
62
+ - **🛡️ Production-Ready**: Robust error handling, automatic fallback mechanisms, comprehensive troubleshooting support
63
+
64
+ ## Demo
65
+
66
+ Real-world benchmark on AorB dataset (10 queries, warm cache):
67
+
68
+ ![Benchmark Results](./docs/batch-benchmark-warm-2026-01-24-08-27-41.png)
69
+
70
+ **Highlights:**
71
+ - ✅ **Maniscope: 8.2ms** - Fastest reranker with perfect accuracy (MRR=1.0)
72
+ - ✅ **13× faster than Jina v2** (177.7ms), **134× faster than BGE-M3** (1100.2ms), **273× faster than LLM** (2235.9ms)
73
+ - ✅ **All methods achieve perfect rankings** (MRR=1.0, NDCG@3=1.0) - Maniscope matches SOTA accuracy at fraction of latency
74
+
75
+
76
+ ## Quick Start
77
+
78
+ ### Installation
79
+
80
+ ```bash
81
+ conda create -n maniscope python=3.11 -y
82
+ conda activate maniscope
83
+ ```
84
+
85
+ Install from source:
86
+
87
+ ```bash
88
+ git clone https://github.com/digital-duck/maniscope.git
89
+ cd maniscope
90
+ pip install -e .
91
+ ```
92
+
93
+ ```bash
94
+ pip install maniscope # coming soon
95
+ ```
96
+
97
+ **Optional: GPU Troubleshooting Setup**
98
+
99
+ If you encounter CUDA errors, set up CPU fallback:
100
+
101
+ ```bash
102
+ # For persistent CUDA issues, force CPU mode
103
+ export MANISCOPE_FORCE_CPU=true
104
+
105
+ # Or add to your ~/.bashrc or ~/.zshrc for permanent setting
106
+ echo 'export MANISCOPE_FORCE_CPU=true' >> ~/.bashrc
107
+ ```
108
+
109
+
110
+ ### Option 1: Streamlit App (Recommended)
111
+
112
+ Launch the Streamlit evaluation interface to benchmark and visualize results:
113
+
114
+ ```bash
115
+
116
+ # Launch the app
117
+ streamlit run ui/Maniscope.py
118
+
119
+ # or
120
+ python run_app.py
121
+ ```
122
+
123
+ The app provides:
124
+ - 📊 **Benchmark Suite**: 8 BEIR datasets + custom dataset support (PDF import, MTEB format)
125
+ - ⚡ **Multi-Model Support**: 14 embedding models (priority-ranked), 32+ validated LLM models, 5 reranker types
126
+ - 📈 **Analytics Dashboard**: MRR, NDCG@K, MAP, latency analysis with real-time comparison charts
127
+ - 🎯 **RAG Evaluation**: End-to-end RAG pipeline testing with LLM answer generation and scoring
128
+ - 🔬 **Query-Level Analysis**: Deep-dive evaluation with document inspection and ranking comparison
129
+ - 💾 **Enhanced Data Manager**: Upload datasets, import PDFs, view/manage existing custom datasets with one-click loading
130
+ - ⚙️ **Smart Configuration**: Priority-based model selection, parameter tuning, detailed model metadata, optimization levels
131
+ - 🔄 **Dataset Switching**: Toggle between BEIR benchmarks and custom datasets with smart terminology (PDF imports vs standard datasets)
132
+ - 💡 **Robust Computing**: Automatic GPU/CPU detection with fallback, persistent embedding cache, CUDA error handling
133
+ - 🎚️ **Advanced Controls**: Environment variable support (`MANISCOPE_FORCE_CPU`), reduced logging verbosity, session state management
134
+
135
+ ### Option 2: Python API
136
+
137
+ ```python
138
+ from maniscope import ManiscopeEngine_v2o
139
+
140
+ # Initialize engine (v2o: Ultimate optimization - 13.2× speedup)
141
+ engine = ManiscopeEngine_v2o(
142
+ model_name='all-MiniLM-L6-v2', # Priority 0: fastest (22M params)
143
+ # Alternative models:
144
+ # model_name='Qwen/Qwen3-Embedding-0.6B', # Priority 2: SOTA 2025
145
+ # model_name='google/embeddinggemma-300m', # Priority 2: Google's latest
146
+ # model_name='BAAI/bge-m3', # Priority 4: multi-functionality
147
+ k=5, # Number of nearest neighbors
148
+ alpha=0.5, # Hybrid scoring weight
149
+ device=None, # Auto-detect GPU with CPU fallback
150
+ use_cache=True, # Enable persistent disk cache
151
+ verbose=True
152
+ )
153
+
154
+ # Fit on document corpus
155
+ documents = [
156
+ "Python is a programming language",
157
+ "Python is a type of snake",
158
+ "Machine learning uses Python",
159
+ # ... more documents
160
+ ]
161
+ engine.fit(documents)
162
+
163
+ # Search with Maniscope (telescope + microscope)
164
+ results = engine.search("What is Python?", top_n=5)
165
+ for doc, score, idx in results:
166
+ print(f"[{score:.3f}] {doc}")
167
+
168
+ # Compare with baseline cosine similarity
169
+ comparison = engine.compare_methods("What is Python?", top_n=5)
170
+ print(f"Ranking changed: {comparison['ranking_changed']}")
171
+ ```
172
+
173
+ ## How It Works
174
+
175
+ Maniscope uses a two-stage retrieval architecture:
176
+
177
+ ### 1. **Telescope** (Global Retrieval)
178
+ Broad retrieval using cosine similarity to get top candidates
179
+
180
+ ### 2. **Microscope** (Local Refinement)
181
+ Geodesic reranking on k-NN manifold graph:
182
+ - Build k-nearest neighbor graph from document embeddings
183
+ - Compute geodesic distances on this manifold
184
+ - Hybrid scoring: `α × cosine + (1-α) × geodesic`
185
+
186
+ **Key Insight**: Local manifold structure captures semantic relationships better than global Euclidean distances.
187
+
188
+ ## Supported Models & Components
189
+
190
+ ### 📊 Embedding Models (14 Total)
191
+
192
+ Maniscope supports comprehensive embedding models from lightweight to SOTA, organized by priority:
193
+
194
+ | Priority | Category | Models | Description |
195
+ |----------|----------|--------|-------------|
196
+ | **⚡ 0** | **Fastest** | all-MiniLM-L6-v2 | 22M params, lightning-fast inference |
197
+ | **🌍 1** | **Multilingual** | Sentence-BERT, LaBSE, E5-Instruct | 50-109 languages, production-ready |
198
+ | **🚀 2** | **SOTA 2025** | Qwen3-0.6B, EmbeddingGemma-300M, E5-Base-v2 | Current state-of-the-art models |
199
+ | **🔬 3** | **Research** | mBERT, DistilBERT, XLM-RoBERTa | Specialized research baselines |
200
+ | **💎 4** | **Advanced** | E5-Large, BGE-M3 | 560M+ params, maximum accuracy |
201
+
202
+ **Key Models:**
203
+ - `all-MiniLM-L6-v2` (22M) - Default, fastest
204
+ - `Qwen/Qwen3-Embedding-0.6B` (600M) - MTEB #1 series
205
+ - `google/embeddinggemma-300m` (300M) - Google's latest
206
+ - `BAAI/bge-m3` (568M) - Multi-functionality leader
207
+ - `sentence-transformers/paraphrase-multilingual-mpnet-base-v2` (278M) - Proven baseline
208
+
209
+ ### 🤖 LLM Models (32+ Total)
210
+
211
+ **OpenRouter Models** (Validated & Sorted):
212
+ - **Anthropic**: Claude 3/3.5 (Haiku, Sonnet, Opus)
213
+ - **OpenAI**: GPT-3.5-turbo, GPT-4, GPT-4o, GPT-4o-mini
214
+ - **Google**: Gemini 2.0 Flash, Gemini Flash/Pro 1.5
215
+ - **Meta**: Llama 3.1/3.2 (8B, 70B), with free tier options
216
+ - **Others**: Cohere Command-R, DeepSeek, Mistral, Qwen 2.5, Perplexity
217
+
218
+ **Ollama Models** (Local):
219
+ - `llama3.1:latest`, `deepseek-r1:7b`, `qwen2.5:latest`
220
+
221
+ ### 🔧 Rerankers
222
+
223
+ | Reranker | Type | Latency | Accuracy | Best For |
224
+ |----------|------|---------|----------|----------|
225
+ | **Maniscope v2o** | Geometric | **4.7ms** | MRR 0.964 | Production RAG |
226
+ | **HNSW** | Graph-based | 14.8ms | MRR 0.965 | Large-scale search |
227
+ | **Jina Reranker v2** | Cross-encoder | 47ms | MRR 0.975 | High accuracy |
228
+ | **BGE-M3** | Cross-encoder | 210ms | MRR 0.963 | Multilingual |
229
+ | **LLM Reranker** | Generative | 4400ms | MRR 0.978 | Research/upper bound |
230
+
231
+ ### 📚 Datasets
232
+
233
+ **Built-in BEIR Benchmarks** (8 datasets, 1,233 queries):
234
+
235
+ | Dataset | Queries | Domain | Difficulty | Maniscope vs HNSW |
236
+ |---------|---------|--------|------------|-------------------|
237
+ | **NFCorpus** | 323 | Medical | Hard | **+7.0% NDCG@3** ✅ |
238
+ | **TREC-COVID** | 50 | Biomedical | Hard | **+1.6% NDCG@3** ✅ |
239
+ | **AorB** | 50 | Disambiguation | Hard | **+2.8% NDCG@3** ✅ |
240
+ | **SciFact** | 100 | Scientific | Medium | -0.5% NDCG@3 |
241
+ | **FiQA** | 100 | Financial | Medium | Tied |
242
+ | **MS MARCO** | 200 | Web Search | Easy | Tied |
243
+ | **ArguAna** | 100 | Argumentation | Easy | -0.6% NDCG@3 |
244
+ | **FEVER** | 200 | Fact Checking | Easy | Tied |
245
+
246
+ **Custom Dataset Support:**
247
+ - **📁 MTEB Format**: Upload JSON datasets with query/docs/relevance structure
248
+ - **📄 PDF Import**: Convert research papers to searchable datasets
249
+ - Section-based chunking with overlap
250
+ - Figure/table caption extraction
251
+ - Custom query mode (no ground truth required)
252
+ - **🔧 File Detection**: Auto-detect datasets in `data/custom/` directory
253
+
254
+ **Dataset Formats Supported:**
255
+ ```json
256
+ // MTEB Format
257
+ [{
258
+ "query": "search query",
259
+ "docs": ["doc1", "doc2", "..."],
260
+ "relevance_map": {"0": 1, "1": 0, "...": 0},
261
+ "query_id": "q1",
262
+ "num_docs": 10
263
+ }]
264
+
265
+ // PDF Import Result
266
+ [{
267
+ "query": "", // Empty for custom query mode
268
+ "docs": ["## Section 1\n\nContent...", "## Section 2\n\n..."],
269
+ "relevance_map": {},
270
+ "metadata": {
271
+ "source": "pdf_import",
272
+ "pdf_filename": "paper.pdf",
273
+ "num_chunks": 75
274
+ }
275
+ }]
276
+ ```
277
+
278
+ Each dataset includes quick test versions (`*-10.json`) with 10 queries for rapid prototyping.
279
+
280
+ ## Data Management Features
281
+
282
+ ### Enhanced Data Manager Interface
283
+
284
+ The Data Manager provides comprehensive dataset management capabilities:
285
+
286
+ **📂 Custom Dataset Management:**
287
+ - **View Existing Datasets**: Auto-detection of all custom datasets from `data/custom/` directory
288
+ - **One-Click Loading**: Load any dataset directly into evaluation interface
289
+ - **Rich Metadata Display**: View dataset details, number of queries, documents, and processing info
290
+ - **Smart Detection**: Automatically detects MTEB format vs PDF imports with appropriate terminology
291
+
292
+ **📄 PDF Processing:**
293
+ - **Intelligent Chunking**: Section-based chunking with configurable overlap
294
+ - **Content Extraction**: Figure/table captions, metadata preservation
295
+ - **Error Resilience**: Robust error handling with detailed logging
296
+ - **Auto-JSON Export**: Converts PDFs to MTEB-compatible JSON format
297
+
298
+ **🔄 Dataset Switching:**
299
+ - **Toggle Interface**: Checkbox to switch between BEIR benchmarks and custom datasets
300
+ - **Context-Aware Display**: Different UI terminology for PDF imports (1 dataset, many documents) vs standard datasets (many queries)
301
+ - **Session Persistence**: Maintains dataset selection across app sessions
302
+
303
+
304
+
305
+ ## Advanced Configuration & Troubleshooting
306
+
307
+ ### GPU/CPU Optimization
308
+
309
+ Maniscope automatically detects and uses GPU when available, with intelligent fallback to CPU:
310
+
311
+ ```python
312
+ # Automatic GPU detection with CPU fallback
313
+ engine = ManiscopeEngine_v2o(
314
+ model_name='all-MiniLM-L6-v2',
315
+ device=None, # Auto-detect: GPU if available, else CPU
316
+ use_faiss=True # Enable GPU-accelerated k-NN when possible
317
+ )
318
+
319
+ # Force CPU mode (if CUDA issues persist)
320
+ import os
321
+ os.environ['MANISCOPE_FORCE_CPU'] = 'true'
322
+ # Or set environment variable: export MANISCOPE_FORCE_CPU=true
323
+ ```
324
+
325
+ **CUDA Troubleshooting:**
326
+ - GPU memory errors automatically trigger CPU fallback
327
+ - Set `MANISCOPE_FORCE_CPU=true` environment variable for persistent CUDA issues
328
+ - Reduced docling logging verbosity for cleaner output during PDF processing
329
+
330
+ ### Optimization Versions
331
+
332
+ Maniscope provides multiple optimization levels for different use cases:
333
+
334
+ | Version | Description | Speedup | Best For |
335
+ |---------|-------------|---------|----------|
336
+ | **v0** | Baseline (CPU, no cache) | 1.0× | Reference |
337
+ | **v1** | Efficient k-NN construction | 17.8× | Early optimization |
338
+ | **v2** | Heap-based Dijkstra | 22.0× | Reduced overhead |
339
+ | **v2o** | 🌟 **RECOMMENDED** - SciPy optimized | **13.2×** | Production |
340
+ | **v3** | Persistent cache + query LRU | Variable | Repeated experiments |
341
+
342
+ **v2o Performance (Real-World Results on 8 BEIR datasets, 1,233 queries):**
343
+ - Average latency: 4.7ms (3.2× faster than HNSW at 14.8ms)
344
+ - Outperforms HNSW on hardest datasets (NFCorpus, TREC-COVID, AorB)
345
+ - 10-45× faster than cross-encoder rerankers
346
+ - Within 2% of best cross-encoder accuracy (Jina v2)
347
+
348
+ #### Using Optimized Versions
349
+
350
+ ```python
351
+ # v2o: Ultimate optimization (recommended)
352
+ from maniscope import ManiscopeEngine_v2o
353
+ engine = ManiscopeEngine_v2o(
354
+ k=5, alpha=0.5,
355
+ device=None, # Auto-detect GPU
356
+ use_cache=True, # Persistent disk cache
357
+ use_faiss=True # GPU-accelerated k-NN
358
+ )
359
+
360
+ # v3: CPU-friendly with caching
361
+ from maniscope import ManiscopeEngine_v3
362
+ engine = ManiscopeEngine_v3(k=5, alpha=0.5, use_cache=True)
363
+
364
+ # v2: Fast cold-cache performance
365
+ from maniscope import ManiscopeEngine_v2
366
+ engine = ManiscopeEngine_v2(k=5, alpha=0.5, use_faiss=True)
367
+
368
+ # v1: Simple GPU acceleration
369
+ from maniscope import ManiscopeEngine_v1
370
+ engine = ManiscopeEngine_v1(k=5, alpha=0.5)
371
+
372
+ # v0: Baseline
373
+ from maniscope import ManiscopeEngine
374
+ engine = ManiscopeEngine(k=5, alpha=0.5)
375
+ ```
376
+
377
+
378
+ ### Embedding Cache
379
+
380
+ Maniscope automatically caches document embeddings to disk to avoid recomputation. This is especially valuable when:
381
+ - Testing different `k` and `alpha` parameters on the same corpus
382
+ - Re-running experiments after code changes
383
+ - Benchmarking multiple rerankers on the same dataset
384
+
385
+ ```python
386
+ engine = ManiscopeEngine_v2o(
387
+ model_name='all-MiniLM-L6-v2',
388
+ k=5,
389
+ alpha=0.5,
390
+ cache_dir='~/projects/embedding_cache/maniscope', # Custom cache location
391
+ use_cache=True, # Enable persistent disk cache
392
+ query_cache_size=100 # LRU cache for 100 queries
393
+ )
394
+ ```
395
+
396
+ **Cache behavior:**
397
+ - Cache files are stored in `cache_dir` (default: `~/projects/embedding_cache/maniscope`)
398
+ - Cache key is computed from document content + model name
399
+ - Embeddings are automatically loaded from cache if available
400
+ - Query LRU cache stores recent query embeddings in memory
401
+
402
+ **Benefits:**
403
+ - Avoid expensive re-encoding when testing different parameters
404
+ - Faster iteration during development
405
+ - Reduced computation time for batch benchmarking
406
+ - Query cache provides instant response for repeated queries
407
+
408
+ ## Evaluation & Analytics
409
+
410
+ ### Comprehensive RAG Evaluation
411
+
412
+ Maniscope provides end-to-end RAG pipeline evaluation with detailed analytics:
413
+
414
+ **📊 Retrieval Metrics**
415
+ - **MRR (Mean Reciprocal Rank)**: Primary ranking quality metric
416
+ - **NDCG@K (Normalized Discounted Cumulative Gain)**: Ranking quality with position weighting
417
+ - **MAP (Mean Average Precision)**: Precision across all relevant documents
418
+ - **Latency Analysis**: Real-time performance measurement with percentile statistics
419
+
420
+ **🎯 RAG Pipeline Evaluation**
421
+ - **Answer Generation**: LLM-powered answer generation from retrieved documents
422
+ - **Answer Quality Scoring**: Automated scoring using configurable LLM models
423
+ - **Query-Level Analysis**: Detailed per-query breakdown with document ranking comparison
424
+ - **Method Comparison**: Side-by-side comparison of multiple rerankers
425
+
426
+ **📈 Real-Time Analytics**
427
+ - **Performance Dashboard**: Live charts showing MRR, NDCG, and latency trends
428
+ - **Model Comparison**: Benchmark multiple embedding models, rerankers, and LLMs
429
+ - **Interactive Filtering**: Filter results by dataset, model, or performance thresholds
430
+ - **Export Capabilities**: Save results for further analysis and reporting
431
+
432
+
433
+ ## Troubleshooting
434
+
435
+ ### Common Issues and Solutions
436
+
437
+ **🔧 CUDA/GPU Errors**
438
+ ```bash
439
+ # Error: CUDA launch failure or GPU memory issues
440
+ # Solution: Enable CPU fallback mode
441
+ export MANISCOPE_FORCE_CPU=true
442
+ streamlit run ui/Maniscope.py
443
+ ```
444
+
445
+ **📄 PDF Processing Fails**
446
+ ```bash
447
+ # Error: "Object of type method is not JSON serializable"
448
+ # Solution: Ensure complete dataset JSON files
449
+ # Check data/custom/*.json for proper formatting with closing braces
450
+ ```
451
+
452
+ **📂 Custom Datasets Not Appearing**
453
+ - Ensure datasets are in `data/custom/` directory
454
+ - Use the checkbox "📂 Use Custom Dataset" in Eval ReRanker page
455
+ - Verify JSON format matches MTEB structure
456
+
457
+ **⚡ Model Loading Issues**
458
+ ```python
459
+ # Error: Model not found or authentication issues
460
+ # Solution: Check model availability and API keys
461
+ # OpenRouter models require OPENROUTER_API_KEY
462
+ # Ollama models require local ollama installation
463
+ ```
464
+
465
+ **💾 Cache Issues**
466
+ ```bash
467
+ # Clear embedding cache if needed
468
+ rm -rf ~/projects/embedding_cache/maniscope
469
+ # Or use custom cache directory in engine initialization
470
+ ```
471
+
472
+ ## Cleanup (optional - after evaluation)
473
+
474
+ ```bash
475
+ conda env remove -n maniscope
476
+ ```
477
+
478
+ ## Citation
479
+
480
+ If you use Maniscope in your research, please cite:
481
+
482
+ ```bibtex
483
+ @inproceedings{gong2026maniscope,
484
+ title={A Novel RAG Reranker via Geodesic Distances on k-NN Manifolds},
485
+ author={Gong, Wen G.},
486
+ booktitle={International Conference on Machine Learning (ICML)},
487
+ year={2026}
488
+ }
489
+ ```
490
+
491
+ ## License
492
+
493
+ MIT License - see LICENSE file for details.
494
+
495
+ ---
496
+
497
+ **"Look closer to see farther"** — The Maniscope philosophy