sysone 0.2.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.
Files changed (47) hide show
  1. sysone-0.2.0/.gitignore +225 -0
  2. sysone-0.2.0/LICENSE +21 -0
  3. sysone-0.2.0/PKG-INFO +144 -0
  4. sysone-0.2.0/README.md +108 -0
  5. sysone-0.2.0/docs/DESIGN.md +813 -0
  6. sysone-0.2.0/examples/decoder_bev_decision.ipynb +291 -0
  7. sysone-0.2.0/examples/decoder_typed_decisions.ipynb +290 -0
  8. sysone-0.2.0/examples/encoder_bev_decision.ipynb +261 -0
  9. sysone-0.2.0/examples/encoder_typed_decisions.ipynb +263 -0
  10. sysone-0.2.0/examples/quickstart.ipynb +256 -0
  11. sysone-0.2.0/pyproject.toml +82 -0
  12. sysone-0.2.0/src/sysone/__init__.py +22 -0
  13. sysone-0.2.0/src/sysone/_util.py +102 -0
  14. sysone-0.2.0/src/sysone/answers.py +57 -0
  15. sysone-0.2.0/src/sysone/architectures/__init__.py +12 -0
  16. sysone-0.2.0/src/sysone/architectures/base.py +144 -0
  17. sysone-0.2.0/src/sysone/architectures/modernbert.py +43 -0
  18. sysone-0.2.0/src/sysone/architectures/qwen.py +48 -0
  19. sysone-0.2.0/src/sysone/architectures/registry.py +53 -0
  20. sysone-0.2.0/src/sysone/base.py +890 -0
  21. sysone-0.2.0/src/sysone/cache.py +196 -0
  22. sysone-0.2.0/src/sysone/checkpoint.py +96 -0
  23. sysone-0.2.0/src/sysone/data.py +190 -0
  24. sysone-0.2.0/src/sysone/encoding.py +80 -0
  25. sysone-0.2.0/src/sysone/evaluation.py +167 -0
  26. sysone-0.2.0/src/sysone/features.py +98 -0
  27. sysone-0.2.0/src/sysone/heads.py +66 -0
  28. sysone-0.2.0/src/sysone/layout.py +129 -0
  29. sysone-0.2.0/src/sysone/losses.py +17 -0
  30. sysone-0.2.0/src/sysone/models.py +24 -0
  31. sysone-0.2.0/src/sysone/prompts.py +60 -0
  32. sysone-0.2.0/src/sysone/questions.py +186 -0
  33. sysone-0.2.0/src/sysone/training.py +399 -0
  34. sysone-0.2.0/src/sysone/tuning.py +210 -0
  35. sysone-0.2.0/src/sysone/version.py +1 -0
  36. sysone-0.2.0/tests/__init__.py +0 -0
  37. sysone-0.2.0/tests/conftest.py +112 -0
  38. sysone-0.2.0/tests/test_architectures.py +88 -0
  39. sysone-0.2.0/tests/test_cache.py +130 -0
  40. sysone-0.2.0/tests/test_data.py +85 -0
  41. sysone-0.2.0/tests/test_evaluation.py +81 -0
  42. sysone-0.2.0/tests/test_layout.py +54 -0
  43. sysone-0.2.0/tests/test_model.py +126 -0
  44. sysone-0.2.0/tests/test_questions.py +87 -0
  45. sysone-0.2.0/tests/test_real_models.py +28 -0
  46. sysone-0.2.0/tests/test_training.py +155 -0
  47. sysone-0.2.0/tests/test_tuning.py +244 -0
