--- license: apache-2.0 language: - en - code base_model: Qwen/Qwen3-0.6B tags: - omen - coding-agents - continual-learning - machine-unlearning - fast-weights --- # Omen-REM-0.6B: Cross-File Codebase Memory **Author:** Ryan Joshua Z. Gapac (ORCID: [0009-0004-2591-0219](https://orcid.org/0009-0004-2591-0219), [ryanjoshuagapac.com](https://ryanjoshuagapac.com)) **Interactive Demo & Write-up:** [ryanjoshuagapac.com/writing/omen-rem](https://ryanjoshuagapac.com/writing/omen-rem) **Paper (Zenodo DOI):** [10.5281/zenodo.24607074](https://doi.org/10.5281/zenodo.24607074) **Benchmark Dataset:** [DevMortimer/GhostLocus-Bench](https://huggingface.co/datasets/DevMortimer/GhostLocus-Bench) **License:** Apache-2.0 ## What This Model Does Linters check the files you edited. The harder failure in real repos is editing file `A` and quietly breaking an untouched file `B` whose path never appears in `git diff`. Stuffing old bug notes into prompts (RAG) bloats context and keeps firing false alarms long after a refactor fixes the issue. Omen-REM puts cross-file bug memory into a small **8 MB adapter** on `Qwen/Qwen3-0.6B` across two timescales: - **Fast check (`67 ms`, `0` extra prompt tokens):** Scores a raw git diff in one forward pass (no text generation) and flags the top untouched files at risk. - **Instant daytime learning (`1.04 ms`, no retraining):** A closed-form linear update (Sherman-Morrison) writes a new cross-file rule into a `0.63 MB` fast-weight matrix. - **Instant daytime forgetting (`2.71 ms`, no retraining):** Orthogonal projection (thin QR) erases a refactored rule while leaving active rules intact (`71.7% -> 1.7%` stale false alarms, `98.9%` active retention). - **Nightly consolidation (`< 5 min`):** Folds surviving daytime rules into the 8 MB adapter, suppresses retired ones, and resets the fast daytime matrix back to zero. ## Quick Start ```bash pip install torch transformers peft safetensors huggingface_hub curl -sLO https://huggingface.co/DevMortimer/Omen-REM-0.6B/raw/main/omen_cli.py python omen_cli.py check # scans git diff (~67 ms), lists risky files python omen_cli.py learn HEAD # learns a new rule in ~1 ms python omen_cli.py sleep --days 7 # nightly consolidation + prunes refactored rules ``` ```python from omen_cli import OmenMemory omen = OmenMemory.from_pretrained("DevMortimer/Omen-REM-0.6B") result = omen.check_diff(pr_diff_text, top_k=3) if result["alarm_prob"] >= 0.5: print("Check untouched files:", result["top_ghost_files"]) ``` ## Controlled Benchmark Results (`GhostLocus-Bench v2`, 80 Files, 3 Seeds) Tested across 60 cross-file rule families (FastAPI, Hono, Pydantic, Vite, Zod) and 260 held-out test edits on Tesla T4: | Method | Top-1 Recall | Top-3 Recall | Alarm AUROC | Stale False Alarms (lower is better) | Wake Latency | Extra Prompt Tokens | |---|---:|---:|---:|---:|---:|---:| | Zero-Shot Base | 5.0% | 10.8% | 0.448 | 50.0% | 38.4 ms | 0 | | Append-Only RAG (top-8) | 26.4% | 54.7% | 0.617 | 37.8% | 115.0 ms | +747 | | Naive Replay SFT | 91.4% | 98.3% | 0.718 | 36.1% | 71.0 ms | 0 | | **Omen-REM (Ours)** | **97.5%** | **99.2%** | **0.906** | **0.6%** | **67.0 ms** | **0** | **24-hour continuous stream:** `100.0%` mid-day recall (`1.04 ms`), `1.7%` post-refactor false alarms (`2.71 ms`, `98.9%` prior retention), and `94.7%` Top-1 / `2.2%` stale false alarms after overnight reset. ## Honest Scope and Limitations - **Not a general replacement for RAG:** This checkpoint predicts risk and untouched filenames over a repo file catalog; it does not store freeform documentation or alter freeform code generation directly. - **Controlled benchmark scale:** Evaluated at `80` candidate files per repo. Scaling to `1,000+` files and lifting this null-space write + nightly reset loop directly into generative LLM weights is the focus of **Omen v2**. ## Citation ```bibtex @techreport{gapac2026omenrem, title = {Omen-REM: Fast Daytime Weight Memory and Nightly Consolidation for Cross-File Codebase Bugs}, author = {Gapac, Ryan Joshua Z.}, year = {2026}, month = nov, institution = {Independent Research}, doi = {10.5281/zenodo.24607074}, url = {https://doi.org/10.5281/zenodo.24607074} } ```