--- title: Feature Finder emoji: 🔍 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: "5.50.0" app_file: app.py pinned: false license: apache-2.0 hardware: h200 hf_oauth: false --- # Feature Finder Given a GitHub repo, surfaces a relevant recent arXiv paper for the team's next feature — paired with a PR-ready spec (summary, motivation, implementation plan, open questions) that a coding agent can pick up and run with. For personalized recommendations trained on your team's full reading history, [sign up at engine.remyx.ai](https://engine.remyx.ai). ## About the model The scoring model is a **LoRA adapter on Qwen3.5-2B**, distilled from a Pairwise Gaussian Process teacher trained on team-preference signals derived from GitHub merge histories. - **Base**: [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) - **Adapter**: [`remyxai/mhpd-dpo-qwen3.5-2b-lora-v1.2-ipo-2epoch`](https://huggingface.co/remyxai/mhpd-dpo-qwen3.5-2b-lora-v1.2-ipo-2epoch) (current production; v1.5 in development) - **Training objective**: IPO loss (β=0.1), bounded target gap that's more robust to noisy confident pairs than sigmoid DPO - **Training data**: 50K preference pairs (`chosen` / `rejected`) generated from real GitHub repo merge histories - **Eval**: candidate-disjoint repo-disjoint holdout — no paper appears in both train and eval — so accuracy reflects cross-repo generalization, not memorization ### Why a fine-tune vs zero-shot LLM? A zero-shot LLM ranking arXiv papers against a team description gives generic "this paper looks topically relevant" answers. Our fine-tune learns the **preference signal** of which papers a team-aware reasoner (the GP teacher) actually flags as worth reading next. That extracts directional signal the LLM doesn't have access to. The whole pipeline (GP teacher → preference pairs → LoRA distillation) is described in our training repository: [github.com/remyxai/mhpd-dpo-training](https://github.com/remyxai/mhpd-dpo-training). ### Personalized version The open-source generalist you're using is trained on cross-repo preference signal. For per-team **specialist** models — adapted to your specific team's reading history via continued fine-tuning on your private preference data — sign up at [engine.remyx.ai](https://engine.remyx.ai). Specialists typically lift confidence by 10-15pts on team-specific picks vs the generalist. ## How it works ``` GitHub URL ↓ Fetch recent commits (GitHub Public API) ↓ Gemini Flash: filter noise + summarize commits into "experiment history" + "domain summary" ↓ sentence-transformers (all-MiniLM-L6-v2): embed domain summary, retrieve top-50 arXiv candidates ↓ v1.2 LoRA on Qwen3.5-2B: score logprob(paper | team_context) per candidate ↓ Confidence tier (z-score above pool median + embedding-cosine OOD floor) ↓ Base Qwen3.5-2B: draft a PR body integrating the paper ``` The arXiv candidate pool ([`remyxai/arxiv_pool_daily`](https://huggingface.co/datasets/remyxai/arxiv_pool_daily)) is precomputed daily — abstracts pre-embedded so per-request retrieval is sub-second CPU work. Categories covered: `cs.AI`, `cs.LG`, `cs.CL`, `cs.CV`, `cs.DB`, `cs.IR`, `cs.SE`, `stat.ML`. ## Calibration-aware confidence The recommendation is tiered by **two** signals — z-score above the candidate-pool median AND embedding similarity to the team's domain summary. Both gates must clear for a tier: | Tier | z-score | embedding cosine | Estimated accuracy | |---|---|---|---| | 🟢 **High** | ≥ 2.0σ | ≥ 0.60 | ~73% | | 🟡 **Moderate** | ≥ 1.5σ | ≥ 0.50 | ~65% | | 🟠 **Low** | ≥ 1.0σ | ≥ 0.40 | ~55% | | 🔴 **Near-random** | otherwise | — | ~50% | The two-signal design handles out-of-distribution repos honestly: a recommendation may be the clear winner *within* its candidate pool (high z-score) while the pool itself doesn't actually contain topical matches for the team's domain (low cosine). The OOD case correctly demotes to Low/Near-random and surfaces the upsell. ## Development ### Environment variables | Variable | Purpose | Required | |---|---|---| | `HF_TOKEN` | Read access to the LoRA adapter + arxiv pool dataset | yes | | `GEMINI_API_KEY` | Team-context summarization (Gemini Flash). Also used for PR-body generation when `MHPD_GENERATION_BACKEND=gemini` | yes | | `MHPD_ADAPTER` | Override the LoRA adapter repo. Default: `remyxai/mhpd-dpo-qwen3.5-2b-lora-v1.2-ipo-2epoch` (v1.2). Will swap to v1.5 once trained. | no | | `MHPD_GENERATION_BACKEND` | `local` (default) uses the base 2B on GPU for PR body draft. `gemini` routes PR body to Gemini Flash on CPU, freeing GPU time for the scoring step. | no | | `USE_SPACES_GPU` | `true` (default) enables the `@spaces.GPU` decorator for Zero-GPU Spaces. Set `false` on persistent paid GPU Spaces. | no | | `ARXIV_POOL_REPO` / `ARXIV_POOL_FILE` | HF dataset hosting the precomputed pool. Default: `remyxai/arxiv_pool_daily` | no | ### Local development ```bash pip install -r requirements.txt export HF_TOKEN=hf_... export GEMINI_API_KEY=... python app.py ``` ### Architecture invariants - **GPU only for scoring + PR body generation**. Embedding pre-filter, GitHub fetching, and Gemini call run on CPU before any GPU work is invoked. - **arxiv_pool.parquet is precomputed** (daily cron via [GitHub Actions](https://github.com/remyxai/mhpd-dpo-training/blob/main/.github/workflows/refresh-arxiv-pool.yml)) — abstracts already embedded with all-MiniLM-L6-v2 to avoid embedding 500+ papers per cold start. - **Single base model on GPU, LoRA toggled** via `enable_adapters()` / `disable_adapters()` for the scoring vs generation pass. ## License Apache 2.0 for the Space code. The fine-tuned LoRA adapter is licensed per its model card on HF Hub. Underlying base model (Qwen3.5-2B) has its own license; arxiv abstracts are subject to arxiv terms.