Add V6 deployment guide: production-ready model, zero code changes needed
Browse files- DEPLOY_V6.md +72 -0
DEPLOY_V6.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deploying V6 Production Model
|
| 2 |
+
|
| 3 |
+
## Quick Deploy (zero code changes)
|
| 4 |
+
|
| 5 |
+
The V6 model uses the **exact same 37-feature schema** as your existing `app/recommend/reranker.py`. To deploy:
|
| 6 |
+
|
| 7 |
+
### Option 1: Replace the model file
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
# In your ResearchIT Space repo:
|
| 11 |
+
cp production_model/reranker_v6_production.txt models/reranker-phase6/production_model/reranker_v1.txt
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
The reranker code searches for `reranker_v1.txt` — replacing it with V6 makes it active immediately.
|
| 15 |
+
|
| 16 |
+
### Option 2: Add as a new path (safer)
|
| 17 |
+
|
| 18 |
+
In `app/recommend/reranker.py`, add V6 to the search paths (it's checked first):
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
_MODEL_SEARCH_PATHS = [
|
| 22 |
+
os.environ.get("RERANKER_MODEL_PATH", ""),
|
| 23 |
+
"models/reranker-phase6/production_model/reranker_v6_production.txt", # ← ADD THIS
|
| 24 |
+
"models/reranker-phase6/production_model/reranker_v1.txt",
|
| 25 |
+
"production_model/reranker_v1.txt",
|
| 26 |
+
...
|
| 27 |
+
]
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
### Option 3: Use environment variable
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
export RERANKER_MODEL_PATH="models/reranker-phase6/production_model/reranker_v6_production.txt"
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## What Changed (V1 → V6)
|
| 37 |
+
|
| 38 |
+
| Aspect | V1 | V6 |
|
| 39 |
+
|--------|-----|-----|
|
| 40 |
+
| Feature schema | 37 features | 37 features (identical) |
|
| 41 |
+
| Training labels | cited=2, co-cited=1, not=0 | 5-tier expert authority |
|
| 42 |
+
| Hard Neg AUC | ~0.63 | **0.758** (+20.7%) |
|
| 43 |
+
| Trees | 141 | 32 (faster inference) |
|
| 44 |
+
| Model size | 948 KB | 219 KB (77% smaller) |
|
| 45 |
+
| Latency | 0.37ms/100 candidates | ~0.2ms/100 candidates (fewer trees) |
|
| 46 |
+
|
| 47 |
+
## What This Means for Users
|
| 48 |
+
|
| 49 |
+
V6 will:
|
| 50 |
+
- Rank papers from the right field higher (category matching learned)
|
| 51 |
+
- Give recency a proper weight (not just citation count)
|
| 52 |
+
- Better balance between highly-cited classics and newer relevant work
|
| 53 |
+
- Suppress papers that experts consistently exclude from reading lists
|
| 54 |
+
|
| 55 |
+
## Verification
|
| 56 |
+
|
| 57 |
+
After deploying, check the health endpoint:
|
| 58 |
+
```
|
| 59 |
+
GET /healthz/reranker
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
Should return:
|
| 63 |
+
```json
|
| 64 |
+
{"model_loaded": true, "num_trees": 32, "num_features": 37}
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Rollback
|
| 68 |
+
|
| 69 |
+
If anything goes wrong, revert to V1:
|
| 70 |
+
```bash
|
| 71 |
+
export RERANKER_MODEL_PATH="models/reranker-phase6/production_model/reranker_v1.txt"
|
| 72 |
+
```
|