CoolFace
Modelpublic

matt-hans93/ups-tools-qwen2.5-7b

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes38downloads
Model Card

UPS Tool-Use Qwen2.5 7B (v5a)

UPS Tool-Use Qwen2.5 7B is a QLoRA fine-tune of Qwen2.5-7B-Instruct for generating structured Hermes function-calling payloads for a UPS MCP server. It maps natural-language shipping and logistics requests to 18 UPS MCP tools covering tracking, rating, shipment creation, pickup workflows, address validation, paperless documents, landed cost, and location lookup.

This is the v5a release, trained on top of the v3 champion with replay + targeted augmentation data. It achieves 100% held-out accuracy and improves all stress-test axes over the prior release.

This repository publishes the PEFT LoRA adapter at the repo root and a Q4KM GGUF export for local inference with llama.cpp-compatible runtimes such as Ollama.

This model is not affiliated with or endorsed by UPS.

Model Details

  • —Developed by: Matthew Hans
  • —Model type: Qwen2.5-7B-Instruct causal language model with LoRA adapter fine-tuning
  • —Base model: Qwen/Qwen2.5-7B-Instruct
  • —Training base: unsloth/Qwen2.5-7B-Instruct-bnb-4bit
  • —Fine-tuning method: QLoRA with rank-stabilized LoRA (rsLoRA)
  • —Language: English
  • —Output format: Hermes FC v1 tool call blocks
  • —Release: v5a (May 2026)

Intended Use

The model is intended to sit behind a UPS MCP server and produce one structured tool call for each user request. A downstream orchestrator should parse the <tool_call_> block, validate arguments against the MCP tool schema, and then decide whether to call the UPS API.

text
<tool_call_>
{"name": "track_package", "arguments": {"inquiryNumber": "1Z999AA10123456784"}}
</tool_call_>

The system prompt should include the complete set of UPS MCP tool definitions in Hermes-compatible JSON:

text
<tools>
[{"type": "function", "function": {"name": "track_package", "parameters": {...}}}]
</tools>

Supported UPS MCP Tools

ToolCategory
track_packageTracking
validate_addressAddress validation
rate_shipmentRating
create_shipmentShipping
void_shipmentShipping
recover_labelShipping
get_time_in_transitTransit
get_landed_cost_quoteInternational landed cost
upload_paperless_documentPaperless documents
push_document_to_shipmentPaperless documents
delete_paperless_documentPaperless documents
find_locationsLocator
rate_pickupPickup
schedule_pickupPickup
cancel_pickupPickup
get_pickup_statusPickup
get_political_divisionsPickup metadata
get_service_center_facilitiesPickup metadata

Evaluation

Held-out accuracy (122 test cases, disjoint from training)

MetricScore
Tool selection accuracy100%
Parameter completeness100%
JSON validity rate100%
Format compliance100%
Payload structural accuracy99.06%

Stress-test suite (~2,000+ inference calls across 9 axes)

Four graders run in parallel on every case:

  • —Shape grader — required keys present in the tool call
  • —Value-grounded grader — argument values match what the prompt said
  • —Nested-structural grader — deep paths populated correctly
  • —Schema-typed grader — types and enums match the MCP schema

Confidence intervals are Wilson 95%.

AxisnShapeValue-groundedSilent hallucination
Strict replay (templated)90095.22%93.78%1.78%
OOD-lexicon (disjoint vocab)36099.17%98.06%1.11%
Paraphrase (voice/email/sms/typo)36096.67%68.61%28.06%
Sibling-tool ambiguity12088.33%79.17%15.00%
Natural-language (real phrasing)10095.00%82.00%13.00%
Negative / refusal80——— (86.25% pass)
Multi-turn workflows30——— (80.0% flow / 96.27% step)
Real-API (UPS CIE)48——— (80% clean acceptance)
Sampling variance (5x at T=0.7)500——— (97.8% avg pass)

Changes from previous release (v3 → v5a)

