muhammadtlha944 commited on
Commit
fc244c8
Β·
verified Β·
1 Parent(s): 8ed2690

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +70 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸ€– MCP-Agent-1.7B
2
+
3
+ > The first open-source small language model fine-tuned to natively speak the **Model Context Protocol (MCP)**.
4
+
5
+ ## What Is This?
6
+
7
+ MCP-Agent-1.7B is [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B) fine-tuned with LoRA to:
8
+
9
+ - πŸ”§ **Call tools** using MCP protocol (JSON-RPC format)
10
+ - πŸ”— **Plan multi-step tool chains** with DAG dependencies
11
+ - ❓ **Ask clarifying questions** when info is missing (instead of hallucinating)
12
+ - πŸ›‘οΈ **Refuse dangerous requests** (e.g., "delete all files")
13
+
14
+ ## Training
15
+
16
+ | Detail | Value |
17
+ |--------|-------|
18
+ | Base model | [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B) (2B params) |
19
+ | Method | LoRA SFT (rank=16, all-linear) |
20
+ | Dataset | [muhammadtlha944/mcp-agent-training-data](https://huggingface.co/datasets/muhammadtlha944/mcp-agent-training-data) (16.5K examples) |
21
+ | Epochs | 3 |
22
+ | Learning rate | 2e-4 (cosine schedule) |
23
+ | Effective batch size | 16 |
24
+ | Precision | fp16 |
25
+ | Cost | **$0** (trained on free Kaggle/Colab GPU) |
26
+
27
+ ## πŸš€ Train It Yourself (FREE)
28
+
29
+ ### Option 1: Kaggle (Recommended β€” 30 free GPU hrs/week)
30
+ 1. Go to [kaggle.com/code](https://kaggle.com/code) β†’ **New Notebook**
31
+ 2. **Settings** β†’ Accelerator β†’ **GPU T4Γ—2** β†’ Internet β†’ **ON**
32
+ 3. Copy-paste the code from [`MCP_Agent_1_7B_Kaggle.ipynb`](./MCP_Agent_1_7B_Kaggle.ipynb)
33
+ 4. Run all cells β†’ wait ~2 hours β†’ model auto-pushes to Hub
34
+
35
+ ### Option 2: Google Colab (Backup β€” free T4)
36
+ 1. Open [colab.research.google.com](https://colab.research.google.com)
37
+ 2. **Runtime** β†’ Change runtime type β†’ **T4 GPU**
38
+ 3. Copy-paste from [`MCP_Agent_1_7B_Training.ipynb`](./MCP_Agent_1_7B_Training.ipynb)
39
+ 4. Run all cells β†’ wait ~2 hours
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from transformers import pipeline
45
+
46
+ pipe = pipeline("text-generation", model="muhammadtlha944/MCP-Agent-1.7B")
47
+
48
+ messages = [
49
+ {"role": "system", "content": "You are an MCP agent with tools: github_search, read_file, shell_exec."},
50
+ {"role": "user", "content": "Find all Python files that import pandas"}
51
+ ]
52
+
53
+ response = pipe(messages, max_new_tokens=512)
54
+ print(response[0]['generated_text'][-1]['content'])
55
+ ```
56
+
57
+ ## Research Background
58
+
59
+ This project is informed by:
60
+ - **STAR Framework** ([arxiv 2602.03022](https://arxiv.org/abs/2602.03022)) β€” proved Qwen3-1.7B beats Llama-3.1-8B at function calling
61
+ - **TinyAgent** ([arxiv 2409.00608](https://arxiv.org/abs/2409.00608)) β€” proved 1.1B models can match GPT-4 at focused tool calling
62
+ - **LoRA Without Regret** β€” all-linear LoRA matches full fine-tuning quality
63
+
64
+ ## License
65
+
66
+ Apache 2.0 (same as base model)
67
+
68
+ ## Author
69
+
70
+ Built by [Muhammad Talha](https://huggingface.co/muhammadtlha944) β€” learning ML by building real projects.