--- license: apache-2.0 language: - en base_model: - Qwen/Qwen3.5-9B --- # 🏛️ SalesforceCoder Qwen 3.5 (9B) - Structured Repository > [!IMPORTANT] > **REPOSITORY RENAMED:** This repository was formerly `SalesforceCoder-Qwen3.5-9B-Q4_K_M-GGUF`. All structured paths inside `files/` remain unchanged. > [!IMPORTANT] > **PREFERRED MODEL:** For most users, the **Q4_K_M GGUF** (located in `files/q4/`) is the recommended version. It maintains high architectural accuracy for Apex/SOQL while fitting comfortably within **6GB of VRAM**, making it ideal for local development environments. ## 📂 Repository Structure | Path | Description | | :--- | :--- | | **`files/q4/`** | **Primary Quant (Q4_K_M).** Optimized for VRAM < 6GB. | | **`files/q5/` & `files/q8/`** | High-fidelity quants for 12GB+ VRAM environments. | | **`files/mmproj/`** | Multimodal projector GGUF for vision-capable inference. | | **`files/f16/`** | Full model weights (Safetensors) and BF16 adapters. | | **`files/supporting/`** | Tokenizer, chat templates, and base JSON configs. | ## 🦙 Ollama / Local Inference Quick Run To use the preferred model with Ollama: 1. **Download the Q4 GGUF:** You can manually download it from `files/q4/` or use this `curl` command: ``` powershell curl -L "[https://huggingface.co/aneeq-hashmi/SalesforceCoder-Qwen3.5-9B/resolve/main/files/q4/SalesforceCoder-Qwen3.5-9B.Q4_K_M.gguf](https://huggingface.co/aneeq-hashmi/SalesforceCoder-Qwen3.5-9B/resolve/main/files/q4/SalesforceCoder-Qwen3.5-9B.Q4_K_M.gguf)" -o SalesforceCoder-Qwen3.5-9B.Q4_K_M.gguf ``` 2. **Prepare the Modelfile:** Ensure your Modelfile is in the same directory and the FROM line points to the file you just downloaded: ``` Dockerfile FROM ./SalesforceCoder-Qwen3.5-9B.Q4_K_M.gguf PARAMETER num_ctx 204800 ``` 3. **Create & Run:** ``` PowerShell ollama create SalesforceCoder -f Modelfile ollama run SalesforceCoder ``` --- ## 📖 Table of Contents - [🏛️ Model Overview](#-salesforcecoder-qwen-35-9b---structured-repository) - [📂 Repository Structure](#-repository-structure) - [🦙 Ollama Quick Start](#-ollama--local-inference-quick-run) - [📝 Model Information](#model-information) - [Technical Profile](#technical-profile) - [🛠️ System Prompt (Apex Rules)](#system-prompt-apex-rules) - [Code Quality & Security](#2-code-quality--security) - [Testing Requirements](#3-testing-requirements) - [⚙️ Inference & Runtime Config](#inference--runtime-config) - [🚀 Deployment Guides](#deployment-guides) - [llama.cpp](#-llamacpp) - [LM Studio](#-lm-studio) - [Ollama](#-ollama) - [🐋 Execution via Docker](#-execution-via-docker-the-no-install-way) - [🏛️ Architecture Note](#️-architecture-note) - [⚖️ Acknowledgments & Licensing](#️-acknowledgments--licensing) - [Dataset Attribution](#dataset-attribution) --- # Model Information ## Description **SalesforceCoder-Qwen3.5-9B** is a fine-tuned variant of Qwen3.5-9B, purpose-built for Salesforce Enterprise Architecture, Apex development, and troubleshooting. The model was trained on curated Salesforce Q&A, StackExchange, and GitHub data, specifically optimized for domain-specific practical problem coverage. It also incorporates [Gianloko's Apex Code dataset](https://huggingface.co/datasets/Gianloko/apex-coder-training-data), providing exposure to real-world Salesforce coding patterns. ### Core Strengths - **Compilable Apex:** Generates triggers, handlers, and test classes following bulkification and governor-aware best practices. - **Advanced Architecture:** Optimized for multi-org strategy, Service Layer patterns, and secure integration designs. - **Deep Debugging:** Diagnoses recursion, SOQL-in-loops, and flaky tests with concrete, testable fixes. - **Unit Testing:** Prioritizes `seeAllData=false`, `Test.startTest()/Test.stopTest()`, and robust test data builders (aiming for 90%+ coverage). - **Security First:** Enforces CRUD/FLS checks, Named Credentials, and sanitizes dynamic SOQL. - **200k Context:** Large window allows for ingesting entire multi-file repositories or massive debug logs for cross-file analysis. ### Technical Profile - **Memory Footprint:** ~6 GB RAM (Q4 version). - **Context Window:** Up to 200,000 tokens. - **Developer:** Aneeq Hashmi - **License:** Apache-2.0 --- # System Prompt (Apex Rules) You are a **Salesforce Enterprise Architect**. Follow these strict rules on every response: ### 1. Role & Tone - Act as a senior reviewer. Be concise, pragmatic, and solution-focused. - Prioritize **"Truth over Reassurance"** regarding governor limits. ### 2. Code Quality & Security - **Visibility:** Default to `with sharing` for all classes. - **Security:** Enforce CRUD/FLS checks on all DML/SOQL operations. - **Best Practices:** Ensure bulkification, SOQL outside loops, and proper exception handling. - **Sanitization:** Use bind variables and `escapeSingleQuotes` for dynamic SOQL. ### 3. Testing Requirements - Provide comprehensive test classes with **≥ 90% coverage**. - Verify positive, negative, and bulk scenarios. - Use `Test.startTest()` and `Test.stopTest()` for all asynchronous logic. --- # Inference & Runtime Config To ensure deterministic and syntactically correct Apex, use these parameters: | Parameter | Recommended Value | Purpose | | :--- | :--- | :--- | | **Temperature** | `0.0 – 0.2` | Precise, deterministic code output. | | **Top_P** | `0.9` | Balance between variety and relevance. | | **Repeat Penalty** | `1.1 – 1.2` | Reduce boilerplate in long classes. | | **Context Window** | Up to `200,000` | Support for full-org analysis. | --- # Deployment Guides ### 🦙 llama.cpp ```bash ./main -m files/q4/SalesforceCoder-Qwen3.5-9B.Q4_K_M.gguf -c 200000 --temp 0.0 --top_p 0.9 --repeat_penalty 1.1 ``` ### 💻 LM Studio 1. **Import:** Move the model folder into your LM Studio models directory. 2. **Context:** Under **Hardware Settings**, set the context limit to the maximum supported by your VRAM (up to 200k). 3. **Parameters:** Set **Temperature** to `0.1` and **Repeat Penalty** to `1.1`. 4. **System Prompt:** Paste the **Enterprise Architect** system prompt from the section above into the System Instruction box. ### 🚀 Ollama Ensure you are in the root directory where the `Modelfile` is located. This command will build the model and reference the structured paths automatically: ```bash ollama create SalesforceCoder -f Modelfile ``` # 🐋 Execution via Docker (The "No-Install" Way) Since you are running without a local Ollama installation, use this specific two-step command to build your model inside a container. Run this from your `C:\unsloth\source-repo` directory: ### 1. Start the Container This maps your local folder (`${PWD}`) to the container's `/root/repo` path so it can access the weights. ```powershell docker run -d -v ${PWD}:/root/repo -p 11434:11434 --name ollama-sf ollama/ollama ``` ### 2. Create the Model This triggers the build process using the Modelfile and the 200k context configuration. ```powerShell docker exec -it ollama-sf ollama create SalesforceCoder -f /root/repo/Modelfile ``` ### 🏛️ Architecture Note The volume mapping (-v ${PWD}:/root/repo) is critical. It allows the container to resolve the FROM ./files/q4/... path defined in your Modelfile. Without this, the model creation will fail with a "file not found" error. # ⚖️ Acknowledgments & Licensing ### Base Model This model is built upon **Qwen 3.5 (9B)** by the Qwen Team, licensed under **Apache 2.0**. ### Dataset Attribution A significant portion of the fine-tuning for this model utilized the **[Apex Coder Training Data](https://huggingface.co/datasets/Gianloko/apex-coder-training-data)** created by **Gianloko**. * **License:** Apache 2.0 * **Usage:** This dataset provided the foundational patterns for Apex trigger logic, bulkification, and Salesforce-specific unit testing. We are grateful to Gianloko for providing this high-quality open-source resource for the Salesforce developer community. ### Repository License The modifications, fine-tuning configurations, and repository structure provided here are licensed under the **Apache License 2.0**. --- *Note: This model is an independent research project and is not affiliated with, sponsored by, or endorsed by Salesforce, Inc.*