Axisv3v5aDelta
Held-out accuracy98.5%100%+1.5pp
Sibling shape89.2%88.33%−0.9pp
Multi-turn flow66.7%80.0%+13.3pp
Multi-turn step93.8%96.27%+2.5pp
Negative pass53.75%86.25%+32.5pp

Training Data

The dataset is synthetic, generated from UPS MCP server tool schemas.

SplitSamples
Train~1,100
Eval~120
Test122
Total~1,342

The v5a training data includes:

  • —Full replay of the original training set
  • —20 targeted augmentation examples focused on multi-turn workflow steps and negative/refusal boundaries
  • —Oversampling of initially weak tools (3x): rate_shipment, get_time_in_transit, upload_paperless_document, get_service_center_facilities, get_landed_cost_quote

No UPS API credentials or private customer shipment data are included.

Training Procedure

SettingValue
MethodQLoRA SFT
Base checkpoint for trainingmodels/ups-tools-v3-merged (v3 champion, merged)
LoRA rank16
LoRA alpha16
rsLoRAEnabled
Target modulesq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Trainable parameters~40M
Learning rate5e-5
Epochs1
Effective batch size8
Max sequence length6,144
OptimizerAdamW 8-bit paged
Training precisionFP16
Chat templateChatML
Final train loss0.200

Hardware and Software

Training was run locally on an NVIDIA GeForce RTX 3090 with 24 GB VRAM.

ComponentVersion
Python3.12.3
PyTorch2.10.0+cu128
Unsloth2026.2.1
PEFT0.18.1
TRL0.24.0

Artifacts

ArtifactPath
LoRA adapterRepo root: adapter_config.json, adapter_model.safetensors, tokenizer files
GGUF Q4KM exportups-tools-v5a-Q4_K_M.gguf
Ollama ModelfileModelfile

Usage

Transformers and PEFT

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_id = "Qwen/Qwen2.5-7B-Instruct"
adapter_id = "matt-hans93/ups-tools-qwen2.5-7b"

base = AutoModelForCausalLM.from_pretrained(base_id, device_map="auto")
model = PeftModel.from_pretrained(base, adapter_id)
tokenizer = AutoTokenizer.from_pretrained(adapter_id)

Ollama

Download ups-tools-v5a-Q4_K_M.gguf and Modelfile, then create a local Ollama model:

bash
ollama create ups-tools-qwen25 -f Modelfile

The Modelfile uses a low temperature and enough output budget for nested JSON payloads:

text
FROM ./ups-tools-v5a-Q4_K_M.gguf

PARAMETER temperature 0.1
PARAMETER top_p 0.9
PARAMETER num_predict 2048
PARAMETER stop "<|im_end|>"

Limitations and Risks

  • —Paraphrase fragility. Value-grounded accuracy drops to 68.6% on paraphrased prompts (terse SMS-style is worst at ~57%). Free-form text interfaces will see higher error rates.
  • —Sibling-tool confusion. On adversarial prompts with similar tools, shape accuracy is 88.3%. The most confused pairs are get_political_divisions vs find_locations and rate_shipment vs create_shipment.
  • —Incomplete prompts. The model fabricates missing fields instead of asking for clarification. Production orchestrators must validate arguments against the MCP schema before execution.
  • —`rate_shipment` cross-field combinations. The model can pair UPS service codes with incompatible packaging types. Validate service↔packaging compatibility before submitting.
  • —Multi-step workflow cascading. Step accuracy is 96.3% but full-workflow accuracy is 80% — early errors cascade. Validate each turn in multi-turn flows.
  • —Specialization to 18 UPS MCP tools. Do not expect generalization to unrelated APIs without additional evaluation.

Out-of-Scope Use

Do not use this model as an autonomous authority for shipping purchases, billing decisions, customs declarations, legal compliance, or cancellation actions. It should generate candidate MCP tool calls only; production systems should validate, log, and gate execution.

License

Apache 2.0. The base Qwen2.5 model is also released under Apache 2.0.