Text Generation
Transformers
Safetensors
MLX
English
qwen2
code
bug-fixing
code-review
lora
ollama
chatml
conversational
text-generation-inference
Instructions to use sandeeprdy1729/TIMPS-Coder-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sandeeprdy1729/TIMPS-Coder-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sandeeprdy1729/TIMPS-Coder-0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sandeeprdy1729/TIMPS-Coder-0.5B") model = AutoModelForCausalLM.from_pretrained("sandeeprdy1729/TIMPS-Coder-0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use sandeeprdy1729/TIMPS-Coder-0.5B 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("sandeeprdy1729/TIMPS-Coder-0.5B") 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) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- vLLM
How to use sandeeprdy1729/TIMPS-Coder-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sandeeprdy1729/TIMPS-Coder-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sandeeprdy1729/TIMPS-Coder-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sandeeprdy1729/TIMPS-Coder-0.5B
- SGLang
How to use sandeeprdy1729/TIMPS-Coder-0.5B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sandeeprdy1729/TIMPS-Coder-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sandeeprdy1729/TIMPS-Coder-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sandeeprdy1729/TIMPS-Coder-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sandeeprdy1729/TIMPS-Coder-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi new
How to use sandeeprdy1729/TIMPS-Coder-0.5B with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sandeeprdy1729/TIMPS-Coder-0.5B"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "sandeeprdy1729/TIMPS-Coder-0.5B" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use sandeeprdy1729/TIMPS-Coder-0.5B 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 "sandeeprdy1729/TIMPS-Coder-0.5B"
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 sandeeprdy1729/TIMPS-Coder-0.5B
Run Hermes
hermes
- MLX LM
How to use sandeeprdy1729/TIMPS-Coder-0.5B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "sandeeprdy1729/TIMPS-Coder-0.5B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "sandeeprdy1729/TIMPS-Coder-0.5B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sandeeprdy1729/TIMPS-Coder-0.5B", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use sandeeprdy1729/TIMPS-Coder-0.5B with Docker Model Runner:
docker model run hf.co/sandeeprdy1729/TIMPS-Coder-0.5B
| language: | |
| - en | |
| license: apache-2.0 | |
| base_model: Qwen/Qwen2.5-Coder-0.5B-Instruct | |
| tags: | |
| - code | |
| - bug-fixing | |
| - code-review | |
| - qwen2 | |
| - lora | |
| - mlx | |
| - ollama | |
| - chatml | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| # TIMPS-Coder v3 โ Elite Bug-Fixing Assistant (0.5B) | |
| > A 0.5B parameter coding model fine-tuned to **think before it codes** โ specialising in bug | |
| > analysis, code review, algorithm problem-solving, and agentic planning. | |
| > Built by [Sandeep Reddy](https://github.com/Sandeeprdy1729) ยท TIMPS ยท Made in India ๐ฎ๐ณ | |
| [](https://huggingface.co/sandeeprdy1729/TIMPS-Coder-0.5B) | |
| [](https://ollama.com/sandeeprdy1729/timps-coder) | |
| [](LICENSE) | |
| [-brightgreen)](https://github.com/Sandeeprdy1729/TIMPS-Coder/blob/main/benchmark_results.json) | |
| ## Model Summary | |
| | Field | Value | | |
| |---|---| | |
| | **Base model** | `Qwen/Qwen2.5-Coder-0.5B-Instruct` (Alibaba Cloud) | | |
| | **Architecture** | Qwen2 Transformer โ 494M parameters | | |
| | **Fine-tuning method** | LoRA (rank=16, 16 layers) via MLX-LM | | |
| | **Context window** | 4096 tokens | | |
| | **Quantization** | Q4_K_M GGUF (Ollama) / BF16 safetensors (HuggingFace) | | |
| | **Chat template** | ChatML (`<|im_start|>` / `<|im_end|>`) | | |
| | **License** | Apache 2.0 | | |
| | **Training hardware** | Apple M-series (Mac M1/M2/M3, 8 GB RAM) | | |
| ## Benchmark Results โ 25 Tests, 5 Dimensions | |
| Evaluated on [3_benchmark_ollama.py](https://github.com/Sandeeprdy1729/TIMPS-Coder/blob/main/3_benchmark_ollama.py). | |
| Scoring: **2 pts** = complete correct answer with code ยท **1 pt** = partial ยท **0** = wrong/refused. | |
| | Dimension | Score | % | | |
| |---|---|---| | |
| | ๐ Bug Fix | 9 / 10 | **90%** | | |
| | ๐ง SWE / Repo-level | 9 / 10 | **90%** | | |
| | โก Algorithms | 9 / 10 | **90%** | | |
| | ๐ Code Review | 8 / 10 | **80%** | | |
| | ๐ค Agentic Reasoning | 9 / 10 | **90%** | | |
| | **TOTAL** | **44 / 50** | **88%** | | |
| ## Quick Start | |
| ### Ollama (recommended) | |
| ```bash | |
| ollama pull sandeeprdy1729/timps-coder | |
| ollama run sandeeprdy1729/timps-coder | |
| ``` | |
| ### Python (Transformers) | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("sandeeprdy1729/TIMPS-Coder-0.5B") | |
| tokenizer = AutoTokenizer.from_pretrained("sandeeprdy1729/TIMPS-Coder-0.5B") | |
| messages = [ | |
| {"role": "system", "content": "You are TIMPS-Coder v3. THINK through the root cause, FIX with complete code, VERIFY edge cases."}, | |
| {"role": "user", "content": "Fix: `data['user']['email']` throws KeyError when email is absent."}, | |
| ] | |
| text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) | |
| inputs = tokenizer(text, return_tensors="pt") | |
| out = model.generate(**inputs, max_new_tokens=700, temperature=0.1, do_sample=True) | |
| print(tokenizer.decode(out[0], skip_special_tokens=True)) | |
| ``` | |
| ### MLX (Mac Apple Silicon) | |
| ```bash | |
| pip install mlx-lm | |
| mlx_lm.generate \ | |
| --model sandeeprdy1729/TIMPS-Coder-0.5B \ | |
| --max-tokens 700 --temp 0.1 \ | |
| --prompt '<|im_start|>system | |
| You are TIMPS-Coder v3. THINK through the root cause, FIX with complete code, VERIFY edge cases.<|im_end|> | |
| <|im_start|>user | |
| Fix the race condition: two threads increment self.count += 1 simultaneously.<|im_end|> | |
| <|im_start|>assistant | |
| ' | |
| ``` | |
| ## Training Details | |
| ### Fine-tuning Configuration | |
| | Parameter | Value | | |
| |---|---| | |
| | Base model | `Qwen/Qwen2.5-Coder-0.5B-Instruct` | | |
| | Fine-tuning method | LoRA (Supervised Fine-Tuning) | | |
| | LoRA rank | 16 | | |
| | Learning rate | 5e-6 | | |
| | Iterations | 3,000 | | |
| | Batch size | 1 (grad accum ร4) | | |
| | Max sequence length | 2048 tokens | | |
| | Framework | MLX-LM on Apple Silicon | | |
| | Peak RAM | ~5.5 GB | | |
| ### Training Data | |
| | Dataset | Type | Approx. Samples | | |
| |---|---|---| | |
| | `newfacade/LeetCodeDataset` | Algorithm problems with solutions | ~2,500 | | |
| | `SWE-bench/SWE-bench_Verified` | Real GitHub issue โ patch | ~400 | | |
| | `TIGER-Lab/SWE-Next-SFT-Trajectories` | Agentic edit traces | ~2,000 | | |
| | `WaltonFuture/agentic-sft-new` | Tool use + bash planning | ~3,000 | | |
| | Custom TIMPS bug-fix corpus | Hand-curated bug/fix pairs | ~500 | | |
| | **Total** | | **~8,400 samples** | | |
| All samples formatted in ChatML with `THINK โ FIX โ VERIFY` answer structure. | |
| ## Capabilities | |
| | Does well | Limitations | | |
| |---|---| | |
| | Bug root-cause analysis with explanation | Complex multi-file refactors | | |
| | SQL injection, race condition, memory leak detection | May miss subtle business-logic bugs | | |
| | O-notation analysis and algorithm optimisation | Not a replacement for static analysis tools | | |
| | LeetCode medium-level algorithm problems | Hard competitive programming problems | | |
| | GitHub Actions / CI YAML generation | Not trained on Terraform, CDK | | |
| ## Usage Tips | |
| - **Temperature**: Keep at `0.1` โ higher values increase hallucination on a 0.5B model | |
| - **Context**: Include the full function/class when asking for a bug fix | |
| - **Verification**: Always test generated code. Even at 88% accuracy, edge cases exist | |
| - **System prompt**: Required for best results โ see the Quick Start examples above | |
| ## Training Code | |
| Full training pipeline available at: | |
| [https://github.com/Sandeeprdy1729/TIMPS-Coder](https://github.com/Sandeeprdy1729/TIMPS-Coder) | |
| ## License | |
| Apache 2.0 โ free to use, modify, and distribute commercially. | |
| Base model (Qwen2.5-Coder-0.5B-Instruct) is also Apache 2.0. | |