@@ -0,0 +1,225 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # custom
223
+ reference/
224
+ .DS_Store
225
+ quickstart-model/
sysone-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Goutham Balaraman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
sysone-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.5
2
+ Name: sysone
3
+ Version: 0.2.0
4
+ Summary: Fine-tune and calibrate system-one decision models with a scikit-learn style fit / predict interface.
5
+ Project-URL: Homepage, https://github.com/ForwardMetric/sysone
6
+ Project-URL: Repository, https://github.com/ForwardMetric/sysone
7
+ Project-URL: Issues, https://github.com/ForwardMetric/sysone/issues
8
+ Project-URL: Design, https://github.com/ForwardMetric/sysone/blob/main/docs/DESIGN.md
9
+ Author: Goutham Balaraman
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: calibration,classification,decision models,fine-tuning,lora,modernbert,qlora,qwen,transformers
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: bitsandbytes>=0.45; sys_platform == 'linux' or sys_platform == 'win32'
27
+ Requires-Dist: huggingface-hub>=0.25
28
+ Requires-Dist: numpy>=1.26
29
+ Requires-Dist: peft>=0.13
30
+ Requires-Dist: safetensors>=0.4
31
+ Requires-Dist: torch>=2.4
32
+ Requires-Dist: transformers>=5.0
33
+ Provides-Extra: pandas
34
+ Requires-Dist: pandas>=2.0; extra == 'pandas'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # sysone
38
+
39
+ Fine-tune and calibrate "system one" decision models: small transformers that answer typed
40
+ questions (choice, score, yes/no) about a piece of text in a single forward pass. You pick a base
41
+ model, call `fit` on labelled rows and `predict` on new ones. sysone handles tokenization,
42
+ position ids, attention masks, layer freezing, the decision head and the training loop.
43
+
44
+ Supported base models: **ModernBERT** (`EncoderModel`) and **Qwen3** (`DecoderModel`). Others can
45
+ be added by writing one architecture class.
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install sysone
51
+ pip install "sysone[pandas]" # also installs pandas, for the comparison tables of `compare`
52
+ ```
53
+
54
+ On Linux and Windows this also installs bitsandbytes, for 4-bit training (`tuning="qlora"`).
55
+
56
+ ## Quickstart
57
+
58
+ ```python
59
+ from sysone import DecoderModel
60
+
61
+ questions = {
62
+ "team": {"type": "choice", "instructions": "Which team should handle it?",
63
+ "criteria": ["sales", "operations", "servicing"]},
64
+ "severity": {"type": "score", "instructions": "How severe is it?",
65
+ "criteria": ["none", "minor", "major", "critical"]},
66
+ "refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"},
67
+ }
68
+
69
+ rows = [
70
+ {"state": "Hi, my order is stuck in the warehouse and our line is down.",
71
+ "category": "operations",
72
+ "questions": questions,
73
+ "expected": {"team": "operations", "severity": 3, "refund": False}},
74
+ # ... more rows; rows may mix different question sets
75
+ ]
76
+
77
+ model = DecoderModel(tuning="head").fit(rows)
78
+
79
+ model.predict("I'd like my money back for the broken unit.", questions)
80
+ # {"answers": {"team": {"type": "choice", "choice": "servicing", "probabilities": {...}, "confidence": ...},
81
+ # "severity": {"type": "score", "score": 1.2, "legend": {...}, ...},
82
+ # "refund": {"type": "noul", "noul": 0.97, ...}},
83
+ # "usage": {"input_tokens": 118, "output_tokens": 0}}
84
+
85
+ model.save("my-model")
86
+ model = DecoderModel.load("my-model")
87
+ ```
88
+
89
+ To measure the model on held-out labelled rows, and compare it with simple baselines:
90
+
91
+ ```python
92
+ from sysone import baselines, compare
93
+
94
+ results = baselines(test_rows, train=rows) # random guess, average answer
95
+ results["trained"] = model.evaluate(test_rows)
96
+ compare(results) # accuracy per question type, as a table
97
+ ```
98
+
99
+ Answers follow the Jev `/v1/systemone` response shape. Training data can be records like the
100
+ above, records plus a shared question catalog, a long DataFrame, or a `.jsonl` / `.csv` /
101
+ `.parquet` file. Labels go in `expected`, in a `label` inside each question, or as soft `gold`
102
+ probabilities.
103
+
104
+ Example notebooks, each comparing accuracy before and after training:
105
+
106
+ - [quickstart.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/quickstart.ipynb): synthetic support tickets, a few minutes;
107
+ - bev-decision-150K, 18 domains, hard labels:
108
+ [decoder_bev_decision.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/decoder_bev_decision.ipynb) (Qwen3) and
109
+ [encoder_bev_decision.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/encoder_bev_decision.ipynb) (ModernBERT);
110
+ - typed-decisions, soft labels from several raters:
111
+ [decoder_typed_decisions.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/decoder_typed_decisions.ipynb) (Qwen3) and
112
+ [encoder_typed_decisions.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/encoder_typed_decisions.ipynb) (ModernBERT).
113
+
114
+ Notebooks other than the quickstart are named `<model type>_<dataset>.ipynb`.
115
+
116
+ ## Status
117
+
118
+ This is an early version (0.2). Training covers every `tuning` mode:
119
+
120
+ - `"head"`: the backbone is frozen, its outputs are computed once and cached (in memory, and on
121
+ disk with `cache_dir`), and only the decision head trains;
122
+ - `"lora"`, `"qlora"` and `"full"`: adapters or whole layers of the backbone train along with the
123
+ head. These run on a laptop GPU (Apple MPS) for small datasets; a CUDA GPU is recommended for
124
+ full-size runs. `"qlora"` needs bitsandbytes and an NVIDIA GPU and falls back to `"lora"`
125
+ elsewhere, with a warning. It has trained in real 4-bit on a Colab GPU.
126
+
127
+ `DecoderModel` (Qwen3) defaults to `"qlora"`. `EncoderModel` (ModernBERT) defaults to `"full"`:
128
+ adapters barely moved ModernBERT, while full tuning reached 0.79 test accuracy on typed-decisions.
129
+
130
+ Training stops at `epochs`, by early stopping, or at `target_loss`. A run that is interrupted
131
+ (Ctrl-C), or saved and loaded, resumes exactly where it stopped. Calibration and `head="full"` are
132
+ designed but not yet implemented.
133
+
134
+ See [docs/DESIGN.md](https://github.com/ForwardMetric/sysone/blob/main/docs/DESIGN.md) for the full design: every parameter, the layouts,
135
+ architectures, heads, training and checkpoint format.
136
+
137
+ ## Development
138
+
139
+ ```bash
140
+ uv sync # or: pip install -e . with the dev dependencies
141
+ uv run pytest # fast tests on tiny random-weight models, no downloads
142
+ uv run pytest -m slow # end-to-end tests on the real base models (~1.8 GB download)
143
+ uv run ruff check src tests
144
+ ```
sysone-0.2.0/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # sysone
2
+
3
+ Fine-tune and calibrate "system one" decision models: small transformers that answer typed
4
+ questions (choice, score, yes/no) about a piece of text in a single forward pass. You pick a base
5
+ model, call `fit` on labelled rows and `predict` on new ones. sysone handles tokenization,
6
+ position ids, attention masks, layer freezing, the decision head and the training loop.
7
+
8
+ Supported base models: **ModernBERT** (`EncoderModel`) and **Qwen3** (`DecoderModel`). Others can
9
+ be added by writing one architecture class.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install sysone
15
+ pip install "sysone[pandas]" # also installs pandas, for the comparison tables of `compare`
16
+ ```
17
+
18
+ On Linux and Windows this also installs bitsandbytes, for 4-bit training (`tuning="qlora"`).
19
+
20
+ ## Quickstart
21
+
22
+ ```python
23
+ from sysone import DecoderModel
24
+
25
+ questions = {
26
+ "team": {"type": "choice", "instructions": "Which team should handle it?",
27
+ "criteria": ["sales", "operations", "servicing"]},
28
+ "severity": {"type": "score", "instructions": "How severe is it?",
29
+ "criteria": ["none", "minor", "major", "critical"]},
30
+ "refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"},
31
+ }
32
+
33
+ rows = [
34
+ {"state": "Hi, my order is stuck in the warehouse and our line is down.",
35
+ "category": "operations",
36
+ "questions": questions,
37
+ "expected": {"team": "operations", "severity": 3, "refund": False}},
38
+ # ... more rows; rows may mix different question sets
39
+ ]
40
+
41
+ model = DecoderModel(tuning="head").fit(rows)
42
+
43
+ model.predict("I'd like my money back for the broken unit.", questions)
44
+ # {"answers": {"team": {"type": "choice", "choice": "servicing", "probabilities": {...}, "confidence": ...},
45
+ # "severity": {"type": "score", "score": 1.2, "legend": {...}, ...},
46
+ # "refund": {"type": "noul", "noul": 0.97, ...}},
47
+ # "usage": {"input_tokens": 118, "output_tokens": 0}}
48
+
49
+ model.save("my-model")
50
+ model = DecoderModel.load("my-model")
51
+ ```
52
+
53
+ To measure the model on held-out labelled rows, and compare it with simple baselines:
54
+
55
+ ```python
56
+ from sysone import baselines, compare
57
+
58
+ results = baselines(test_rows, train=rows) # random guess, average answer
59
+ results["trained"] = model.evaluate(test_rows)
60
+ compare(results) # accuracy per question type, as a table
61
+ ```
62
+
63
+ Answers follow the Jev `/v1/systemone` response shape. Training data can be records like the
64
+ above, records plus a shared question catalog, a long DataFrame, or a `.jsonl` / `.csv` /
65
+ `.parquet` file. Labels go in `expected`, in a `label` inside each question, or as soft `gold`
66
+ probabilities.
67
+
68
+ Example notebooks, each comparing accuracy before and after training:
69
+
70
+ - [quickstart.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/quickstart.ipynb): synthetic support tickets, a few minutes;
71
+ - bev-decision-150K, 18 domains, hard labels:
72
+ [decoder_bev_decision.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/decoder_bev_decision.ipynb) (Qwen3) and
73
+ [encoder_bev_decision.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/encoder_bev_decision.ipynb) (ModernBERT);
74
+ - typed-decisions, soft labels from several raters:
75
+ [decoder_typed_decisions.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/decoder_typed_decisions.ipynb) (Qwen3) and
76
+ [encoder_typed_decisions.ipynb](https://github.com/ForwardMetric/sysone/blob/main/examples/encoder_typed_decisions.ipynb) (ModernBERT).
77
+
78
+ Notebooks other than the quickstart are named `<model type>_<dataset>.ipynb`.
79
+
80
+ ## Status
81
+
82
+ This is an early version (0.2). Training covers every `tuning` mode:
83
+
84
+ - `"head"`: the backbone is frozen, its outputs are computed once and cached (in memory, and on
85
+ disk with `cache_dir`), and only the decision head trains;
86
+ - `"lora"`, `"qlora"` and `"full"`: adapters or whole layers of the backbone train along with the
87
+ head. These run on a laptop GPU (Apple MPS) for small datasets; a CUDA GPU is recommended for
88
+ full-size runs. `"qlora"` needs bitsandbytes and an NVIDIA GPU and falls back to `"lora"`
89
+ elsewhere, with a warning. It has trained in real 4-bit on a Colab GPU.
90
+
91
+ `DecoderModel` (Qwen3) defaults to `"qlora"`. `EncoderModel` (ModernBERT) defaults to `"full"`:
92
+ adapters barely moved ModernBERT, while full tuning reached 0.79 test accuracy on typed-decisions.
93
+
94
+ Training stops at `epochs`, by early stopping, or at `target_loss`. A run that is interrupted
95
+ (Ctrl-C), or saved and loaded, resumes exactly where it stopped. Calibration and `head="full"` are
96
+ designed but not yet implemented.
97
+
98
+ See [docs/DESIGN.md](https://github.com/ForwardMetric/sysone/blob/main/docs/DESIGN.md) for the full design: every parameter, the layouts,
99
+ architectures, heads, training and checkpoint format.
100
+
101
+ ## Development
102
+
103
+ ```bash
104
+ uv sync # or: pip install -e . with the dev dependencies
105
+ uv run pytest # fast tests on tiny random-weight models, no downloads
106
+ uv run pytest -m slow # end-to-end tests on the real base models (~1.8 GB download)
107
+ uv run ruff check src tests
108
+ ```