A 360M parameter model fine-tuned for high-accuracy JSON extraction. v1.2 introduces extended context (2048 tokens) for improved complex schema handling.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3import torch
4
5# Load model
6base = AutoModelForCausalLM.from_pretrained(
7 "HuggingFaceTB/SmolLM2-360M",
8 torch_dtype=torch.float16,
9 device_map="auto"
10)
11model = PeftModel.from_pretrained(base, "CycleCoreTechnologies/Maaza-SLM-360M-JSON-v1.2")
12tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-360M")
13
14# Inference
15prompt = """Extract the structured JSON data from the following text. Use snake_case for all keys.
16
17Input: Order #12345 from Jane Smith (jane@example.com). Items: Widget x2 ($19.99), Gadget ($49.99). Ship to 123 Main St, Springfield IL 62701. Total $89.97.
18
19Output:"""
20
21inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
22outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
23print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("Output:")[-1])
1{
2 "order_id": "12345",
3 "customer": {"name": "Jane Smith", "email": "jane@example.com"},
4 "items": [
5 {"name": "Widget", "quantity": 2, "price": 19.99},
6 {"name": "Gadget", "quantity": 1, "price": 49.99}
7 ],
8 "shipping": {"street": "123 Main St", "city": "Springfield", "state": "IL", "zip": "62701"},
9 "total": 89.97
10}
1git clone https://github.com/CycleCore-Technologies/slmbench
2cd slmbench
3pip install -r requirements.txt
4
5python benchmarks/edge_json/scripts/eval.py \
6 --model HuggingFaceTB/SmolLM2-360M \
7 --adapter CycleCoreTechnologies/Maaza-SLM-360M-JSON-v1.2 \
8 --dataset benchmarks/edge_json/data/edgejson_test_v3.jsonl \
9 --device cuda
1@misc{cyclecore2025maaza,
2 title={Maaza SLM-360M-JSON: Small Language Model for JSON Extraction},
3 author={CycleCore Technologies},
4 year={2025},
5 howpublished={\url{https://huggingface.co/CycleCoreTechnologies/Maaza-SLM-360M-JSON-v1.2}}
6}