Text Generation
MLX
Safetensors
English
qwen3
lora
distillation
code
swift
conversational
4-bit precision
Instructions to use VertexAGI/codeinswift-1-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VertexAGI/codeinswift-1-small with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("VertexAGI/codeinswift-1-small") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use VertexAGI/codeinswift-1-small with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/codeinswift-1-small"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "VertexAGI/codeinswift-1-small" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use VertexAGI/codeinswift-1-small with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "VertexAGI/codeinswift-1-small"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "VertexAGI/codeinswift-1-small" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/codeinswift-1-small", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use VertexAGI/codeinswift-1-small with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/codeinswift-1-small"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default VertexAGI/codeinswift-1-small
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VertexAGI/codeinswift-1-small with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/codeinswift-1-small"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "VertexAGI/codeinswift-1-small" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README.md from VertexAGI/codeinswift-1-small: direct link, hf CLI and curl.
- Browser
- Download file 4.55 kB
-
https://huggingface.co/VertexAGI/codeinswift-1-small/resolve/main/README.md
- Command line
-
hf download hf://VertexAGI/codeinswift-1-small/README.md
-
curl -L -o README.md https://huggingface.co/VertexAGI/codeinswift-1-small/resolve/main/README.md
4.55 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| base_model: mlx-community/Qwen3-8B-4bit | |
| tags: | |
| - mlx | |
| - lora | |
| - distillation | |
| - code | |
| - swift | |
| - text-generation | |
| pipeline_tag: text-generation | |
| vertex_family: codein | |
| vertex_params: "8B" | |
| vertex_purpose: "Swift coding specialist" | |
| vertex_result: "38% of held-out prompts produce working, swiftc-typechecked code within a 512-token budget (base: 0%, exhausted by unbounded chain-of-thought before reaching any code)" | |
| vertex_status: released | |
| vertex_name: "CodeInSwift 1 Small" | |
| vertex_base: "Qwen3-8B" | |
| # CodeInSwift 1 Small | |
| **A Swift coding specialist, distilled from real instruction/response data into Qwen3-8B** | |
| Part of the **CodeIn** family: where Aquamarine is a generalist across languages, CodeIn models go the other direction -- each one distilled for exactly one programming language, and nothing else. CodeInSwift is the second: Apple's Swift. | |
| ## Overview | |
| CodeInSwift 1 Small is fine-tuned via LoRA on **Qwen3-8B** to act as a Swift coding assistant -- given a problem description, it explains its approach and writes complete, correct Swift code, as a real chat model (not raw code completion, unlike its CodeInLuau sibling, since this dataset is genuine 2-turn instruction/response data). | |
| ## Training | |
| - **Base model:** `mlx-community/Qwen3-8B-4bit` | |
| - **Dataset:** [`MnemicAI/Ling-Coder-SFT-English-Clean`](https://huggingface.co/datasets/MnemicAI/Ling-Coder-SFT-English-Clean), Swift split -- 68,301 rows of genuine human/assistant coding Q&A, split 92/8 into 62,837 train / 5,464 validation examples. | |
| - **Method:** LoRA fine-tuning (rank 8, scale 20, 16 layers), 9,600 iterations across 3 resumed sessions, batch size 1, sequence length 3072, trained as a real chat model via a fixed system prompt + `messages` format. | |
| - **Val loss:** 0.652 at the end of training. | |
| ## Evaluation | |
| A held-out base-vs-tuned comparison used 100 prompts sampled from the dataset's own validation split (`valid.jsonl`, never touched during training), each fed the same system prompt and user question, with greedy decoding capped at 512 output tokens. Outputs were classified by extracting any ` ```swift ` code block and running it through the real Swift compiler (`swiftc -typecheck`) -- a genuine correctness oracle, not a heuristic or LLM judge. | |
| | | compiles cleanly | compile error | no code block reached | | |
| |---|---|---|---| | |
| | **Base Qwen3-8B** | 0 | 0 | **100** | | |
| | **CodeInSwift 1 Small** | **38** | 19 | 43 | | |
| The base model's 0/100 is not a claim that it can't write Swift -- Qwen3-8B is a reasoning model, and unprompted it spends the entire 512-token budget inside a `<think>` block reasoning through the approach, never reaching a code fence at all (verified by inspecting the raw transcripts). CodeInSwift has learned to skip that and deliver a working, correctly-formatted answer inside a practical response budget, which is what actually matters for an interactive coding assistant. Even so, the tuned model's own remaining 43% no-code-block rate and 19% compile-error rate are real, unresolved gaps -- reported here rather than glossed over. | |
| ## Usage | |
| ```python | |
| from mlx_lm import load, generate | |
| model, tokenizer = load("VertexAGI/codeinswift-1-small") | |
| messages = [ | |
| {"role": "system", "content": "You are CodeInSwift, a coding specialist for the Swift programming language. Given a coding problem, explain your problem-solving approach clearly, then provide complete, correct Swift code."}, | |
| {"role": "user", "content": "Write a function that reverses a linked list in place."}, | |
| ] | |
| prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False) | |
| response = generate(model, tokenizer, prompt=prompt, max_tokens=512) | |
| print(response) | |
| ``` | |
| This is a chat model -- use the system prompt above (or your own) plus a real question, not a raw code prefix. | |
| ## Formats available | |
| MLX only for this release (4-bit, via `mlx-lm`, for Apple Silicon). No GGUF yet -- same reason as CodeInLuau: the dequantize-to-fp16-then-quantize conversion path needs disk headroom this machine didn't have available at release time; may follow later. | |
| ## Limitations | |
| An 8B-parameter model fine-tuned via LoRA on ~63K examples. The evaluation above shows real, unresolved gaps -- a meaningful fraction of responses either don't produce a compilable code block within a practical response length or contain genuine compile errors. Treat output as a strong starting point to review and compile yourself, not code to ship unread. | |
| ## License | |
| Apache 2.0, inherited from the Qwen3 base model. | |