Snapgate Surge
Surge is a 7B model from Snapgate AI, purpose-built to help developers, creators, and everyday users with coding, website building, and a wide range of daily tasks in both Indonesian and English.
โจ Key Capabilities
| Feature | Description |
|---|---|
| ๐ป Coding Assistant | PHP, JavaScript, Python, HTML/CSS, and 40+ programming languages |
| ๐ Web Development | Building, debugging, and optimizing websites |
| ๐ฌ Bilingual Chat | Indonesian and English |
| ๐ Content Writing | Articles, documentation, and creative content |
| ๐ Code Review | Code analysis and optimization |
๐ Model Specifications
| Specification | Details |
|---|---|
| Base Model | Qwen2.5 7B Instruct |
| Base Model Source | unsloth/Qwen2.5-7B-Instruct |
| Type | Causal Language Model |
| Parameters | 7 Billion |
| Context Length | 2048 tokens |
| Languages | Indonesian ๐ฎ๐ฉ, English ๐บ๐ธ |
| Training Method | Supervised Fine-tuning (SFT) + LoRA |
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| LoRA Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Quantization | 4-bit (NF4) |
| Training Framework | Unsloth + TRL |
| Batch Size | 2 (per device) |
| Gradient Accumulation | 4 steps (effective batch size: 8) |
| Learning Rate | 2e-4 |
| LR Scheduler | Linear |
| Optimizer | AdamW 8-bit |
| Training Steps | 1,000 steps |
| Warmup Steps | 10 |
| Final Loss | ~0.019 |
| Use Case | Chat, Coding, Web Development |
| License | Apache 2.0 |
๐ Training Progress
| Step | Training Loss |
|---|---|
| 50 | 0.031265 |
| 100 | 0.026168 |
| 150 | 0.024656 |
| 200 | 0.023187 |
| 250 | 0.021635 |
| 300 | 0.020565 |
| 350 | 0.021403 |
| 400 | 0.020508 |
| 450 | 0.021008 |
| 500 | 0.020904 |
| 550 | 0.020973 |
| 600 | 0.020271 |
| 650 | 0.020277 |
| 700 | 0.019679 |
| 750 | 0.019985 |
| 800 | 0.019746 |
| 850 | 0.019760 |
| 900 | 0.019363 |
| 950 | 0.019226 |
| 1000 | 0.019374 |
Loss decreased from 0.031 to 0.019 โ converging well over 1,000 steps.
๐ Usage
Python โ Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "snapgate-ai/snapgate-surge"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype = torch.float16,
device_map = "auto"
)
SYSTEM_PROMPT = """You are Surge, an AI assistant from Snapgate AI (snapgate.tech).
You help users with coding, web development, and general questions
in both Indonesian and English."""
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize = True,
add_generation_prompt = True,
return_tensors = "pt"
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens = 512,
temperature = 0.7,
top_p = 0.9,
do_sample = True,
)
response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
print(response)
REST API โ PHP
<?php
class SnapgateSurge {
private string $apiUrl;
public function __construct(string $apiUrl = 'http://your-server:8000') {
$this->apiUrl = $apiUrl;
}
public function chat(string $message): string {
$payload = json_encode([
'messages' => [['role' => 'user', 'content' => $message]],
'max_tokens' => 512,
'temperature' => 0.7,
]);
$ch = curl_init($this->apiUrl . '/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_TIMEOUT => 60,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
return $data['choices'][0]['message']['content'] ?? 'Error';
}
}
$surge = new SnapgateSurge('http://your-server:8000');
$response = $surge->chat('Write a PHP function to validate an email address');
echo $response;
Deploy with Ollama
curl -fsSL https://ollama.ai/install.sh | sh
cat > Modelfile << 'EOF'
FROM snapgate-ai/snapgate-surge
SYSTEM """You are Surge, an AI assistant from Snapgate AI (snapgate.tech).
You help users with coding, web development, and general questions."""
PARAMETER temperature 0.7
PARAMETER top_p 0.9
EOF
ollama create snapgate-surge -f Modelfile
ollama run snapgate-surge
Deploy with vLLM (Production)
pip install vllm
python -m vllm.entrypoints.openai.api_server \
--model snapgate-ai/snapgate-surge \
--host 0.0.0.0 \
--port 8000 \
--max-model-len 2048
๐ก Example Conversation
English: