Qwen3.5 LoRA adapter for JSON extraction from support texts
2 min readupdated
This tool is a LoRA (a small add-on for a base model) for the Qwen/Qwen3.5-2B language model, optimized to extract strict JSON responses from chaotic customer support messages. The model outputs an object with six fixed keys: category, urgency, customer_email, order_id, action_required, and summary. The adapter was trained on a synthetic dataset containing prompt injection traps and is intended for researchers and developers building automated ticket processing systems.
Key features
- Based on the lightweight Qwen/Qwen3.5-2B model, which lowers hardware requirements.
- Achieves 100% metrics on raw JSON parsing on the test set.
- Configured using the PEFT library for quick integration with Transformers.
- Focused on research tasks and experiments with structured output.
What you can do
- Integrate the adapter into a customer email and complaint processing pipeline for preliminary data parsing.
- Use it as a benchmark to test the effectiveness of LoRA adapters on noisy text.
- Deploy a local bot prototype to classify incoming requests by ID and category.
Example
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "Qwen/Qwen3.5-2B"
adapter_id = "sublayerAI/sublayer-specialist-v2.1-lora"
tokenizer = AutoTokenizer.from_pretrained(base_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16,
device_map="auto",
trust_remote_code=True,
)
model = PeftModel.from_pretrained(model, adapter_id)
model.eval()Read more
DetailsBenchmarks (N=100): raw JSON parse rate — 100.0%, strict schema compliance — 97.0%, overall strict exact match — 42.0%.
Limitations: accuracy of determining urgency (57%) and category (82%) is limited; the model was trained on a synthetic dataset.
Status: research milestone, not ready for full production without review.










Comments