sameer-saraf-quant-ai/slm-workflow-planner-v8-mlx
0
SLM Workflow Planner v8 — Context-Contract Planning (MLX LoRA)
Overview
v8 is a Stage 2 enhancement of the SLM Workflow Planner. It extends the v3-best checkpoint with context-contract planning — the ability to make routing decisions based on the required_context and produces_context of ALL nodes in a workflow graph, not just directly connected edges.
This enables three new capabilities:
- Recovery Routing (Backjump): On failure, jump backward to an earlier context-satisfiable node
- Stage Skipping: Skip unnecessary stages when required context is already available (e.g., walk-in customers)
- Non-Adjacent Parallelism: Fork two independent context-satisfiable nodes that aren't connected by fork-edges
Model Details
Training
Training Data Distribution
🛡 = Protected from downsampling during balancing
Prompt Format
The model uses a tiered prompt with two candidate sections:
Current node: NODE_A (SYSTEM, stage 3)
Outcome: success
Failure type: none
State:
goal_progress=0.40
retry_count=0
...
Produced context: {ctx_start, intake_data, assessment_score}
Edge candidates (normal path):
1. NODE_B (AGENT) [processor] → requires: {assessment_score} → produces: {approval}
Context-eligible (off-path, invocable now):
1. NODE_X (SYSTEM, stage 5, gap=+2) [validator] → requires: {intake_data} ✓ → produces: {validation}
Forkable sets: []
Join-ready: []
What is the best action?Output format: DECISION_TYPE NODE_ID
NEXT NODE_B— advance to NODE_BFORK NODE_A, NODE_B— parallel forkRETRY NODE_A— retry currentJOIN NODE_A— merge parallel branchesMETA— escalate to human
Evaluation Results
Section A: Stratified Test (100 held-out samples)
Section B: Tier-2 Specific (90 held-out samples)
Key Capabilities
- Context-Contract Reasoning: Evaluates
required_context ⊆ produced_keysto identify all invocable nodes - Recovery Routing: Backjumps on process/resource failure when no edge retry exists
- Stage Skipping: Advances to forward context-eligible nodes at dead-ends
- Non-Adjacent Parallelism: Forks independent context-eligible nodes with different actors
- Negative Contrast: Learned "satisfiable ≠ sensible" — doesn't take Tier-2 when edge path is correct
Usage (MLX)
from mlx_lm import load, generate
model, tokenizer = load(
"Qwen/Qwen2.5-7B-Instruct",
adapter_path="sameer-saraf-quant-ai/slm-workflow-planner-v8-mlx"
)
messages = [
{"role": "system", "content": "You are a workflow planner..."},
{"role": "user", "content": "<tiered prompt>"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=30)
print(response) # "NEXT ESTIMATION_AND_APPROVAL"Ensemble Recommendation
For production use, combine with GPT-4.1 arbiter for the ~10% edge cases (mainly JOIN confusion):
- v8 handles 90%+ of decisions autonomously
- GPT validates uncertain decisions (estimated 5-10% of traffic)
Architecture Context
This adapter is part of the Agentic OS system:
- Temporal handles durable execution and state management
- Neo4j stores workflow graph definitions
- SLM (this model) makes real-time routing decisions
- Guardrails validate SLM output before execution
