llavrag 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llavrag-0.3.0/.gitignore +7 -0
- llavrag-0.3.0/CHANGELOG.md +81 -0
- llavrag-0.3.0/LICENSE +201 -0
- llavrag-0.3.0/LICENSE-AUDIT.md +112 -0
- llavrag-0.3.0/NOTICE +35 -0
- llavrag-0.3.0/PKG-INFO +694 -0
- llavrag-0.3.0/README.md +656 -0
- llavrag-0.3.0/SECURITY.md +34 -0
- llavrag-0.3.0/examples/README.md +6 -0
- llavrag-0.3.0/examples/docs/org-chart.docx +0 -0
- llavrag-0.3.0/examples/docs/projects.txt +7 -0
- llavrag-0.3.0/examples/docs/rotterdam-pilot.pdf +0 -0
- llavrag-0.3.0/examples/docs/travel-policy.md +21 -0
- llavrag-0.3.0/examples/docs/vendors.html +14 -0
- llavrag-0.3.0/pyproject.toml +58 -0
- llavrag-0.3.0/scripts/build_judge_weights.py +148 -0
- llavrag-0.3.0/scripts/make_manifest.py +23 -0
- llavrag-0.3.0/scripts/package_weights.py +250 -0
- llavrag-0.3.0/src/llavrag/__init__.py +21 -0
- llavrag-0.3.0/src/llavrag/__main__.py +3 -0
- llavrag-0.3.0/src/llavrag/api.py +41 -0
- llavrag-0.3.0/src/llavrag/backend.py +61 -0
- llavrag-0.3.0/src/llavrag/cli.py +280 -0
- llavrag-0.3.0/src/llavrag/config.py +88 -0
- llavrag-0.3.0/src/llavrag/core/__init__.py +2 -0
- llavrag-0.3.0/src/llavrag/core/cache.py +42 -0
- llavrag-0.3.0/src/llavrag/core/chunk.py +34 -0
- llavrag-0.3.0/src/llavrag/core/data.py +69 -0
- llavrag-0.3.0/src/llavrag/core/dense.py +35 -0
- llavrag-0.3.0/src/llavrag/core/engine.py +179 -0
- llavrag-0.3.0/src/llavrag/core/expand.py +35 -0
- llavrag-0.3.0/src/llavrag/core/fuse.py +12 -0
- llavrag-0.3.0/src/llavrag/core/judge.py +71 -0
- llavrag-0.3.0/src/llavrag/core/lexical.py +136 -0
- llavrag-0.3.0/src/llavrag/core/net.py +28 -0
- llavrag-0.3.0/src/llavrag/core/run.py +120 -0
- llavrag-0.3.0/src/llavrag/core/score.py +63 -0
- llavrag-0.3.0/src/llavrag/core/state.py +34 -0
- llavrag-0.3.0/src/llavrag/core/text.py +134 -0
- llavrag-0.3.0/src/llavrag/demo.py +281 -0
- llavrag-0.3.0/src/llavrag/doctor.py +412 -0
- llavrag-0.3.0/src/llavrag/embed.py +192 -0
- llavrag-0.3.0/src/llavrag/engine.py +117 -0
- llavrag-0.3.0/src/llavrag/index.py +224 -0
- llavrag-0.3.0/src/llavrag/ingest.py +505 -0
- llavrag-0.3.0/src/llavrag/judge.py +426 -0
- llavrag-0.3.0/src/llavrag/judges.py +179 -0
- llavrag-0.3.0/src/llavrag/manifests/embedder.json +54 -0
- llavrag-0.3.0/src/llavrag/manifests/judge.json +59 -0
- llavrag-0.3.0/src/llavrag/mcp_server.py +126 -0
- llavrag-0.3.0/src/llavrag/onepass.py +78 -0
- llavrag-0.3.0/src/llavrag/pilot.py +185 -0
- llavrag-0.3.0/src/llavrag/placement.py +245 -0
- llavrag-0.3.0/src/llavrag/search.py +163 -0
- llavrag-0.3.0/src/llavrag/textsafe.py +47 -0
- llavrag-0.3.0/src/llavrag/weights.py +199 -0
- llavrag-0.3.0/tests/build_tiny_corpus.py +29 -0
- llavrag-0.3.0/tests/clean_install.sh +24 -0
- llavrag-0.3.0/tests/data/README.md +5 -0
- llavrag-0.3.0/tests/data/musique-dev10/passages.jsonl +197 -0
- llavrag-0.3.0/tests/data/musique-dev10/questions.json +100 -0
- llavrag-0.3.0/tests/mcp_client_check.py +58 -0
- llavrag-0.3.0/tests/parity/README.md +85 -0
- llavrag-0.3.0/tests/parity/compare_core.py +54 -0
- llavrag-0.3.0/tests/parity/cuda_check.sh +77 -0
- llavrag-0.3.0/tests/parity/make_bench_index.py +38 -0
- llavrag-0.3.0/tests/parity/run_package.py +43 -0
- llavrag-0.3.0/tests/test_onboarding.py +483 -0
- llavrag-0.3.0/tests/test_smoke.py +749 -0
llavrag-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to llavRAG local. Dates are in UTC+8.
|
|
4
|
+
|
|
5
|
+
## [0.3.0] - unreleased
|
|
6
|
+
|
|
7
|
+
First public release, together with the paper "Retrieval as Evidence-Conditioned Decisions: llavRAG with Cascaded
|
|
8
|
+
llav Decision Models" (llavRAG v0.3).
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `llavrag index | search | mcp | download | info`, a stdio MCP server (`search`, `get_passage`, `list_sources`) and a
|
|
12
|
+
Python API (`llavrag.Searcher`, `llavrag.build_index`). This is the standard tier of llavRAG.
|
|
13
|
+
- **Retrieval core** (`llavrag.core`, "llav-retrieve" v0.3). Three rounds per question, each judged by the 4B evidence
|
|
14
|
+
judge with the evidence found so far:
|
|
15
|
+
- R0: Reciprocal Rank Fusion of BM25 (title weight 3) and dense retrieval (Qwen3-Embedding-4B), 100 chunks, judged
|
|
16
|
+
under the question-only state;
|
|
17
|
+
- R1: evidence-conditioned BM25 queries for the top-3 evidence passages plus a relevance-model query weighted by the
|
|
18
|
+
judge's probabilities, 100 new chunks;
|
|
19
|
+
- R2: dense next-hop queries, further dense question hits and exact title links; the top 40 are re-scored with the
|
|
20
|
+
final evidence, and linked chunks that were judged only under the question-only state are asked again.
|
|
21
|
+
Defaults are the frozen v0.3 configuration.
|
|
22
|
+
- **Lexical index**: SQLite FTS5 over our own normalised tokens (accent folding, Unicode words; Chinese, Japanese and
|
|
23
|
+
Korean runs as character bigrams, or jieba words with `--cjk jieba`), ranked by FTS5's built-in `bm25()`.
|
|
24
|
+
- **Documents**: PDF, DOCX, Markdown, HTML, plain text and pre-chunked JSONL; heading-scoped passages cut at sentence
|
|
25
|
+
ends (at most 1,200 characters by default); page numbers for PDFs.
|
|
26
|
+
- **Judge**: `llavrag-judge-4b-lic-r1200`, the licence-clean 4B checkpoint (Apache-2.0), published as llav 4B at
|
|
27
|
+
huggingface.co/llavapp/llav-4b, downloaded and sha256-checked by `llavrag download`; `--from DIR_OR_URL` copies the
|
|
28
|
+
weights from a local directory instead. If a download URL answers 401/403/404 (for example before the weights are
|
|
29
|
+
published), `llavrag download` stops with a message naming the URL and the local-copy options.
|
|
30
|
+
- `--json --log-states`: every judge state, with the passages judged under it and their probabilities.
|
|
31
|
+
- **First run**: `llavrag doctor` (Python, OS and chip, backend, memory and model placement, free disk, models,
|
|
32
|
+
huggingface.co; a verdict, the fixes and the expected time per question from the verified hardware; `--json`) and
|
|
33
|
+
`llavrag demo` (doctor, the model download if needed, the bundled sample folder indexed, a three-hop question with
|
|
34
|
+
its evidence chain and a live comparison of one search pass with llavRAG, then the next steps). The sample folder
|
|
35
|
+
ships in the wheel (`llavrag/examples/docs`). `llavrag download` shows an ETA per file and for all models.
|
|
36
|
+
- **Measure it on your own documents**: `llavrag search --one-pass` (round 0 only: hybrid search scored by the same
|
|
37
|
+
judge against the question alone), `llavrag search --compare` (the full search plus the round-0 ranking of the same
|
|
38
|
+
run) and `llavrag pilot QUESTIONS.jsonl` (questions with the files each answer needs: one pass vs llavRAG, counts,
|
|
39
|
+
evidence chains of the biggest wins). The retrieval core and the full search are unchanged.
|
|
40
|
+
- Pluggable judge backends (`local`, `local:DIR`, `https://` for a judge endpoint you run yourself, `plugin:NAME`).
|
|
41
|
+
- `llavrag index --code` (experimental): source code indexed as text; chunk text = relative path + newline + chunk.
|
|
42
|
+
- Backends: MLX (Apple Silicon), CUDA, MPS and CPU; automatic placement of the judge and the embedder by free memory.
|
|
43
|
+
- Parity tools against the core's reference runner (`tests/parity/`).
|
|
44
|
+
- **Agent Skill** (`skills/`): `llavrag` (local evidence search with this package), in the standard `SKILL.md` format,
|
|
45
|
+
with a Claude Code plugin (`llav-skills`) and a marketplace manifest (`/plugin marketplace add llavlab/llavrag`).
|
|
46
|
+
|
|
47
|
+
### Security
|
|
48
|
+
- Chat control tokens (`<|...|>` sequences and the tokenizer's other added tokens, such as `<think>`) are replaced by a
|
|
49
|
+
placeholder character in passage and query text, in one linear pass, before the judge and the embedder tokenize
|
|
50
|
+
it, on MLX and PyTorch alike. Passage titles are cut at 300 characters at indexing and in the judge's evidence
|
|
51
|
+
list. Model inputs on
|
|
52
|
+
text without such tokens are unchanged (parity runs: identical results and probabilities).
|
|
53
|
+
- The MCP server's instructions and tool descriptions and the `llavrag` skill state that passage text is untrusted
|
|
54
|
+
data whose instructions are never followed.
|
|
55
|
+
- `llavrag index` skips symbolic links that leave the indexed folder (`--follow-symlinks` to follow them) and files over
|
|
56
|
+
a size cap (`--max-file-mb`, `LLAVRAG_MAX_FILE_MB`, default 256 MB). DOCX: `word/document.xml` is size- and
|
|
57
|
+
ratio-checked before reading (at most 64 MB), streamed, must be UTF-8 or UTF-16, and is refused if it declares a DTD
|
|
58
|
+
or entities. The SQLite index is opened with `PRAGMA trusted_schema=OFF`.
|
|
59
|
+
- The HTTP judge backend requires https (http only for localhost) and never follows redirects, so its bearer token is
|
|
60
|
+
sent only to the configured host.
|
|
61
|
+
- Folders created by llavrag get mode 0700 and the files it writes 0600; writes refuse a symbolic link in place of the
|
|
62
|
+
file.
|
|
63
|
+
- The judge download is pinned to one commit of huggingface.co/llavapp/llav-4b (each file is still sha256-checked).
|
|
64
|
+
- The retrieval core's HTTP client no longer adds an internal header to its requests.
|
|
65
|
+
- Dependency floors raised: pypdf >= 6.21.4, transformers >= 5.10, mlx >= 0.29.4, torch >= 2.13, mcp >= 1.30
|
|
66
|
+
(not 2.0.x or 2.1.x).
|
|
67
|
+
|
|
68
|
+
### Changes from the internal 0.2 builds
|
|
69
|
+
- Indexes must be rebuilt: run `llavrag index` on the same folder again (unchanged passages keep their dense vectors).
|
|
70
|
+
- `--judge2` and `--exact` are removed.
|
|
71
|
+
- A judge plugin is now a synchronous callable `backend(state, questions) -> {question id: probability}`.
|
|
72
|
+
- No C compiler is needed; `jieba` is optional (`llavrag[cjk]`).
|
|
73
|
+
|
|
74
|
+
### Not included
|
|
75
|
+
- The 27B judge of the paper's deep tier (not released).
|
|
76
|
+
|
|
77
|
+
## [0.2.0] - 2026-11-27 (internal, not released)
|
|
78
|
+
- Internal build with an earlier retrieval pipeline, replaced in 0.3.0.
|
|
79
|
+
|
|
80
|
+
## [0.1.0] - 2026-11-26 (internal, not released)
|
|
81
|
+
- Internal build used for the first parity tests.
|
llavrag-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Licence audit: llavRAG 4B judge and this package (llavrag 0.3.0)
|
|
2
|
+
|
|
3
|
+
This document records where the 4B judge's training data comes from and under which licences. It is a provenance
|
|
4
|
+
record, not legal advice. "Allowed" below means that the stated licence does not forbid releasing model weights for
|
|
5
|
+
commercial use.
|
|
6
|
+
|
|
7
|
+
## What llavrag 0.3.0 ships or downloads
|
|
8
|
+
|
|
9
|
+
| Item | How it reaches the user | Licence |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Package code (`src/llavrag`, including the retrieval core `src/llavrag/core`) | wheel / sdist | Apache-2.0, copyright 2026 LLav Lab. All code is our own; nothing is vendored. |
|
|
12
|
+
| Example documents (`examples/docs`) | sdist | Written for this package (fictional company), Apache-2.0. |
|
|
13
|
+
| Test data (`tests/data/musique-dev10`) | sdist only | MuSiQue dev q0-9 paragraphs: CC BY 4.0 (text from Wikipedia, CC BY-SA). Attribution in `tests/data/README.md` and `NOTICE`. |
|
|
14
|
+
| Qwen3-Embedding-4B | downloaded by `llavrag download` from Hugging Face (pinned commit, sha256-checked) | Apache-2.0, unmodified, not redistributed by us. |
|
|
15
|
+
| llavRAG judge 4B (`llavrag-judge-4b-lic-r1200`) | downloaded by `llavrag download` from huggingface.co/llavapp/llav-4b (sha256-checked against the manifest) | Apache-2.0; base Qwen3-Reranker-4B (Apache-2.0). Training data below. |
|
|
16
|
+
| Python dependencies | installed by pip from PyPI | numpy (BSD-3-Clause), transformers (Apache-2.0), safetensors (Apache-2.0), pypdf (BSD-3-Clause), mcp (MIT), mlx / mlx-lm (MIT, Apple Silicon), torch (BSD-3-Clause), accelerate (Apache-2.0); optional jieba (MIT), bitsandbytes (MIT), pytest (MIT). Their transitive dependencies keep their own licences. |
|
|
17
|
+
| SQLite / FTS5 | Python's standard library | Public domain; only the built-in `bm25()` function is used, no SQLite code is copied. |
|
|
18
|
+
| 27B judge (the paper's deep tier) | not shipped | Not released. |
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
|
|
22
|
+
| Item | Licence status |
|
|
23
|
+
|---|---|
|
|
24
|
+
| **Package code** (this repository) | Apache-2.0, copyright 2026 LLav Lab. No third-party code is vendored. The source tree contains no model weights. |
|
|
25
|
+
| **Qwen3-Embedding-4B** | Apache-2.0. Used unmodified; you download it from Hugging Face. |
|
|
26
|
+
| **Research checkpoint** (the 4B judge of earlier internal evaluations) | Every training source allows commercial release of derived weights except two in the general stage: **SST-2** (no licence found) and **twitter-financial-news-sentiment** (tweet text). Five sources are ShareAlike (caveat 1). Not distributed. |
|
|
27
|
+
| **Licence-clean checkpoint** (`llavrag-judge-4b-lic-r1200`, the judge this package downloads and the judge of the v0.3 results) | Retrained from the general stage on, with the same recipe and seeds, **without SST-2 and twitter-financial-news-sentiment** (removed from both the training and the validation files). Released under Apache-2.0. |
|
|
28
|
+
|
|
29
|
+
The model card and the README state which checkpoint `llavrag download` fetches.
|
|
30
|
+
|
|
31
|
+
**Per-question decision traces** are published with the paper and are not part of this package. They quote the
|
|
32
|
+
datasets' question and passage text: MuSiQue (CC BY 4.0), HotpotQA (CC BY-SA 4.0), 2WikiMultihopQA (Apache-2.0) and
|
|
33
|
+
Wikipedia (CC BY-SA). Copying that text redistributes the data, so the traces are released under **CC BY-SA 4.0**,
|
|
34
|
+
with the dataset attributions, and not under Apache-2.0.
|
|
35
|
+
|
|
36
|
+
## Training lineage of the judge
|
|
37
|
+
|
|
38
|
+
| Stage | What | Training data |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| base | Qwen/Qwen3-Reranker-4B | (upstream) |
|
|
41
|
+
| s1 listwise | listwise retrieval LoRA, 1,750 steps | 74,104 MuSiQue *training* rows with BM25 hard negatives, 31,667 further MuSiQue *training* rows, 16,442 HotpotQA + 2WikiMultihopQA *training* rows |
|
|
42
|
+
| s2 soup | mean of checkpoints 250 / 1250 / 1750, merged | none |
|
|
43
|
+
| s3 general | LoRA r16, 1,000 steps | general decision mix (sources below; the licence-clean checkpoint drops SST-2 and the financial tweets); a validation split of the same sources chose the step |
|
|
44
|
+
| s4 calibration | Platt scaling used while generating states | MuSiQue train q700-749 (held out from training) |
|
|
45
|
+
| s5 states | on-policy expansion-loop states produced by the s3 judge itself | MuSiQue train q0-699, gold `is_supporting` labels |
|
|
46
|
+
| s6 rounds | LoRA, 1,200 steps | 2,099 groups / 253,969 items from s5 |
|
|
47
|
+
| s7/s8 | checkpoint choice (600 vs 1,200) and the shipped `calib.json` | MuSiQue train q650-699 / q650-679 (held out) |
|
|
48
|
+
|
|
49
|
+
- **Labels.** Labels are dataset gold or come from our own programmatic pipeline. No label comes from an external or hosted model.
|
|
50
|
+
- **No evaluation questions.** No evaluation question of the benchmark subsets (questions 0-999 of MuSiQue, 2WikiMultihopQA and HotpotQA) and no MuSiQue-fresh question is in any training file of the licence-clean checkpoint (general stage and on-policy rounds data re-audited after the retrain): exact question matches 0, 13-gram question matches 0.
|
|
51
|
+
|
|
52
|
+
**General-stage rows (research checkpoint):**
|
|
53
|
+
|
|
54
|
+
| Source | Rows | Source | Rows |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| MNLI | 23,850 | SST-2 | 11,850 |
|
|
57
|
+
| retrieval (MuSiQue train) | 19,850 | Civil Comments | 11,850 |
|
|
58
|
+
| FEVER | 19,847 | SNLI | 7,850 |
|
|
59
|
+
| CLINC150 | 15,850 | toxic_conversations | 7,780 |
|
|
60
|
+
| Banking77 | 13,850 | BoolQ | 6,956 |
|
|
61
|
+
| | | financial tweets | 6,052 |
|
|
62
|
+
|
|
63
|
+
The licence-clean checkpoint drops SST-2 and the financial tweets: 127,683 instead of 145,585 training rows.
|
|
64
|
+
|
|
65
|
+
## Per-source licences
|
|
66
|
+
|
|
67
|
+
| Source (exact copy used) | Stage | Licence | NC | SA | Commercial weights release | Notes |
|
|
68
|
+
|---|---|---|---|---|---|---|
|
|
69
|
+
| Qwen/Qwen3-Reranker-4B | base | Apache-2.0 | no | no | **allowed** | Apache text shipped; modifications stated in NOTICE |
|
|
70
|
+
| Qwen/Qwen3-Embedding-4B | run time | Apache-2.0 | no | no | **allowed** | Not modified, not redistributed |
|
|
71
|
+
| MuSiQue train (StonyBrookNLP) | s1, s3 (retrieval rows), s4-s8 | CC BY 4.0 | no | no | **allowed** (attribution) | Paragraphs are Wikipedia text (caveat 2) |
|
|
72
|
+
| HotpotQA distractor train | s1 (1,000 q) | CC BY-SA 4.0 | no | **yes** | allowed | Caveat 1 |
|
|
73
|
+
| 2WikiMultihopQA train (via HF mirror `xanhho/2WikiMultihopQA`) | s1 (1,000 q) | Apache-2.0 (Alab-NII repository) | no | no | **allowed** | Wikipedia/Wikidata text (caveat 2) |
|
|
74
|
+
| MNLI `nyu-mll/multi_nli` | s3 | OANC (unrestricted) + fiction: one work CC BY-SA 3.0, two CC BY 3.0, rest US public domain | no | partly | allowed | Small SA share |
|
|
75
|
+
| SNLI `stanfordnlp/snli` | s3 | CC BY-SA 4.0 | no | **yes** | allowed | Caveat 1 |
|
|
76
|
+
| BoolQ `google/boolq` | s3 | CC BY-SA 3.0 | no | **yes** | allowed | Caveat 1 |
|
|
77
|
+
| FEVER `copenlu/fever_gold_evidence` | s3 | CC BY-SA 3.0 (FEVER/Wikipedia terms); the card's GPL-3.0 refers to their code | no | **yes** | allowed | Caveat 1 |
|
|
78
|
+
| SST-2 `stanfordnlp/sst2` | s3, research checkpoint only (not in the shipped judge) | **none found** (HF: "unknown"; Rotten Tomatoes snippets via Pang & Lee, no grant) | ? | ? | **unclear** | Removed from the licence-clean checkpoint |
|
|
79
|
+
| Civil Comments `google/civil_comments` | s3 | CC0-1.0 | no | no | **allowed** | |
|
|
80
|
+
| `SetFit/toxic_conversations_50k` | s3 | Civil Comments text from Jigsaw Unintended Bias in Toxicity Classification, CC0 (stated on TFDS / `google/jigsaw_unintended_bias`) | no | no | **allowed** | Not ToxicChat (`lmsys/toxic-chat`, CC BY-NC 4.0), which is not used anywhere |
|
|
81
|
+
| CLINC150 `clinc/clinc_oos` (plus) | s3 | CC BY 3.0 | no | no | **allowed** (attribution) | |
|
|
82
|
+
| Banking77 `PolyAI/banking77` | s3 | CC BY 4.0 | no | no | **allowed** (attribution) | |
|
|
83
|
+
| `zeroshot/twitter-financial-news-sentiment` | s3, research checkpoint only (not in the shipped judge) | MIT (dataset card) | no | no | allowed by the card | The text is tweets; the platform's terms restrict redistribution and training. Removed from the licence-clean checkpoint |
|
|
84
|
+
| ANLI `facebook/anli` | **not trained on** | CC BY-NC 4.0 | yes | no | n/a | Used only in an evaluation bench; excluded from training on purpose |
|
|
85
|
+
| Benchmark evaluation subsets | **not trained on** | — | | | n/a | See "No evaluation questions" above |
|
|
86
|
+
|
|
87
|
+
## Caveats
|
|
88
|
+
|
|
89
|
+
1. **ShareAlike and weights.** SNLI, BoolQ, FEVER, HotpotQA and a slice of MNLI are BY-SA.
|
|
90
|
+
- The law has not settled whether trained weights are an "adaptation" of a dataset. The common reading is that they are not, and commercial releases of NLI/QA models trained on these sets are widespread.
|
|
91
|
+
- The model card lists every BY-SA source with attribution.
|
|
92
|
+
2. **Wikipedia text.** MuSiQue, HotpotQA, 2WikiMultihopQA, BoolQ and FEVER all reuse Wikipedia paragraphs, which are CC BY-SA. Caveat 1 therefore also touches the CC BY and Apache sources.
|
|
93
|
+
3. **Kaggle terms (Jigsaw).** CC0 is stated on the Google-maintained mirrors. The Kaggle competition rules page could not be checked and may add terms.
|
|
94
|
+
4. **Mirrors.** 2WikiMultihopQA came from a Hugging Face mirror, not from the authors. The upstream licence (Apache-2.0) is the one that applies.
|
|
95
|
+
5. **Calibration and selection data** come from the MuSiQue train split (CC BY 4.0) only.
|
|
96
|
+
|
|
97
|
+
## Model card attribution block
|
|
98
|
+
|
|
99
|
+
> Fine-tuned from Qwen3-Reranker-4B (Apache-2.0, Alibaba Cloud). Training data: MuSiQue (CC BY 4.0, Trivedi et al.
|
|
100
|
+
> 2022); HotpotQA (CC BY-SA 4.0, Yang et al. 2018); 2WikiMultihopQA (Apache-2.0, Ho et al. 2020); MultiNLI (OANC /
|
|
101
|
+
> CC BY-SA 3.0 / CC BY 3.0, Williams et al. 2018); SNLI (CC BY-SA 4.0, Bowman et al. 2015); BoolQ (CC BY-SA 3.0, Clark
|
|
102
|
+
> et al. 2019); FEVER (CC BY-SA 3.0, Thorne et al. 2018); Civil Comments and Jigsaw Unintended Bias (CC0); CLINC150
|
|
103
|
+
> (CC BY 3.0, Larson et al. 2019); Banking77 (CC BY 4.0, Casanueva et al. 2020). Labels are dataset gold only; no
|
|
104
|
+
> model-generated labels. This licence-clean checkpoint does not use SST-2 or twitter-financial-news-sentiment (an
|
|
105
|
+
> earlier internal research checkpoint used both in its general stage). Per-question decision traces released with the
|
|
106
|
+
> paper: CC BY-SA 4.0.
|
|
107
|
+
|
|
108
|
+
## How this was checked
|
|
109
|
+
|
|
110
|
+
These were verified against the training-data manifests (source files and sha256), the scripts that built the general mix (per-source caps, ANLI excluded), the exact parquet sources, the adapter configurations of each stage and the contamination scans, in November 2026.
|
|
111
|
+
|
|
112
|
+
The licences come from the Hugging Face dataset cards and the upstream sources: papers, GitHub repositories, fever.ai and TFDS.
|
llavrag-0.3.0/NOTICE
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
llavRAG local
|
|
2
|
+
Copyright 2026 LLav Lab
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE). All code in this repository and its
|
|
5
|
+
source distribution, including the retrieval core in src/llavrag/core/ and the Agent Skills in skills/, is written by
|
|
6
|
+
LLav Lab. The third-party software and models listed below are not part of this repository; they are installed or
|
|
7
|
+
downloaded separately and keep their own licences.
|
|
8
|
+
|
|
9
|
+
----------------------------------------------------------------------------------------------------------------------
|
|
10
|
+
Models used at run time (downloaded separately; sha256-pinned in src/llavrag/manifests/)
|
|
11
|
+
Qwen3-Embedding-4B -- Copyright Alibaba Cloud (Qwen team), Apache License 2.0,
|
|
12
|
+
https://huggingface.co/Qwen/Qwen3-Embedding-4B (pinned commit 5cf2132a). Used unmodified.
|
|
13
|
+
llavRAG judge 4B -- llav 4B, https://huggingface.co/llavapp/llav-4b (Apache License 2.0, LLav Lab).
|
|
14
|
+
Fine-tuned from Qwen3-Reranker-4B (Copyright Alibaba Cloud (Qwen team), Apache License 2.0,
|
|
15
|
+
https://huggingface.co/Qwen/Qwen3-Reranker-4B). Modifications: LoRA fine-tuning (merged into the
|
|
16
|
+
weights) as an evidence judge. Licence-clean checkpoint; training data and their licences:
|
|
17
|
+
LICENSE-AUDIT.md.
|
|
18
|
+
|
|
19
|
+
----------------------------------------------------------------------------------------------------------------------
|
|
20
|
+
Software used at run time
|
|
21
|
+
SQLite and its FTS5 full-text extension (public domain), through Python's standard sqlite3 module. The lexical
|
|
22
|
+
index uses FTS5's built-in bm25() ranking function; no SQLite code is copied or compiled by this package.
|
|
23
|
+
Python dependencies are installed from PyPI under their own licences: numpy (BSD-3-Clause), transformers
|
|
24
|
+
(Apache-2.0), safetensors (Apache-2.0), pypdf (BSD-3-Clause), mcp (MIT), mlx and mlx-lm (MIT, Apple Silicon),
|
|
25
|
+
torch (BSD-3-Clause) and accelerate (Apache-2.0) (other platforms); optional: jieba (MIT, `llavrag[cjk]`),
|
|
26
|
+
bitsandbytes (MIT, `llavrag[cuda8bit]`), pytest (MIT, `llavrag[dev]`).
|
|
27
|
+
|
|
28
|
+
----------------------------------------------------------------------------------------------------------------------
|
|
29
|
+
Data
|
|
30
|
+
skills/tests/data/search-log-states.jsonl is llavrag output on the sample folder examples/docs (written by LLav Lab).
|
|
31
|
+
tests/data/musique-dev10 contains MuSiQue development questions 0-9 and their paragraphs (CC BY 4.0, Trivedi et al.
|
|
32
|
+
2022; paragraph text from Wikipedia, CC BY-SA). See tests/data/README.md.
|
|
33
|
+
Per-question decision traces (published with the paper, not part of this source distribution) are licensed
|
|
34
|
+
CC BY-SA 4.0, not Apache-2.0, because they quote dataset text: HotpotQA (CC BY-SA 4.0), Wikipedia (CC BY-SA),
|
|
35
|
+
MuSiQue (CC BY 4.0), 2WikiMultihopQA (Apache-2.0).
|