Views
No views yet
Osmosis-Structure-0.6B: Small Language Model for Structured OutputsOsmosis-Structure-0.6B is a specialized small language model (SLM) designed to excel at structured output generation. Despite its compact 0.6B parameter size, this model demonstrates remarkable performance on extracting structured information when paired with supported frameworks.
Osmosis-Structure-0.6B.| Model | Structured Output | Structured w/ Osmosis | Performance Gain |
|---|---|---|---|
| Claude 4 Sonnet | 15.52% | 69.40% | +347% |
| Claude 4 Opus | 15.28% | 69.91% | +357% |
| GPT-4.1 | 10.53% | 70.03% | +565% |
| OpenAI o3 | 91.14% | 94.05% | +2.9% |
| Model | Structured Output | Structured w/ Osmosis | Performance Gain |
|---|---|---|---|
| Claude 4 Sonnet | 16.29% | 62.59% | +284% |
| Claude 4 Opus | 22.94% | 65.06% | +184% |
| GPT-4.1 | 2.79% | 39.66% | +1322% |
| OpenAI o3 | 92.05% | 93.24% | +1.3% |
Key Insight: These results demonstrate that by allowing models to think freely and leverage test time compute, we are able to increase performance and still maintain the structured guarantee after the fact with a SLM.Osmosis-Structure-0.6Bis specifically designed and optimized to maximize these benefits in a compact 0.6B parameter model.
Osmosis-Structure-0.6B is built on top of Qwen3-0.6B. We first established a baseline format using 10 samples of randomly generated text and their JSON interpretations. We then applied reinforcement learning to approximately 500,000 examples of JSON-to-natural language pairs, consisting of either reasoning traces with their final outputs, or natural language reports with their expected structured formats.python3 -m sglang.launch_server --model-path osmosis-ai/Osmosis-Structure-0.6B --host 0.0.0.0 --api-key osmosis1import json
2from openai import OpenAI
3
4api_key = "osmosis"
5api_base_url = "http://0.0.0.0:30000/v1"
6client = OpenAI(
7 api_key=api_key,
8 base_url=api_base_url,
9)
10
11# Schema for extracting structured output from reasoning traces
12json_schema = json.dumps(
13 {
14 "type": "object",
15 "properties": {
16 "answer": {"type": "string"}
17 },
18 "required": ["answer"]
19 }
20)
21
22# You can also dump pydantic models to json schema as well
23
24# Example reasoning trace input
25reasoning_trace = """
26Problem: Solve for x in the equation 2x + 5 = 13
27
28Let me work through this step by step:
29
30First, I need to isolate the term with x. I'll subtract 5 from both sides:
312x + 5 - 5 = 13 - 5
322x = 8
33
34Next, I'll divide both sides by 2 to solve for x:
352x ÷ 2 = 8 ÷ 2
36x = 4
37
38Let me verify this answer by substituting back into the original equation:
392(4) + 5 = 8 + 5 = 13 ✓
40
41Ok, which means I got the correct answer, and I'm confident about my answer.
42"""
43response = client.chat.completions.create(
44 model="osmosis-ai/Osmosis-Structure-0.6B",
45 messages=[
46 {
47 "role": "system",
48 "content": f"You are a helpful assistant that understands and translates text to JSON format according to the following schema. {json_schema}"
49 },
50 {
51 "role": "user",
52 "content": reasoning_trace,
53 },
54 ],
55 temperature=0,
56 max_tokens=512,
57 response_format={
58 "type": "json_schema",
59 "json_schema": {"name": "reasoning_extraction", "schema": json.loads(json_schema)},
60 },
61)
62
63print(json.dumps(json.loads(response.choices[0].message.content), indent=2))1from ollama import chat
2from pydantic import BaseModel
3
4class Answer(BaseModel):
5 answer: int
6
7reasoning_trace = """
8Problem: Solve for x in the equation 2x + 5 = 13
9
10Let me work through this step by step:
11
12First, I need to isolate the term with x. I'll subtract 5 from both sides:
132x + 5 - 5 = 13 - 5
142x = 8
15
16Next, I'll divide both sides by 2 to solve for x:
172x ÷ 2 = 8 ÷ 2
18x = 4
19
20Let me verify this answer by substituting back into the original equation:
212(4) + 5 = 8 + 5 = 13 ✓
22
23Ok, which means I got the correct answer, and I'm confident about my answer.
24"""
25
26response = chat(
27 messages=[
28 {
29 "role": "system",
30 "content": f"You are a helpful assistant that understands and translates text to JSON format according to the following schema. {Answer.model_json_schema()}"
31 },
32 {
33 'role': 'user',
34 'content': reasoning_trace,
35 }
36 ],
37 model='Osmosis/Osmosis-Structure-0.6B',
38 format=Answer.model_json_schema(),
39)
40
41answer = Answer.model_validate_json(response.message.content)
42print(answer)