| Decision | Description |
|---|---|
| NEXT | Proceed to the next sequential step |
| RETRY | Retry the current step (within budget) |
| FORK | Launch parallel execution branches |
| JOIN | Synchronize parallel branches |
| META | Escalate — anomaly detected, human intervention needed |
| Category | v2 SLM | GPT-4.1 | GPT-4o-mini | Base SLM |
|---|---|---|---|---|
| NEXT | 10/22 (45%) | 6/22 (27%) | 2/22 (9%) | 16/22 (73%) |
| RETRY | 7/12 (58%) | 11/12 (92%) | 12/12 (100%) | 3/12 (25%) |
| FORK | 13/14 (93%) | 14/14 (100%) | 14/14 (100%) | 1/14 (7%) |
| JOIN | 10/15 (67%) | 10/15 (67%) | 12/15 (80%) | 0/15 (0%) |
| META | 2/13 (15%) | 0/13 (0%) | 0/13 (0%) | 8/13 (62%) |
| TOTAL | 42/76 (55.3%) | 41/76 (53.9%) | 40/76 (52.6%) | 28/76 (36.8%) |
| Parameter | Value |
|---|---|
| Rank | 16 |
| Alpha (scale) | 32 (2.0x) |
| Dropout | 0.02 |
| Target layers | Last 28 of 32 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Parameter | Value |
|---|---|
| Framework | MLX (Apple Silicon native) |
| Hardware | Apple M4 Pro, 48GB unified memory |
| Stage A iters | 800 |
| Stage B iters | 100 |
| Batch size | 4 |
| Learning rate | 3e-5 (alignment stage) |
| Sequence length | 512 |
| Prompt masking | Yes (loss only on assistant tokens) |
| Iteration | Val Loss | Train Loss |
|---|---|---|
| 1 (start) | 14.536 | — |
| 50 | 0.134 | 0.273 |
| 100 (final) | 0.099 | 0.135 |
1from mlx_lm import load, generate
2from mlx_lm.sample_utils import make_sampler
3
4model, tokenizer = load(
5 "Qwen/Qwen2.5-7B-Instruct",
6 adapter_path="ssaraf1/slm-workflow-planner-7b-v2"
7)
8
9messages = [
10 {"role": "system", "content": "You are a workflow planner. Given the current workflow state, eligible nodes, and topology information, classify the decision type. Respond with exactly one of: NEXT, RETRY, FORK, JOIN, META"},
11 {"role": "user", "content": "Current node: TRIAGE_AND_ASSIGN (AGENT)\nOutcome: assigned\n\nState:\n goal_progress=0.15\n parallel_active=0\n resource_pressure=0.1\n\nEligible nodes:\n 1. VERIFY_POLICY (SYSTEM) → produces: policy_status\n 2. FRAUD_SCREENING (SYSTEM) → produces: fraud_score\n 3. DAMAGE_ASSESSMENT (AGENT) → produces: damage_report\n\nForkable sets: [{VERIFY_POLICY, FRAUD_SCREENING, DAMAGE_ASSESSMENT}]\nJoin-ready: []\n\nWhat decision type?"}
12]
13
14prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
15sampler = make_sampler(temp=0.0)
16response = generate(model, tokenizer, prompt=prompt, max_tokens=10, sampler=sampler)
17print(response) # Expected: FORK| Scenario | Topology says | State says | Model learns |
|---|---|---|---|
| Forkable + low pressure | FORK | Go parallel | FORK ✅ |
| Forkable + high pressure | FORK | Don't parallelize | NEXT ✅ |
| Join-ready + parallel active | JOIN | Merge now | JOIN ✅ |
| Join-ready + no parallel | JOIN | Not ready | NEXT ✅ |
decision = f(state signals, topology, actors), not domain-specific
workflow paths. This enables generalization to unseen workflow structures.adapters.safetensors — LoRA adapter weights (base iter 800 + alignment iter 100)adapter_config.json — LoRA configuration for MLX