nano-jev 0.1.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.
@@ -0,0 +1,18 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ .venv/
5
+
6
+ # Model outputs (weights go to Hugging Face, not git) and smoke-test scratch data
7
+ runs/
8
+ data_smoke/
9
+
10
+ # Editors / OS
11
+ .vscode/
12
+ .idea/
13
+ Thumbs.db
14
+
15
+ # Packaging / tests
16
+ dist/
17
+ *.egg-info/
18
+ .pytest_cache/
nano_jev-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,310 @@
1
+ Metadata-Version: 2.4
2
+ Name: nano-jev
3
+ Version: 0.1.0
4
+ Summary: Tiny calibrated typed-decision model for RAG pipelines: relevance, sufficiency, groundedness
5
+ Project-URL: Homepage, https://github.com/shubham10divakar/nano-jev
6
+ Project-URL: Repository, https://github.com/shubham10divakar/nano-jev
7
+ Project-URL: Issues, https://github.com/shubham10divakar/nano-jev/issues
8
+ Project-URL: Model, https://huggingface.co/sdmlai/nano-jev
9
+ Author: Subham
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: calibration,decision-model,jev,llm,rag,reranker,retrieval
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: huggingface-hub>=0.24
25
+ Requires-Dist: torch>=2.1
26
+ Requires-Dist: transformers>=4.45
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=8; extra == 'test'
29
+ Provides-Extra: train
30
+ Requires-Dist: accelerate; extra == 'train'
31
+ Requires-Dist: datasets>=3.0; extra == 'train'
32
+ Requires-Dist: numpy; extra == 'train'
33
+ Requires-Dist: scikit-learn; extra == 'train'
34
+ Requires-Dist: tqdm; extra == 'train'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Nano-Jev
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/nano-jev?label=PyPI&color=blue)](https://pypi.org/project/nano-jev/)
40
+ [![Python](https://img.shields.io/pypi/pyversions/nano-jev)](https://pypi.org/project/nano-jev/)
41
+ [![Downloads](https://static.pepy.tech/badge/nano-jev)](https://pepy.tech/project/nano-jev)
42
+ [![Monthly downloads](https://img.shields.io/pypi/dm/nano-jev?label=downloads%2Fmonth)](https://pypistats.org/packages/nano-jev)
43
+ [![Model version](https://img.shields.io/badge/model-v0.1-yellow?logo=huggingface)](https://huggingface.co/sdmlai/nano-jev/tree/v0.1)
44
+ [![HF downloads](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fmodels%2Fsdmlai%2Fnano-jev&query=%24.downloads&label=HF%20downloads&logo=huggingface&color=yellow)](https://huggingface.co/sdmlai/nano-jev)
45
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](https://github.com/shubham10divakar/nano-jev/blob/main/LICENSE)
46
+ [![Status](https://img.shields.io/badge/status-research%20preview-orange)](#limitations)
47
+ [![Open in Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://github.com/shubham10divakar/nano-jev/blob/main/examples/kaggle_smoke_test.ipynb)
48
+
49
+ > Jev-style decision model. Independent; not affiliated with TypeSafe AI or the NanoJev
50
+ > GitHub project.
51
+
52
+ **A tiny (22.7M parameter) calibrated decision model for RAG pipelines.** Give it a
53
+ question, some options and some context; it returns a **probability for each option** in
54
+ under a millisecond on a GPU (a few ms on CPU). It never generates text, so it can't
55
+ return a malformed answer.
56
+
57
+ Use it for the small decisions an agentic RAG loop makes over and over:
58
+
59
+ | Decision | Options | Asks |
60
+ |---|---|---|
61
+ | `relevance` | irrelevant / partially relevant / directly answers | Is this passage useful for the query? |
62
+ | `sufficient` | yes / no | Do these passages contain enough to answer? |
63
+ | `grounded` | yes / no | Is this claim supported by the context? |
64
+ | `decide` | **your own options** | Anything else, e.g. topic or route |
65
+
66
+ ## At a glance
67
+
68
+ | | |
69
+ |---|---|
70
+ | Package | `nano-jev` 0.1.0 on [PyPI](https://pypi.org/project/nano-jev/) (import `nanojev`, command `nano-jev`) |
71
+ | Weights | [`sdmlai/nano-jev`](https://huggingface.co/sdmlai/nano-jev), version `v0.1` (default), downloaded automatically on first use |
72
+ | Model | MiniLM cross-encoder, 6 layers, hidden size 384, **22.7M parameters**, max 512 tokens |
73
+ | Accuracy (test split) | relevance **0.798**, sufficient **0.759**, grounded **0.804** ([results](#results)) |
74
+ | Calibration error (ECE) | 0.020 / 0.019 / 0.045 after temperature scaling |
75
+ | Speed | ~0.4–2.3 ms per decision batched on an RTX 3060; runs on CPU |
76
+ | Python | 3.10+ · PyTorch 2.1+ · Transformers 4.45+ |
77
+ | Licence | Apache-2.0 (see the [MS MARCO note](#licence)) |
78
+ | Status | **v0.1 research preview**; v1.0 planned |
79
+
80
+ ## Install
81
+
82
+ ```bash
83
+ pip install nano-jev
84
+ ```
85
+
86
+ PyTorch is installed from PyPI if you don't have it. For a CUDA build, install PyTorch
87
+ first following [pytorch.org](https://pytorch.org/get-started/locally/).
88
+
89
+ ## Quick start
90
+
91
+ ```python
92
+ import nanojev
93
+
94
+ d = nanojev.load() # default weights (v0.1); downloads ~90 MB the first time, then cached
95
+
96
+ d.relevance("When was UCL founded?", [
97
+ "University College London was founded in 1826.",
98
+ "The Analytical Engine was a proposed mechanical computer.",
99
+ ])
100
+ # [{'irrelevant': 0.021, 'partially relevant': 0.041, 'directly answers': 0.938},
101
+ # {'irrelevant': 0.822, 'partially relevant': 0.143, 'directly answers': 0.035}]
102
+
103
+ d.sufficient("In which year was the university attended by Ada Lovelace's tutor founded?", [
104
+ "Augustus De Morgan tutored Ada Lovelace. He was a professor at University College London.",
105
+ "University College London was founded in 1826.",
106
+ ])
107
+ # {'yes': 0.899, 'no': 0.101} (with only the first passage: {'yes': 0.055, 'no': 0.945})
108
+
109
+ d.grounded("UCL was founded in 1900.", "University College London was founded in 1826.")
110
+ # {'yes': 0.051, 'no': 0.949}
111
+
112
+ d.decide("Which topic is this passage about?", ["computing", "cooking", "football"],
113
+ "The Analytical Engine was a proposed mechanical computer.")
114
+ # {'computing': 0.783, 'cooking': 0.143, 'football': 0.074}
115
+ ```
116
+
117
+ ### In a RAG loop
118
+
119
+ ```python
120
+ d = nanojev.load()
121
+
122
+ def answer(query, retrieve, llm):
123
+ passages = retrieve(query, k=10)
124
+ scores = d.relevance(query, passages)
125
+ kept = [p for p, s in zip(passages, scores) if s["irrelevant"] < 0.5]
126
+
127
+ if d.sufficient(query, kept)["yes"] < 0.85: # not enough context
128
+ kept += retrieve(query, k=10, page=2) # retrieve more / rewrite the query / abstain
129
+
130
+ reply = llm(query, kept)
131
+ if d.grounded(reply, "\n".join(kept))["yes"] < 0.5: # unsupported answer
132
+ reply = llm(query, kept, strict=True) # regenerate, flag, or escalate
133
+ return reply
134
+ ```
135
+
136
+ The thresholds are examples. Calibrated probabilities make thresholds meaningful, but
137
+ **check them on your own data**.
138
+
139
+ ## Choosing weights
140
+
141
+ Weights live on Hugging Face at [`sdmlai/nano-jev`](https://huggingface.co/sdmlai/nano-jev),
142
+ one git tag per version. A version downloads the first time you use it and then loads
143
+ from the local cache (works offline).
144
+
145
+ ```python
146
+ import nanojev
147
+
148
+ models, online = nanojev.list_models() # versions on the Hub (+ which are downloaded)
149
+ for m in models:
150
+ print(m.name, m.status, m.params, "downloaded" if m.downloaded else "")
151
+
152
+ d = nanojev.load("v0.1") # a specific version
153
+ d = nanojev.load("sdmlai/nano-jev@v0.1") # any Hub repo, optionally @tag
154
+ d = nanojev.load("path/to/my-trained-model") # a local folder
155
+ print(d.version, d.config["base"])
156
+ ```
157
+
158
+ Which weights `nanojev.load()` uses when you don't say:
159
+
160
+ 1. the `NANOJEV_MODEL` environment variable
161
+ 2. the choice saved with `nano-jev use ...` (stored in `~/.nanojev/config.json`)
162
+ 3. the package default, `v0.1` (pinned per package release, so results stay reproducible)
163
+
164
+ ## Command line
165
+
166
+ Installing the package adds a `nano-jev` command (`python -m nanojev` does the same).
167
+
168
+ ```bash
169
+ nano-jev --version
170
+ nano-jev list # available weights; * marks the selected one
171
+ nano-jev list --local runs # also list your own trained folders under runs/
172
+ nano-jev download v0.1 # fetch ahead of time, e.g. before going offline
173
+ nano-jev use v0.1 # choose default weights: a version, Hub repo[@tag] or folder
174
+ nano-jev use --reset # back to the package default
175
+ nano-jev current # what's selected and where it is on disk
176
+
177
+ nano-jev relevance -q "When was UCL founded?" -p "University College London was founded in 1826." -p "Another passage."
178
+ nano-jev sufficient -q "QUERY" -p "PASSAGE 1" -p "PASSAGE 2"
179
+ nano-jev grounded --claim "UCL was founded in 1900." --context "University College London was founded in 1826."
180
+ nano-jev decide --question "Which topic is this passage about?" -o computing -o cooking --state "TEXT"
181
+ ```
182
+
183
+ Decision commands accept `--model` (override the selection for one call) and `--json`.
184
+
185
+ ```
186
+ $ nano-jev list
187
+ MODEL SOURCE STATUS BASE PARAMS RELEASED DOWNLOADED
188
+ * v0.1 hub research preview cross-encoder/ms-marco-MiniLM-L6-v2 22.7M 2026-09-25 yes
189
+
190
+ selected: v0.1 (from default)
191
+
192
+ $ nano-jev grounded --claim "UCL was founded in 1900." --context "University College London was founded in 1826."
193
+ yes=0.051 no=0.949
194
+ ```
195
+
196
+ ## How it works
197
+
198
+ Each (question, option, context) triple goes through a small cross-encoder that outputs
199
+ one logit:
200
+
201
+ ```
202
+ [CLS] question: <q> option: <opt> [SEP] <context> [SEP] → encoder → linear → logit
203
+ ```
204
+
205
+ A decision's option logits are divided by that decision's temperature (fitted on
206
+ held-out data) and softmaxed, so the probabilities are calibrated. Options are scored
207
+ independently, which is why you can pass option sets the model never saw in training.
208
+
209
+ ## Results
210
+
211
+ Test split = held-out halves of the HotpotQA / SQuAD 2.0 / MultiNLI validation sets.
212
+ Every model is temperature-calibrated on the same calibration split. Accuracy:
213
+
214
+ | Decision | **Nano-Jev v0.1** (22.7M) | bge-reranker-v2-m3 (568M) | Qwen3-4B-Instruct, prompted (4B) | untrained base |
215
+ |---|---|---|---|---|
216
+ | relevance (3-way) | **0.798** | 0.694 | 0.660 | 0.273 |
217
+ | sufficient | **0.759** | 0.692 | 0.706 | 0.503 |
218
+ | grounded | 0.804 | 0.798 | **0.844** | 0.540 |
219
+
220
+ Nano-Jev is ~90–165× faster than the prompted LLM. The baselines are zero-shot on these
221
+ datasets and Nano-Jev is not, so read the caveats in
222
+ [results/v0.1_comparison.md](https://github.com/shubham10divakar/nano-jev/blob/main/results/v0.1_comparison.md).
223
+
224
+ ## Tests
225
+
226
+ ```bash
227
+ git clone https://github.com/shubham10divakar/nano-jev
228
+ cd nano-jev
229
+ pip install -e ".[test,train]"
230
+
231
+ pytest # offline: builds a tiny random model, ~10 s
232
+ NANOJEV_NETWORK_TESTS=1 pytest # also downloads the real v0.1 weights and checks them
233
+ ```
234
+
235
+ What the tests cover (see [`tests/`](https://github.com/shubham10divakar/nano-jev/tree/main/tests)):
236
+
237
+ | File | Examples of what's checked |
238
+ |---|---|
239
+ | `test_decider.py` | every decision returns a probability distribution over its options; option order doesn't change probabilities; temperatures and config are loaded |
240
+ | `test_registry.py` | version names, `repo@tag` parsing, selection order (env > saved > default), local folders |
241
+ | `test_cli.py` | `--version`, `use` / `current` / `use --reset`, `relevance` and `decide` with `--json`, offline `list` |
242
+ | `test_calibration.py` | temperature fitting recovers a known temperature; ECE of an overconfident model |
243
+ | `test_network.py` | (opt-in) v0.1 is listed on the Hub, downloads, and makes sensible decisions |
244
+
245
+ ### Smoke test on Kaggle / Colab / a fresh machine
246
+
247
+ - **Kaggle:** click the *Open in Kaggle* badge above (or upload
248
+ [`examples/kaggle_smoke_test.ipynb`](https://github.com/shubham10divakar/nano-jev/blob/main/examples/kaggle_smoke_test.ipynb)),
249
+ turn on *Settings → Internet*, then *Run All*.
250
+ - **Anywhere:**
251
+ ```bash
252
+ pip install nano-jev
253
+ wget https://raw.githubusercontent.com/shubham10divakar/nano-jev/main/examples/smoke_test.py
254
+ python smoke_test.py # 9 checks, ends with ALL SMOKE TESTS PASSED
255
+ ```
256
+
257
+ ## Train your own
258
+
259
+ The repo also contains the full training pipeline (≈15 min on an RTX 3060):
260
+
261
+ ```bash
262
+ pip install -e ".[train]"
263
+ python scripts/prepare_data.py --preset default # HotpotQA + SQuAD 2.0 + MultiNLI -> data/ (v0.1 splits are included)
264
+ python scripts/train.py # -> runs/nano-jev-dev
265
+ python scripts/evaluate.py --model runs/nano-jev-dev
266
+ python scripts/baselines.py --which all # bge-reranker + prompted Qwen3-4B (~35 min)
267
+ nano-jev use runs/nano-jev-dev # use your model everywhere
268
+ ```
269
+
270
+ `--preset smoke` gives a 1-minute end-to-end run. Layout:
271
+
272
+ ```
273
+ nanojev/ the package: decider (API), registry (weights), model, schema,
274
+ calibration, report, data, __main__ (CLI)
275
+ scripts/ prepare_data, train, evaluate, baselines, demo
276
+ tests/ pytest suite
277
+ examples/ smoke_test.py, kaggle_smoke_test.ipynb
278
+ data/ v0.1 train / calib / test splits (JSONL)
279
+ results/ evaluation tables and baseline comparison
280
+ model_cards/ Hugging Face model card per released version
281
+ ```
282
+
283
+ ## Limitations
284
+
285
+ - **In-distribution evaluation only (v0.1).** Trained on the train splits of the same three
286
+ datasets it is tested on; the baselines are zero-shot. No out-of-distribution results yet.
287
+ - **Groundedness** is below a prompted 4B LLM. Consider escalating low-confidence
288
+ `grounded` calls to a larger model.
289
+ - **English, Wikipedia-style text.** Expect worse behaviour on other domains and languages.
290
+ - **Custom option sets** work but aren't trained for; treat those probabilities as rough.
291
+ - "partially relevant" follows HotpotQA rules: a supporting paragraph without the answer string.
292
+
293
+ ## Licence
294
+
295
+ Code and weights: **Apache-2.0**.
296
+
297
+ The v0.1 weights start from `cross-encoder/ms-marco-MiniLM-L6-v2`, which was trained on
298
+ MS MARCO, whose terms are **non-commercial**. Commercial users should check those terms, or
299
+ wait for **v1.0**, which will be retrained on an MIT-licensed base with no MS MARCO lineage.
300
+
301
+ Training and evaluation data derive from [HotpotQA](https://hotpotqa.github.io/) (CC BY-SA 4.0),
302
+ [SQuAD 2.0](https://rajpurkar.github.io/SQuAD-explorer/) (CC BY-SA 4.0) and
303
+ [MultiNLI](https://cims.nyu.edu/~sbowman/multinli/); the files in `data/` carry those licences.
304
+
305
+ ## Roadmap
306
+
307
+ - **v1.0:** MIT-licensed base, held-out evaluation (MuSiQue, FEVER / RAGTruth), a
308
+ grounded-decision cascade that escalates unsure cases to an LLM, stable API.
309
+ - Later: a larger model that reads all chunks in one pass, and a `next_action` decision
310
+ for agentic RAG loops.