File size: 2,930 Bytes
e936bdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
license: apache-2.0
language:
- en
tags:
- text-generation-inference
- transformers
- gguf
- ollama
- qwen3
- python-coding
base_model: Qwen/Qwen3-4B-Instruct-2507
pipeline_tag: text-generation
---

# Truss Python: Qwen3-4B Specialized Coding Assistant

**Truss Python** is a specialized fine-tuned version of **Qwen3-4B-Instruct-2507**, optimized for generating clean, professional, and robust Python code. By focusing on high-quality seed prompts involving standard libraries, asynchronous programming, and data structures, this model prioritizes type safety, documentation, and modern Pythonic patterns.

## 🚀 Model Details

*   **Base Model:** [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
*   **Architecture:** Qwen3ForCausalLM
*   **Fine-Tuning Method:** LoRA (Low-Rank Adaptation)
*   **Quantization:** Q4_K_M (GGUF)
*   **File Size:** ~2.5 GB
*   **License:** Apache 2.0 (Inherited from Qwen3)

## ✨ Key Features

*   **Professional Structure:** Consistently generates code with Google-style docstrings and comprehensive type hints.
*   **Modern Syntax:** Proficient in Python 3.10+ features like `match-case` structural pattern matching.
*   **Robust Error Handling:** Prioritizes `try/except` blocks and resource management (e.g., `async with`, `contextlib`).
*   **Standard Library Focus:** Expert-level knowledge of `asyncio`, `threading`, `csv`, `functools`, and `pandas`.

## 💻 Usage with Ollama

This model is optimized for local deployment using **Ollama**.

### 1. Local Import (Using GGUF)
If you have downloaded the `.gguf` file:

1.  Create a `Modelfile`:
    ```dockerfile
    FROM ./truss-qwen3-python-lora.gguf
    PARAMETER temperature 0.2
    SYSTEM "You are an expert Python developer. Provide clean, efficient, and well-documented code."
    ```
2.  Create the model in your terminal:
    ```bash
    ollama create truss-python -f Modelfile
    ```
3.  Run the model:
    ```bash
    ollama run truss-python
    ```

## 🧪 Example Prompts

| Task | Prompt |
| :--- | :--- |
| **Algorithms** | "Write a binary search function with type hints and no built-in libraries." |
| **Decorators** | "Create a `@timer` decorator using `functools.wraps` and `time.perf_counter`." |
| **Async I/O** | "Fetch data from 3 URLs concurrently using `aiohttp` and `asyncio.gather`." |
| **Data Science** | "Optimize a pandas merge for 1M+ rows using specific dtypes." |

## ⚙️ Technical Specifications

| Parameter | Value |
| :--- | :--- |
| **Parameters** | 4 Billion |
| **Context Length** | 262,144 tokens |
| **Embedding Dim** | 2,560 |
| **Head Count** | 32 (Q), 8 (KV) |
| **RoPE Theta** | 5,000,000 |

## 📜 License

This model is based on Qwen3, which is licensed under the **Apache 2.0 License**. The fine-tuned weights and GGUF conversion are provided for research and development purposes.

---

*Built with ❤️ using Unsloth, llama.cpp, and Ollama.*