Text Generation
MLX
Safetensors
English
information-extraction
structured-output
json
small-language-model
apple-silicon
from-scratch
post-training
research
Instructions to use OpenSML/OpenSML-JSONLite-175M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenSML/OpenSML-JSONLite-175M with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("OpenSML/OpenSML-JSONLite-175M") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use OpenSML/OpenSML-JSONLite-175M with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "OpenSML/OpenSML-JSONLite-175M" --prompt "Once upon a time"
- Atomic Chat
Group each usage example with its instruction, text, schema and output
Browse files- README.md +129 -50
- SHA256SUMS +1 -1
README.md
CHANGED
|
@@ -65,26 +65,26 @@ Supply source text and a flat object JSON Schema with 1–8 required properties
|
|
| 65 |
|
| 66 |
## Verified source/schema/output examples
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
Source text
|
| 81 |
|
| 82 |
-
|
| 83 |
-
Play the track Blue Lantern by Mira Sol.
|
| 84 |
-
```
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
|
|
|
| 88 |
|
| 89 |
```json
|
| 90 |
{
|
|
@@ -121,29 +121,51 @@ Play the track Blue Lantern by Mira Sol.
|
|
| 121 |
}
|
| 122 |
```
|
| 123 |
|
| 124 |
-
|
| 125 |
|
| 126 |
-
|
| 127 |
-
<summary>View generated JSON</summary>
|
| 128 |
|
| 129 |
```json
|
| 130 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
```
|
| 132 |
|
|
|
|
|
|
|
| 133 |
</details>
|
| 134 |
|
| 135 |
-
|
|
|
|
| 136 |
|
| 137 |
### Restaurant request
|
| 138 |
|
| 139 |
-
|
|
|
|
| 140 |
|
| 141 |
-
|
| 142 |
-
Book River Moon in Denver for four people tomorrow.
|
| 143 |
-
```
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
```json
|
| 149 |
{
|
|
@@ -188,29 +210,56 @@ Book River Moon in Denver for four people tomorrow.
|
|
| 188 |
}
|
| 189 |
```
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
| 194 |
-
<summary>View generated JSON</summary>
|
| 195 |
|
| 196 |
```json
|
| 197 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
```
|
| 199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
</details>
|
| 201 |
|
| 202 |
-
|
|
|
|
| 203 |
|
| 204 |
### Multiple artists
|
| 205 |
|
| 206 |
-
|
|
|
|
| 207 |
|
| 208 |
-
|
| 209 |
-
Play songs by Mira Sol and Theo Lane.
|
| 210 |
-
```
|
| 211 |
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
```json
|
| 216 |
{
|
|
@@ -239,29 +288,49 @@ Play songs by Mira Sol and Theo Lane.
|
|
| 239 |
}
|
| 240 |
```
|
| 241 |
|
| 242 |
-
|
| 243 |
|
| 244 |
-
|
| 245 |
-
<summary>View generated JSON</summary>
|
| 246 |
|
| 247 |
```json
|
| 248 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
```
|
| 250 |
|
|
|
|
|
|
|
| 251 |
</details>
|
| 252 |
|
| 253 |
-
|
|
|
|
| 254 |
|
| 255 |
### Nullable fields
|
| 256 |
|
| 257 |
-
|
|
|
|
| 258 |
|
| 259 |
-
|
| 260 |
-
Play the last theme by Behzad Mirkhani.
|
| 261 |
-
```
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
```json
|
| 267 |
{
|
|
@@ -299,18 +368,28 @@ Play the last theme by Behzad Mirkhani.
|
|
| 299 |
}
|
| 300 |
```
|
| 301 |
|
| 302 |
-
|
| 303 |
|
| 304 |
-
|
| 305 |
-
<summary>View generated JSON</summary>
|
| 306 |
|
| 307 |
```json
|
| 308 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
```
|
| 310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
</details>
|
| 312 |
|
| 313 |
-
Run: `python inference.py --example 48`.
|
| 314 |
|
| 315 |
## Training
|
| 316 |
|
|
|
|
| 65 |
|
| 66 |
## Verified source/schema/output examples
|
| 67 |
|
| 68 |
+
Each example below is a complete walkthrough: **Prompt instruction + Source text + JSON Schema → Model output**. Open an example to see all four parts together.
|
| 69 |
|
| 70 |
+
The instruction, source text and schema are the model's inputs. The model output is its observed response—not part of the prompt. These examples were verified with the released model; other requests can fail.
|
| 71 |
|
| 72 |
+
### Track and artist
|
| 73 |
|
| 74 |
+
<details open>
|
| 75 |
+
<summary><strong>Example 1: Track and artist — prompt, source text, schema and output</strong></summary>
|
| 76 |
|
| 77 |
+
#### 1. Prompt instruction
|
| 78 |
|
| 79 |
+
> Extract information from the supplied source_text according to the supplied JSON Schema. Return exactly one JSON object, with no explanation or Markdown. Copy values exactly, preserving case and spelling; do not normalize dates or numbers. Include every required key and no other keys. For string arrays, include all matching source spans in source order, or [] when absent. For nullable strings, use the exact source span or null when absent.
|
| 80 |
|
| 81 |
+
#### 2. Source text
|
| 82 |
|
| 83 |
+
> Play the track Blue Lantern by Mira Sol.
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
#### 3. JSON Schema
|
| 86 |
+
|
| 87 |
+
This defines the requested fields and their types.
|
| 88 |
|
| 89 |
```json
|
| 90 |
{
|
|
|
|
| 121 |
}
|
| 122 |
```
|
| 123 |
|
| 124 |
+
#### 4. Model output
|
| 125 |
|
| 126 |
+
The JSON below is generated by the model. It is shown here for reference and is not sent as an input.
|
|
|
|
| 127 |
|
| 128 |
```json
|
| 129 |
+
{
|
| 130 |
+
"track": [
|
| 131 |
+
"Blue Lantern"
|
| 132 |
+
],
|
| 133 |
+
"artist": [
|
| 134 |
+
"Mira Sol"
|
| 135 |
+
],
|
| 136 |
+
"album": []
|
| 137 |
+
}
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
**Try this example locally:**
|
| 141 |
+
|
| 142 |
+
```bash
|
| 143 |
+
python inference.py --example 29
|
| 144 |
```
|
| 145 |
|
| 146 |
+
This command supplies the instruction, source text and schema automatically.
|
| 147 |
+
|
| 148 |
</details>
|
| 149 |
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
|
| 153 |
### Restaurant request
|
| 154 |
|
| 155 |
+
<details>
|
| 156 |
+
<summary><strong>Example 2: Restaurant request — prompt, source text, schema and output</strong></summary>
|
| 157 |
|
| 158 |
+
#### 1. Prompt instruction
|
|
|
|
|
|
|
| 159 |
|
| 160 |
+
> Extract information from the supplied source_text according to the supplied JSON Schema. Return exactly one JSON object, with no explanation or Markdown. Copy values exactly, preserving case and spelling; do not normalize dates or numbers. Include every required key and no other keys. For string arrays, include all matching source spans in source order, or [] when absent. For nullable strings, use the exact source span or null when absent.
|
| 161 |
+
|
| 162 |
+
#### 2. Source text
|
| 163 |
+
|
| 164 |
+
> Book River Moon in Denver for four people tomorrow.
|
| 165 |
+
|
| 166 |
+
#### 3. JSON Schema
|
| 167 |
+
|
| 168 |
+
This defines the requested fields and their types.
|
| 169 |
|
| 170 |
```json
|
| 171 |
{
|
|
|
|
| 210 |
}
|
| 211 |
```
|
| 212 |
|
| 213 |
+
#### 4. Model output
|
| 214 |
|
| 215 |
+
The JSON below is generated by the model. It is shown here for reference and is not sent as an input.
|
|
|
|
| 216 |
|
| 217 |
```json
|
| 218 |
+
{
|
| 219 |
+
"restaurant_name": [
|
| 220 |
+
"River Moon"
|
| 221 |
+
],
|
| 222 |
+
"city": [
|
| 223 |
+
"Denver"
|
| 224 |
+
],
|
| 225 |
+
"party_size_number": [
|
| 226 |
+
"four"
|
| 227 |
+
],
|
| 228 |
+
"timeRange": [
|
| 229 |
+
"tomorrow"
|
| 230 |
+
]
|
| 231 |
+
}
|
| 232 |
```
|
| 233 |
|
| 234 |
+
**Try this example locally:**
|
| 235 |
+
|
| 236 |
+
```bash
|
| 237 |
+
python inference.py --example 30
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
This command supplies the instruction, source text and schema automatically.
|
| 241 |
+
|
| 242 |
</details>
|
| 243 |
|
| 244 |
+
|
| 245 |
+
---
|
| 246 |
|
| 247 |
### Multiple artists
|
| 248 |
|
| 249 |
+
<details>
|
| 250 |
+
<summary><strong>Example 3: Multiple artists — prompt, source text, schema and output</strong></summary>
|
| 251 |
|
| 252 |
+
#### 1. Prompt instruction
|
|
|
|
|
|
|
| 253 |
|
| 254 |
+
> Extract information from the supplied source_text according to the supplied JSON Schema. Return exactly one JSON object, with no explanation or Markdown. Copy values exactly, preserving case and spelling; do not normalize dates or numbers. Include every required key and no other keys. For string arrays, include all matching source spans in source order, or [] when absent. For nullable strings, use the exact source span or null when absent.
|
| 255 |
+
|
| 256 |
+
#### 2. Source text
|
| 257 |
+
|
| 258 |
+
> Play songs by Mira Sol and Theo Lane.
|
| 259 |
+
|
| 260 |
+
#### 3. JSON Schema
|
| 261 |
+
|
| 262 |
+
This defines the requested fields and their types.
|
| 263 |
|
| 264 |
```json
|
| 265 |
{
|
|
|
|
| 288 |
}
|
| 289 |
```
|
| 290 |
|
| 291 |
+
#### 4. Model output
|
| 292 |
|
| 293 |
+
The JSON below is generated by the model. It is shown here for reference and is not sent as an input.
|
|
|
|
| 294 |
|
| 295 |
```json
|
| 296 |
+
{
|
| 297 |
+
"artist": [
|
| 298 |
+
"Mira Sol",
|
| 299 |
+
"Theo Lane"
|
| 300 |
+
],
|
| 301 |
+
"album": []
|
| 302 |
+
}
|
| 303 |
+
```
|
| 304 |
+
|
| 305 |
+
**Try this example locally:**
|
| 306 |
+
|
| 307 |
+
```bash
|
| 308 |
+
python inference.py --example 35
|
| 309 |
```
|
| 310 |
|
| 311 |
+
This command supplies the instruction, source text and schema automatically.
|
| 312 |
+
|
| 313 |
</details>
|
| 314 |
|
| 315 |
+
|
| 316 |
+
---
|
| 317 |
|
| 318 |
### Nullable fields
|
| 319 |
|
| 320 |
+
<details>
|
| 321 |
+
<summary><strong>Example 4: Nullable fields — prompt, source text, schema and output</strong></summary>
|
| 322 |
|
| 323 |
+
#### 1. Prompt instruction
|
|
|
|
|
|
|
| 324 |
|
| 325 |
+
> Extract information from the supplied source_text according to the supplied JSON Schema. Return exactly one JSON object, with no explanation or Markdown. Copy values exactly, preserving case and spelling; do not normalize dates or numbers. Include every required key and no other keys. For string arrays, include all matching source spans in source order, or [] when absent. For nullable strings, use the exact source span or null when absent.
|
| 326 |
+
|
| 327 |
+
#### 2. Source text
|
| 328 |
+
|
| 329 |
+
> Play the last theme by Behzad Mirkhani.
|
| 330 |
+
|
| 331 |
+
#### 3. JSON Schema
|
| 332 |
+
|
| 333 |
+
This defines the requested fields and their types.
|
| 334 |
|
| 335 |
```json
|
| 336 |
{
|
|
|
|
| 368 |
}
|
| 369 |
```
|
| 370 |
|
| 371 |
+
#### 4. Model output
|
| 372 |
|
| 373 |
+
The JSON below is generated by the model. It is shown here for reference and is not sent as an input.
|
|
|
|
| 374 |
|
| 375 |
```json
|
| 376 |
+
{
|
| 377 |
+
"playlist": null,
|
| 378 |
+
"music_item": "theme",
|
| 379 |
+
"service": null
|
| 380 |
+
}
|
| 381 |
```
|
| 382 |
|
| 383 |
+
**Try this example locally:**
|
| 384 |
+
|
| 385 |
+
```bash
|
| 386 |
+
python inference.py --example 48
|
| 387 |
+
```
|
| 388 |
+
|
| 389 |
+
This command supplies the instruction, source text and schema automatically.
|
| 390 |
+
|
| 391 |
</details>
|
| 392 |
|
|
|
|
| 393 |
|
| 394 |
## Training
|
| 395 |
|
SHA256SUMS
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
74a074f90bd5e7a26d5f6cd5757ddc1fbfcc72e259e0b23a210fa48d91b35fdb JSONLITE_RESULTS.json
|
| 5 |
c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE
|
| 6 |
f53194e53a2af5ec857337e8213397ea4f81a7e02d2dbcf0384a00cf1cf7f76f PACKAGING_VERIFICATION.json
|
| 7 |
-
|
| 8 |
5ee8f11f0e87becf1a29c44e2b0f3dacc2c779712b635558be57dd7ef44455d3 RUN_GUIDE.md
|
| 9 |
c6191baf937bce61f1b747acfbcb975a17eef6e8a598682a751a1031d1cfee23 SOURCE_NOTICE.md
|
| 10 |
6088771ab13fa1080c0ca0f31649deb9f417597d7c2055b0f388e86f41f2c415 TECHNICAL_REPORT.md
|
|
|
|
| 4 |
74a074f90bd5e7a26d5f6cd5757ddc1fbfcc72e259e0b23a210fa48d91b35fdb JSONLITE_RESULTS.json
|
| 5 |
c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE
|
| 6 |
f53194e53a2af5ec857337e8213397ea4f81a7e02d2dbcf0384a00cf1cf7f76f PACKAGING_VERIFICATION.json
|
| 7 |
+
e4904f5bfd95f87e67a8de6cb0874c397babef23c44a16ed53ec73e5480a5407 README.md
|
| 8 |
5ee8f11f0e87becf1a29c44e2b0f3dacc2c779712b635558be57dd7ef44455d3 RUN_GUIDE.md
|
| 9 |
c6191baf937bce61f1b747acfbcb975a17eef6e8a598682a751a1031d1cfee23 SOURCE_NOTICE.md
|
| 10 |
6088771ab13fa1080c0ca0f31649deb9f417597d7c2055b0f388e86f41f2c415 TECHNICAL_REPORT.md
|