Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ One pinned README ([sindresorhus/p-queue](https://github.com/sindresorhus/p-queu

The default ties BM25 on the clean corpus and beats it by 20 points once noise documents are mixed in. The coverage packer wins one extra question on the clean corpus, but the gain's bootstrap interval is [−10, +20] points, and it loses 10 points under distractors. So it stays opt-in. Every run, including the losing ones, is in [`eval/repo-support/runs/`](eval/repo-support/runs/), and the [evaluation write-up](eval/repo-support/README.md) covers method, history and limits.

## Tested on real GitHub issues

![170 real GitHub issues, before and after](eval/github-issues/chart.svg)

Paste a bug report and IntelliRAG ranks the repository's files. I tested it on 170 real issues from django, scikit-learn, sphinx and pytest (SWE-bench Lite), using the reporter's own text. The file the fix changed now comes first 45.3% of the time, up from 35.3%, and is in the top 5 65.9% of the time, up from 60.6%. No model is involved. The gain comes from reading the code an issue names (traceback paths, `module.Class`, function calls) and linking it to the files that define it. Settings were tuned on different issues (sympy). Method, per-repository numbers and a negative result: [eval/github-issues](eval/github-issues/README.md).

## It sleeps

The design follows Google's "Language Models Need Sleep" (Behrouz, Hashemi, Mirrokni) and Self-Improvement Memory (Yu et al., arXiv 2611.18856). IntelliRAG has no weights to train, so the sleep acts on its memory:

| Phase | What happens | Guard |
|---|---|---|
| Awake | Every rated answer and every picked source is filed against the passages it came from. | The source text is never edited. |
| Replay | During sleep, the questions people confirmed are asked again. | This is the metric. |
| Consolidate | It learns which words people use for which words the sources use. | Kept in separate memory; the source's term statistics never change. |
| Dream | It writes practice questions for passages nobody has asked about: words hidden in identifiers, section context, people's vocabulary, or a model's questions when one is configured. | Each dream is tried on a copy of memory. It is kept only if its passage is now found, no confirmed question is lost, and no dead end comes back. A final full replay rolls back the whole sleep if anything slipped through. |
| Journal | Each strategy's kept-of-tried count and the reason for every rejection are recorded. | The next sleep budgets toward what worked and pauses a strategy that failed twice running. |

It sleeps by itself after every 8 ratings, or when you press **Sleep now** in the Memory panel. The panel shows what was kept and why everything else wasn't.

**Measured honestly.** On the 14-question rewording test, one sleep neither helped nor hurt (54.8% before and after on held-out wordings). On the GitHub issues, sleep's guard cut the damage of a memory that didn't transfer from −6.5 to −1.8 points, but didn't turn it into a gain. The gains so far come from ratings and picks (held-out rewordings 50.0% → 54.8%, original questions 71.4% → 81.0%) and from the code links above. With a model configured, the model-written dream strategy is where the paper expects the bigger effect. That hasn't been measured here yet.

**Answers never stop mid-sentence.** If the model runs out of output budget, it continues from where it stopped. If it still can't finish, the answer is cut back to its last whole sentence or list item, with a one-line note.

## It gets better the more it's used

Three loops improve IntelliRAG as people use it. Each is measured on held-out data, and each can only add evidence: none of them can make an unsupported question look answered.
Expand Down
57 changes: 57 additions & 0 deletions eval/github-issues/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Real GitHub issues: finding the file the bug lives in

![Before and after on 170 real issues](chart.svg)

**Task.** These are 170 real issues from four open-source repositories (pytest, sphinx, scikit-learn and django). Each one comes from **SWE-bench Lite** (Jimenez et al., ICLR 2024), along with the pull request that fixed it. IntelliRAG gets the issue text exactly as the reporter wrote it. It ranks the repository's files, and a hit is any file the fixing patch changed. This is file-level localization, as in Agentless and LocAgent.

Each repository is indexed once, at the commit of its earliest issue, so no fix is in the index. Code is chunked the way GitHub import chunks it, by definition. Test files are left out, since fixes live in source files.

| IntelliRAG retrieval | Right file first | In top 3 | In top 5 |
|---|---|---|---|
| before (text match + calibrated rerank) | 35.3% | 54.1% | 60.6% |
| **now (+ code links)** | **45.3%** | **62.4%** | **65.9%** |

That is +10.0 points on the first result. 11 issues moved into the top 5 and 2 moved out. Each one is in the chart, linked to its fixing PR.

**What changed.** Bug reports name their code. A traceback quotes a file, an issue says `Subquery.as_sql()`, and a report mentions `ReadOnlyPasswordHashWidget`. `dev-entities.ts` pulls those names out. A definitions index, built once per repository, links each name to the files that define it, and rare names count for more. Those files' passages join the candidates with a bounded lift in the reranker. LocAgent and Agentless do this entity-linking step with a model; IntelliRAG does it without one.

**How it was tuned.** The lift (0.12 per unit of link strength, capped at 0.3) was chosen on sympy's 77 issues only. Nothing was tuned on the four repositories above.

| Repository | Issues | First, before → now | Top 5, before → now |
|---|---|---|---|
| django | 114 | 36.0 → 47.4 | 64.9 → 70.2 |
| scikit-learn | 23 | 30.4 → 43.5 | 47.8 → 52.2 |
| sphinx | 16 | 25.0 → 31.2 | 50.0 → 62.5 |
| pytest | 17 | 47.1 → 47.1 | 58.8 → 58.8 |

## What didn't work, and what sleep did about it

**Case memory.** I also tested whether resolved issues help with later ones. When a fix lands, its files are filed against the issue's text. A new issue then borrows the files of similar earlier ones, as in BugLocator, with a fix-frequency prior, as in FixCache. Issues were replayed in order, and each was ranked before it was learned from.

| Search-bar ranking | First | Top 5 |
|---|---|---|
| without case memory | 44.7% | 65.9% |
| case memory, fixed weights | 38.2% | 65.9% |
| case memory, weights chosen by sleep | 42.9% | 64.7% |

Real issues are mostly new problems, so borrowing from old ones hurt. The sleep step replays the memory's own history and only adopts weights that would have ranked past answers higher. That cut the damage from −6.5 to −1.8 points on the first result, but it did not turn the memory into a gain. In the app, case memory therefore stays off until replay beats the current weights by 0.05 MRR over at least 20 cases. It is reported here as a negative result.

## Reproduce

```bash
git clone --filter=blob:none --sparse https://github.com/aorwall/moatless-tools /tmp/mt
git -C /tmp/mt checkout 011ead57a5c81664e9c45e07e1f50b17e695cc63
git -C /tmp/mt sparse-checkout set --no-cone moatless/evaluation/swebench_lite_all_evaluations.json
# each repository at its earliest issue's commit (see swe-loc-bench.ts for the SHAs)
for r in "django django e7fd69d051eaa67cb17f172a39b57253e9cb831a" "pytest pytest-dev/pytest 10ca84ffc56c2dd2d9dc4bd71b7b898e083500cd" \
"sklearn scikit-learn/scikit-learn b90661d6a46aa3619d3eec94d5281f5888add501" "sphinx sphinx-doc/sphinx 752d3285d250bbaf673cff25e83f03f247502021"; do
set -- $r; [ $1 = django ] && repo=django/django || repo=$2
mkdir -p /tmp/swe/$1 && git -C /tmp/swe/$1 init -q && git -C /tmp/swe/$1 fetch -q --depth 1 https://github.com/$repo $3 && git -C /tmp/swe/$1 checkout -q FETCH_HEAD
done
cd web && SWE_JSON=/tmp/mt/moatless/evaluation/swebench_lite_all_evaluations.json npx tsx scripts/swe-loc-bench.ts --write
node scripts/issue-chart.mjs
```

The full run takes about 25 minutes on a laptop: django is 4,261 passages.

**For context.** LLM agents that read and navigate the repository score far higher. LocAgent reports up to 92.7% file-level accuracy on SWE-bench Lite with a fine-tuned 32B model. What's measured here is the retrieval step with no model, which is what an agent would call first.
1 change: 1 addition & 0 deletions eval/github-issues/chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading