v2.0 README
Browse files
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- resonance-lattice
|
| 5 |
+
- rlat
|
| 6 |
+
- knowledge-model
|
| 7 |
+
- retrieval
|
| 8 |
+
language: en
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# python-stdlib — rlat knowledge model (v2.0)
|
| 12 |
+
|
| 13 |
+
A [Resonance Lattice](https://github.com/tenfingerseddy/resonance-lattice)
|
| 14 |
+
knowledge model of [`python/cpython`](https://github.com/python/cpython) at commit
|
| 15 |
+
[`d2f506ae`](https://github.com/python/cpython/commit/d2f506ae07e0bc097039634a28cf85b5d804ef72), scope `Doc`.
|
| 16 |
+
|
| 17 |
+
## Quick start
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
pip install rlat
|
| 21 |
+
huggingface-cli download tenfingers/python-stdlib-rlat python-stdlib.rlat --local-dir .
|
| 22 |
+
rlat search python-stdlib.rlat "your question" --top-k 5
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The model uses **remote storage mode** — passages reference source files at
|
| 26 |
+
`raw.githubusercontent.com` pinned to the commit SHA above. The first query
|
| 27 |
+
fetches each cited source once and caches it locally; subsequent queries on
|
| 28 |
+
the same passages are sub-20ms warm.
|
| 29 |
+
|
| 30 |
+
## Build details
|
| 31 |
+
|
| 32 |
+
| Field | Value |
|
| 33 |
+
|---|---|
|
| 34 |
+
| Encoder | `Alibaba-NLP/gte-modernbert-base` 768d, CLS-pooled, L2-normalised |
|
| 35 |
+
| Encoder revision | `e7f32e3c00f91d699e8c43b53106206bcc72bb22` (pinned) |
|
| 36 |
+
| Format | rlat knowledge-model v4 (ZIP + JSON + NPZ) |
|
| 37 |
+
| Storage mode | `remote` (source pinned at SHA, fetched on demand, SHA-verified) |
|
| 38 |
+
| Source repo | [`python/cpython`](https://github.com/python/cpython) |
|
| 39 |
+
| Source scope | `Doc` |
|
| 40 |
+
| Source commit | `d2f506ae07e0bc097039634a28cf85b5d804ef72` |
|
| 41 |
+
| Branch at build time | (commit SHA-pinned; reproducible regardless of branch movement) |
|
| 42 |
+
| Files indexed | 0 |
|
| 43 |
+
| Passages | 0 |
|
| 44 |
+
| Build date | 2026-04-28 |
|
| 45 |
+
| Built on | Kaggle T4 (GPU encoding) |
|
| 46 |
+
| File size | 292.5 MB |
|
| 47 |
+
|
| 48 |
+
## Usage
|
| 49 |
+
|
| 50 |
+
### Single-hop search
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
rlat search python-stdlib.rlat "what does X do?" --top-k 5
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
### Skill-context (Anthropic skill `!command` block)
|
| 57 |
+
|
| 58 |
+
```markdown
|
| 59 |
+
!`rlat skill-context python-stdlib.rlat --query "$user_query" --top-k 5`
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
The output is markdown with citation anchors, drift status, and
|
| 63 |
+
ConfidenceMetrics — ready for an LLM to ground on.
|
| 64 |
+
|
| 65 |
+
### Multi-hop deep-search
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
rlat deep-search python-stdlib.rlat "harder cross-file question" --max-hops 3
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Requires an Anthropic API key. See the
|
| 72 |
+
[deep-search docs](https://github.com/tenfingerseddy/resonance-lattice/blob/main/docs/user/CLI.md#rlat-deep-search).
|
| 73 |
+
|
| 74 |
+
## Refreshing against upstream
|
| 75 |
+
|
| 76 |
+
This model pins to the source commit `d2f506ae`. To re-index against the
|
| 77 |
+
current upstream tip:
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
# Option A: rebuild on Kaggle's free T4 (recommended for big corpora)
|
| 81 |
+
# See the rlat-build-on-kaggle skill at:
|
| 82 |
+
# https://github.com/tenfingerseddy/resonance-lattice/tree/main/.claude/skills/rlat-build-on-kaggle
|
| 83 |
+
|
| 84 |
+
# Option B: rebuild locally
|
| 85 |
+
pip install rlat[build,ann]
|
| 86 |
+
rlat install-encoder
|
| 87 |
+
git clone --depth 1 -b main https://github.com/python/cpython.git src/
|
| 88 |
+
rlat build src/Doc -o python-stdlib.rlat \
|
| 89 |
+
--store-mode remote \
|
| 90 |
+
--remote-url-base https://raw.githubusercontent.com/python/cpython/<NEW_SHA>/Doc/ \
|
| 91 |
+
--runtime torch
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Honest limits
|
| 95 |
+
|
| 96 |
+
- The encoder is `gte-modernbert-base` 768d with no per-corpus optimisation.
|
| 97 |
+
Default retrieval is dense cosine over the base band — single recipe, no
|
| 98 |
+
rerankers, no lexical sidecar.
|
| 99 |
+
- For per-corpus retrieval lift, you can run `rlat optimise` locally to add
|
| 100 |
+
a 512d MRL-trained band on top of this archive (opt-in, costs API + GPU
|
| 101 |
+
time). See [docs/user/OPTIMISE.md](https://github.com/tenfingerseddy/resonance-lattice/blob/main/docs/user/OPTIMISE.md).
|
| 102 |
+
- Drift detection is automatic: if the source files at GitHub change, query
|
| 103 |
+
results show a `drifted` status until the model is rebuilt against the
|
| 104 |
+
new commit.
|
| 105 |
+
|
| 106 |
+
## License
|
| 107 |
+
|
| 108 |
+
MIT. The .rlat archive contains embeddings + metadata + a SHA-pinned URL
|
| 109 |
+
manifest; source bytes are NOT bundled and are fetched from upstream
|
| 110 |
+
GitHub at query time, where the upstream license applies.
|