Qwen3-1.7B Strands Adapter

LoRA adapter that teaches Qwen3-1.7B-4bit comprehensive knowledge of the Strands Agents SDK - without breaking tool calling capabilities.

🎯 What This Does

Transforms base Qwen3-1.7B into a Strands SDK expert that can:

  • βœ… Explain Strands architecture and patterns
  • βœ… Generate correct installation commands
  • βœ… Show working code examples for agent creation
  • βœ… Describe tool creation patterns (@tool decorator, hot reload)
  • βœ… Explain all model providers (Bedrock, Anthropic, OpenAI, Ollama, MLX)
  • βœ… Guide through MLX training pipelines
  • βœ… Describe multi-agent systems (Swarm, Workflow)
  • βœ… Preserve 100% tool calling capability

πŸ“Š Training Results

Metric Base Model Trained Model
Strands Knowledge 0/10 (hallucinates) 10/10 (accurate)
Tool Calling Works βœ… 100% preserved
Training Time - 14 minutes
Adapter Size - 19MB

πŸš€ Quick Start

pip install strands-agents strands-mlx
from strands import Agent
from strands_mlx import MLXModel

# Load base model + this adapter
model = MLXModel(
    model_id="mlx-community/Qwen3-1.7B-4bit",
    adapter_path="cagataycali/qwen3-strands-adapter"  # Your HF repo
)

agent = Agent(model=model)

# Now it knows Strands!
agent("How do I create a Strands tool?")
# β†’ Accurate answer with working code examples

agent("What model providers does Strands support?")
# β†’ Complete list: Bedrock, Anthropic, OpenAI, Ollama, MLX, etc.

πŸ“š Training Details

Dataset:

  • 105 question-answer pairs about Strands SDK
  • Generated using embedded Strands documentation
  • Avg 1,621 tokens per example
  • Complete tool call cycles captured (user β†’ assistant(tool_calls) β†’ tool(results) β†’ assistant(final))

Training Configuration:

  • Base Model: mlx-community/Qwen3-1.7B-4bit
  • Method: LoRA (Low-Rank Adaptation)
  • Iterations: 200 (conservative to prevent overfitting)
  • Learning Rate: 1e-5
  • LoRA Rank: 8
  • LoRA Scale: 16.0
  • Training Time: 14 minutes on Apple Silicon
  • Hardware: M-series Mac

Key Training Strategy:

  • Conservative iteration count to avoid catastrophic forgetting
  • mask_prompt=True - Only train on assistant completions
  • Gradient checkpointing for memory efficiency
  • ChatML format with proper tool call structure

πŸ”§ Advanced Usage

With Tools

from strands import Agent
from strands_mlx import MLXModel

model = MLXModel(
    model_id="mlx-community/Qwen3-1.7B-4bit",
    adapter_path="cagataycali/qwen3-strands-adapter"
)

# Tool calling still works perfectly!
agent = Agent(
    model=model,
    tools=["calculator", "shell", "file_read"]
)

agent("Calculate 15 * 7 and explain Strands")
# β†’ Uses calculator AND provides Strands knowledge

Swap Adapters

# Load different adapters for different domains
strands_model = MLXModel(
    "mlx-community/Qwen3-1.7B-4bit",
    adapter_path="cagataycali/qwen3-strands-adapter"
)

coding_model = MLXModel(
    "mlx-community/Qwen3-1.7B-4bit",
    adapter_path="your-coding-adapter"
)

πŸ“– What It Learned

The adapter was trained on comprehensive Strands documentation covering:

  1. Installation & Setup

    • pip installation methods
    • Virtual environment setup
    • Model provider configuration
  2. Core Concepts

    • Agent creation patterns
    • Tool creation (@tool decorator, hot reload)
    • Session managers
    • System prompts
  3. Model Providers

    • Bedrock (AWS)
    • Anthropic
    • OpenAI
    • Ollama (local)
    • MLX (Apple Silicon)
    • Gemini, LiteLLM, GitHub Models
  4. Advanced Features

    • Multi-agent systems (Swarm, Workflow)
    • MLX training pipeline
    • MCP server integration
    • Direct tool calls

πŸŽ“ Training Your Own Domain Expert

Want to create your own domain-specific adapter? Here's how:

from strands import Agent
from strands_mlx import MLXModel, MLXSessionManager
from strands_mlx.tools import mlx_trainer, dataset_splitter

# 1. Collect training data
session = MLXSessionManager(session_id="my_domain")
model = MLXModel("mlx-community/Qwen3-1.7B-4bit")
agent = Agent(model=model, session_manager=session)

# Have conversations (100-200 examples recommended)
agent("Teach me about X")
# Data auto-saved to ~/.strands/mlx_training_data/my_domain.jsonl

# 2. Split dataset
dataset_splitter(
    input_path="~/.strands/mlx_training_data/my_domain.jsonl",
    train_ratio=0.8,
    valid_ratio=0.1,
    test_ratio=0.1
)

# 3. Train
mlx_trainer(
    action="train",
    config={
        "model": "mlx-community/Qwen3-1.7B-4bit",
        "data": "~/.strands/mlx_training_data/my_domain",
        "iters": 200,
        "learning_rate": 1e-5,
        "batch_size": 1,
        "grad_checkpoint": True
    }
)

# 4. Use it!
trained = MLXModel("mlx-community/Qwen3-1.7B-4bit", adapter_path="./adapter")

πŸ”¬ Benchmarks

Question: "How do I create a Strands agent with tools?"

Base Model Response:

I'll help you create a strands agent. Let me use the system_monitor tool...
<tool_call>{"name": "system_monitor", ...}</tool_call>  ← Hallucinated tool

Trained Model Response:

from strands import Agent

agent = Agent(
    system_prompt="You are a helpful assistant",
    tools=["calculator", "shell", "file_read"]
)

agent("Calculate 2+2")

πŸ“¦ Files in This Adapter

  • adapters.safetensors - Trained LoRA weights
  • adapter_config.json - LoRA configuration
  • 0000100_adapters.safetensors - Checkpoint at iter 100
  • 0000200_adapters.safetensors - Checkpoint at iter 200

πŸ› οΈ Requirements

pip install strands-agents>=0.2.0 strands-mlx>=0.2.1

πŸ“ License

Same as base model (Apache 2.0)

πŸ™ Acknowledgments

πŸ”— Links

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to view the estimation

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for cagataydev/qwen3-strands-adapter

Finetuned
Qwen/Qwen3-1.7B
Adapter
(1)
this model