Model details
- Developed by: AI Family
- Shared by: Muhammad Bin Zohaib (@mbz14151)
- GitHub: ProMBZ
- Model type: Qwen3-1.7B LoRA adapter
- Task: n8n workflow diagnosis and repair suggestions
- Language: English
- Base model: Qwen3-1.7B
- Training method: 4-bit QLoRA
- License: Apache-2.0
- Training platform: Google Colab
This repository contains the trained adapter and tokenizer files, not the complete base model. The original Qwen3 base model is required to use it.
What the model can do
The model was trained to recognize eight categories of n8n workflow failures, covering 48 diagnosis codes.
Table with columns: Category, Examples of problems| Category | Examples of problems |
|---|
| Expression | Invalid syntax, missing expression prefixes, incorrect node references |
| Data mapping | Missing fields, nested paths, incorrect array indexes, type conversion |
| Item linking | Incorrect item selectors, missing paired-item metadata, lost lineage |
| Node configuration | HTTP methods, request bodies, response formats and timeouts |
| Workflow structure | Missing connections, disconnected nodes, incorrect IF branches |
| Code node | Invalid output structures, undefined variables and execution modes |
| Execution API | API payload errors, rate limits, timeouts and network failures |
| Credentials | Authentication failures, expired OAuth and missing credentials |
Expected output
The model returns a structured JSON object with six fields:
category
diagnosis_code
faulty_node
root_cause
patch
needs_human_review
Repairs are proposed as minimal JSON Patch operations. The model does not automatically modify or execute a live n8n workflow.
Evaluation results
We evaluated the original Qwen3-1.7B model and our fine-tuned adapter using the same held-out prompts.
Main evaluation: 192 cases
Table with columns: Metric, Base Qwen3-1.7B, Fine-tuned| Metric | Base Qwen3-1.7B | Fine-tuned |
|---|
| Valid JSON | 3.1% | 100% |
| Valid schema | 1.6% | 97.4% |
| Category accuracy | 1.0% | 90.6% |
| Diagnosis code accuracy | 0.0% | 85.4% |
| Gold patch match | 0.5% | 75.0% |
| Human-review decision accuracy | 0.5% | 99.5% |
| Safe-abstention F1 | 5.0% | 98.6% |
| Patch applicability | N/A | 91.1% |
The fine-tuned model correctly identified 164 of 192 diagnosis cases and produced valid JSON for all 192.
Independent challenge evaluation: 48 cases
We also evaluated the model on a separate challenge set containing one held-out example for each of the 48 diagnosis codes.
Table with columns: Metric, Base Qwen3-1.7B, Fine-tuned| Metric | Base Qwen3-1.7B | Fine-tuned |
|---|
| Valid JSON | 0.0% | 100% |
| Valid schema | 0.0% | 97.9% |
| Category accuracy | 0.0% | 97.9% |
| Diagnosis code accuracy | 0.0% | 91.7% |
| Gold patch match | 0.0% | 70.8% |
| Human-review decision accuracy | 0.0% | 100% |
| Safe-abstention F1 | 0.0% | 100% |
| Patch applicability | N/A | 94.6% |
The fine-tuned model correctly diagnosed 44 of the 48 independent challenge cases.
Diagnosis accuracy by category
Main evaluation:
Table with columns: Category, Accuracy| Category | Accuracy |
|---|
| Expression | 95.8% |
| Data mapping | 58.3% |
| Item linking | 79.2% |
| Node configuration | 91.7% |
| Workflow structure | 95.8% |
| Code node | 79.2% |
| Execution API | 83.3% |
| Credentials | 100% |
Data mapping remains the area with the most room for improvement. These category-level results also have small sample sizes, so they should be interpreted carefully.
Understanding the metrics
- Diagnosis accuracy: Both the predicted category and diagnosis code must match the reference.
- Gold patch match: The proposed JSON Patch must exactly match the reference patch.
- Patch applicability: The patch must pass the project's JSON Patch and synthetic workflow-structure checks.
- Human-review accuracy: Agreement with the reference human-review decisions.
- Safe-abstention F1: Measures how well the model identifies cases requiring review.
Exact complete-response matching was 0% in both evaluations. This stricter metric requires every output field, including free-text explanations, to match the reference exactly; it is not the same as diagnosis accuracy or patch matching.
Training details
We used Unsloth and QLoRA to fine-tune Qwen3-1.7B while keeping the original base weights frozen.
Training configuration
Table with columns: Setting, Value| Setting | Value |
|---|
| Base model | Qwen3-1.7B |
| Quantization | 4-bit |
| Method | QLoRA |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Learning rate | 0.00001 |
| Epochs | 2 |
| Maximum sequence length | 2,048 |
| Per-device batch size | 1 |
| Gradient accumulation | 8 |
| Random seed | 42 |
| Training platform | Google Colab |
The training used conversational prompt/completion examples and completion-only loss.
Training dataset
The dataset contains synthetic n8n troubleshooting scenarios designed around realistic workflow failure patterns.
Table with columns: Split, Examples| Split | Examples |
|---|
| Training | 3,072 |
| Validation | 156 |
| Main held-out evaluation | 192 |
| Independent challenge evaluation | 48 |
| Total | 3,468 |
The training source pool contains 1,528 independently authored scenarios. The remaining prepared training examples are controlled deterministic variations used to balance the 48 diagnosis codes.
The training dataset covers eight categories and 48 diagnosis codes, with 64 prepared training examples per code.
All added training scenarios are synthetic. The two evaluation sets were kept separate from training and validation.
Dataset and preparation code: GitHub repository
How to use the adapter
Install the required libraries:
pip install torch transformers peft accelerate bitsandbytes
Load the original base model and the published adapter:
import torchfrom transformers import AutoTokenizer, AutoModelForCausalLM ADAPTER = "mbz14151/ai-family-qwen3-n8n-workflow-repair" # Load tokenizertokenizer = AutoTokenizer.from_pretrained(ADAPTER) # Automatically loads the base model from adapter_config.json# and attaches the trained LoRA adapter.model = AutoModelForCausalLM.from_pretrained( ADAPTER, device_map="auto") model.eval() messages = [ { "role": "system", "content": ( "Diagnose n8n workflow failures using the supplied " "workflow evidence. Return exactly one JSON object with " "category, diagnosis_code, faulty_node, root_cause, " "patch, and needs_human_review. Never invent a repair. " "Request human review when the evidence is insufficient." ) }, { "role": "user", "content": "Provide the workflow JSON and execution error here." }] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt", enable_thinking=False).to(model.device) with torch.inference_mode(): outputs = model.generate( **inputs, max_new_tokens=384, do_sample=False ) response = outputs[0][inputs["input_ids"].shape[-1]:] print( tokenizer.decode( response, skip_special_tokens=True ))
For results comparable to our reported benchmarks, use the full structured prompt, diagnosis codebook and official n8n documentation retrieval implemented in our training and evaluation notebook. The short example above demonstrates adapter loading, not the complete benchmark pipeline.
Limitations and responsible use
This is a research and demonstration model, not an autonomous production repair system.
- The training and evaluation scenarios are synthetic, not a production incident dataset.
- The main evaluation contains four examples per diagnosis code, while the independent challenge contains one per code.
- Data mapping needs further improvement.
- Patch applicability is checked against synthetic workflow fixtures. It does not establish that a proposed patch will execute correctly in a live n8n instance.
- Human-review metrics measure agreement with reference labels, not a guarantee of real-world safety.
- Credentials, secrets, unavailable item lineage, network failures and unexplained runtime timeouts may require human intervention.
Always review proposed repairs, validate them against the actual workflow and test changes in a safe environment before deployment. Never expose credentials or secret values in prompts.
Reproducibility
The complete training and evaluation workflow is available in the project repository.
The notebook records the base model revision, training settings, software versions, data hashes, training metrics and evaluation outputs for reproducibility.
Environmental impact
Carbon emissions were not directly measured for this run. No emissions estimate is claimed.
Acknowledgements
Built by AI Family for the Qwen Local Hackathon 2026.
Thanks to the Qwen, Unsloth, Hugging Face, PEFT and TRL communities for the models and tools that made this experiment possible.
The goal was simple: make n8n workflow debugging more structured, evidence-based and safer, using a small open model.