Text Generation
Transformers
Safetensors
English
llama
qlora
smollm
360m
cross-domain-transfer
anime-isomorphism
fine-tuned
conversational
text-generation-inference
Instructions to use CatQualia/gnarp-m2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CatQualia/gnarp-m2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CatQualia/gnarp-m2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CatQualia/gnarp-m2") model = AutoModelForCausalLM.from_pretrained("CatQualia/gnarp-m2", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CatQualia/gnarp-m2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CatQualia/gnarp-m2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CatQualia/gnarp-m2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CatQualia/gnarp-m2
- SGLang
How to use CatQualia/gnarp-m2 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 "CatQualia/gnarp-m2" \ --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": "CatQualia/gnarp-m2", "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 "CatQualia/gnarp-m2" \ --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": "CatQualia/gnarp-m2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CatQualia/gnarp-m2 with Docker Model Runner:
docker model run hf.co/CatQualia/gnarp-m2
Upload gnarp-m2 merged model (QLoRA r=16 on SmolLM2-360M-Instruct, 74k rows)
Browse files- MODEL_CARD.md +175 -0
- chat_template.jinja +6 -0
- config.json +40 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +19 -0
MODEL_CARD.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: mit
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- qlora
|
| 8 |
+
- smollm
|
| 9 |
+
- 360m
|
| 10 |
+
- cross-domain-transfer
|
| 11 |
+
- anime-isomorphism
|
| 12 |
+
- fine-tuned
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# gnarp-m2
|
| 18 |
+
|
| 19 |
+
A 360M-parameter language model fine-tuned via QLoRA on 74,395 cross-domain isomorphism and verification-labeled instruction pairs. gnarp-m2 specializes in cross-domain structural transfer — mapping mechanisms from one domain (biology, physics, anime, economics, etc.) to software engineering constructs with concrete failure boundaries.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
| Property | Value |
|
| 24 |
+
|----------|-------|
|
| 25 |
+
| Base model | HuggingFaceTB/SmolLM2-360M-Instruct |
|
| 26 |
+
| Method | QLoRA (4-bit NF4, double quantization) |
|
| 27 |
+
| LoRA rank | 16 |
|
| 28 |
+
| LoRA alpha | 32 |
|
| 29 |
+
| LoRA dropout | 0.05 |
|
| 30 |
+
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
|
| 31 |
+
| Trainable params | 8,683,520 (2.34% of total) |
|
| 32 |
+
| Total params | 370,504,640 |
|
| 33 |
+
| Adapter size | 34.8 MB (rank-16, alpha-32) |
|
| 34 |
+
| Merged model size | 1.4 GB |
|
| 35 |
+
| Architecture | LlamaForCausalLM |
|
| 36 |
+
| Max sequence length | 768 tokens |
|
| 37 |
+
|
| 38 |
+
## Training Data
|
| 39 |
+
|
| 40 |
+
**Corpus:** `clean_corpus_v5.jsonl` — 74,395 rows
|
| 41 |
+
|
| 42 |
+
| Source | Rows | Description |
|
| 43 |
+
|--------|------|-------------|
|
| 44 |
+
| isomorphism_sft.jsonl | 53,403 | Anime-to-software structural isomorphisms with failure_class from the 17,801-row moat |
|
| 45 |
+
| gpu_assay_verdicts.jsonl | 11,989 | GPU assay verification-labeled pairs |
|
| 46 |
+
| anime_metaphor_engine.jsonl | 4,523 | Cross-domain metaphor engine outputs |
|
| 47 |
+
| forge_bloom | 2,117 | Forge pipeline bloom outputs |
|
| 48 |
+
| capability/reasoning/seed.jsonl | 1,232 | Reasoning capability seed data |
|
| 49 |
+
| fleet_toolforge.jsonl | 187 | Fleet tool use pairs |
|
| 50 |
+
| Others (30+ sources) | 944 | Security, orchestration, calibration, refusal, compliance, etc. |
|
| 51 |
+
|
| 52 |
+
Positive + unlabeled rows only. Negative rows excluded from SFT targets.
|
| 53 |
+
|
| 54 |
+
## Training Configuration
|
| 55 |
+
|
| 56 |
+
| Parameter | Value |
|
| 57 |
+
|-----------|-------|
|
| 58 |
+
| Epochs | 1 |
|
| 59 |
+
| Learning rate | 1e-4 (cosine schedule, 5% warmup) |
|
| 60 |
+
| Batch size | 1 |
|
| 61 |
+
| Gradient accumulation | 8 |
|
| 62 |
+
| Effective batch size | 8 |
|
| 63 |
+
| Optimizer | AdamW (bf16) |
|
| 64 |
+
| Eval split | 10% held out |
|
| 65 |
+
| Eval strategy | Every 500 steps |
|
| 66 |
+
| Best model selection | eval_loss (load_best_model_at_end) |
|
| 67 |
+
| Seed | 7 |
|
| 68 |
+
| Training hardware | RTX 3080 Laptop (8 GB VRAM) |
|
| 69 |
+
| Training time | ~3 hours |
|
| 70 |
+
|
| 71 |
+
## Training Results
|
| 72 |
+
|
| 73 |
+
| Metric | Value |
|
| 74 |
+
|--------|-------|
|
| 75 |
+
| Final train loss | 2.613 |
|
| 76 |
+
| Final eval loss | 2.509 |
|
| 77 |
+
| Token accuracy | 55.55% |
|
| 78 |
+
| Perplexity (train) | 13.64 |
|
| 79 |
+
|
| 80 |
+
## Evaluation: Cross-Domain Transfer Benchmark v2
|
| 81 |
+
|
| 82 |
+
36 cross-domain transfer tasks spanning anime, biology, physics, economics, fiction, geography, music, cooking, ecology, martial arts, psychology, logistics, chemistry, sports, agriculture, linguistics, city planning, finance, navigation, and architecture.
|
| 83 |
+
|
| 84 |
+
**Scoring:** Heuristic rubric (keyword + structural analysis). Trust DELTAS between models on the same tasks, not absolutes.
|
| 85 |
+
|
| 86 |
+
| Model | Judge Mean | Delta vs Base | Avg Response (chars) | Avg Latency (s) |
|
| 87 |
+
|-------|-----------|---------------|---------------------|-----------------|
|
| 88 |
+
| **gnarp-m2** | **0.7839** | **+14.1%** | 1,108 | 4.9 |
|
| 89 |
+
| base (SmolLM2-360M-Instruct) | 0.6871 | — | 1,489 | 6.9 |
|
| 90 |
+
|
| 91 |
+
## Prior Model Lineage (heldout benchmark, qwen3:8b judge)
|
| 92 |
+
|
| 93 |
+
| Model | Transfer Score | Heldout Loss | Perplexity | Refusal Rate | Training Data |
|
| 94 |
+
|-------|---------------|-------------|-----------|-------------|---------------|
|
| 95 |
+
| base | 0.709 | 1.625 | 5.08 | 0.130 | — |
|
| 96 |
+
| v1 | 0.218 | 1.850 | 6.36 | 0.385 | ~2,152 rows |
|
| 97 |
+
| v2 | 0.713 | 1.800 | 6.05 | 0.340 | ~2,152 rows |
|
| 98 |
+
| v3 | 0.561 | 1.790 | 5.99 | 0.400 | ~2,152 rows |
|
| 99 |
+
| **m2** | **0.7839*** | — | — | — | **74,395 rows** |
|
| 100 |
+
|
| 101 |
+
*m2 scored on transfer_benchmark_v2 (heuristic-only), not the qwen3:8b-judged heldout benchmark. Cross-benchmark comparisons should be treated with caution.
|
| 102 |
+
|
| 103 |
+
## Limitations
|
| 104 |
+
|
| 105 |
+
1. **360M parameters.** Small model. Cannot match larger models on complex reasoning, long-form generation, or nuanced instruction following.
|
| 106 |
+
2. **Single GPU, single epoch.** Trained on consumer hardware (RTX 3080 8GB) for one epoch. More training could improve results but risks overfitting.
|
| 107 |
+
3. **Heuristic eval.** The transfer benchmark v2 uses keyword/structural heuristic scoring, not a strong LLM judge. The +14.1% delta is directionally meaningful but not precisely calibrated.
|
| 108 |
+
4. **Cross-benchmark caveat.** v1/v2/v3 were scored with a qwen3:8b judge; m2 was scored with heuristic-only. Direct numerical comparison across the two benchmarks is not valid.
|
| 109 |
+
5. **Domain-specific training data.** Over 71% of training data is isomorphism pairs. The model is optimized for cross-domain structural transfer and may underperform on general chat or coding tasks.
|
| 110 |
+
6. **No safety fine-tuning beyond refusal data.** The model includes 19 refusal pairs but is not extensively safety-tuned.
|
| 111 |
+
|
| 112 |
+
## How to Use
|
| 113 |
+
|
| 114 |
+
### With Ollama (recommended for local inference)
|
| 115 |
+
|
| 116 |
+
```bash
|
| 117 |
+
# Create the Modelfile
|
| 118 |
+
cat > Modelfile << 'EOF'
|
| 119 |
+
FROM ./model/merged_gnarpm2
|
| 120 |
+
TEMPLATE """### Instruction: {{ .Prompt }} ### Response: """
|
| 121 |
+
PARAMETER num_ctx 4096
|
| 122 |
+
PARAMETER temperature 0.3
|
| 123 |
+
PARAMETER num_predict 512
|
| 124 |
+
SYSTEM You are gnarp-m2, a cross-domain transfer specialist.
|
| 125 |
+
EOF
|
| 126 |
+
|
| 127 |
+
ollama create gnarp-m2 -f Modelfile
|
| 128 |
+
ollama run gnarp-m2
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
### With Transformers
|
| 132 |
+
|
| 133 |
+
```python
|
| 134 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 135 |
+
|
| 136 |
+
model_id = "gnarp/gnarp-m2" # or local path
|
| 137 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 138 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 139 |
+
|
| 140 |
+
prompt = "### Instruction:\nApply the concept of biological apoptosis to software deployment strategy.\n### Response:\n"
|
| 141 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 142 |
+
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.3)
|
| 143 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
### With PEFT (adapter only)
|
| 147 |
+
|
| 148 |
+
```python
|
| 149 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 150 |
+
from peft import PeftModel
|
| 151 |
+
|
| 152 |
+
base = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-360M-Instruct")
|
| 153 |
+
model = PeftModel.from_pretrained(base, "path/to/adapter_gnarpm2")
|
| 154 |
+
model = model.merge_and_unload()
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
## License
|
| 158 |
+
|
| 159 |
+
- **Model weights and code:** MIT License
|
| 160 |
+
- **Training data (corpus):** COPL (Community Open Public License) — derived from the WaveMotionExpansion isomorphism engine
|
| 161 |
+
- **Base model:** Apache 2.0 (SmolLM2-360M-Instruct by HuggingFace)
|
| 162 |
+
|
| 163 |
+
## Citation
|
| 164 |
+
|
| 165 |
+
```bibtex
|
| 166 |
+
@model{gnarp-m2,
|
| 167 |
+
title={gnarp-m2: Cross-Domain Transfer Fine-Tuned Language Model},
|
| 168 |
+
author={WaveMotionExpansion},
|
| 169 |
+
year={2026},
|
| 170 |
+
base_model={HuggingFaceTB/SmolLM2-360M-Instruct},
|
| 171 |
+
method={QLoRA},
|
| 172 |
+
training_rows={74395},
|
| 173 |
+
transfer_benchmark={0.7839}
|
| 174 |
+
}
|
| 175 |
+
```
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
|
| 2 |
+
You are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>
|
| 3 |
+
' }}{% endif %}{{'<|im_start|>' + message['role'] + '
|
| 4 |
+
' + message['content'] + '<|im_end|>' + '
|
| 5 |
+
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
| 6 |
+
' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 960,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 2560,
|
| 15 |
+
"is_llama_config": true,
|
| 16 |
+
"max_position_embeddings": 8192,
|
| 17 |
+
"mlp_bias": false,
|
| 18 |
+
"model_type": "llama",
|
| 19 |
+
"num_attention_heads": 15,
|
| 20 |
+
"num_hidden_layers": 32,
|
| 21 |
+
"num_key_value_heads": 5,
|
| 22 |
+
"pad_token_id": 2,
|
| 23 |
+
"pretraining_tp": 1,
|
| 24 |
+
"rms_norm_eps": 1e-05,
|
| 25 |
+
"rope_interleaved": false,
|
| 26 |
+
"rope_parameters": {
|
| 27 |
+
"rope_theta": 100000,
|
| 28 |
+
"rope_type": "default"
|
| 29 |
+
},
|
| 30 |
+
"tie_word_embeddings": true,
|
| 31 |
+
"transformers.js_config": {
|
| 32 |
+
"kv_cache_dtype": {
|
| 33 |
+
"fp16": "float16",
|
| 34 |
+
"q4f16": "float16"
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"transformers_version": "5.12.1",
|
| 38 |
+
"use_cache": true,
|
| 39 |
+
"vocab_size": 49152
|
| 40 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"pad_token_id": 2,
|
| 6 |
+
"transformers_version": "5.12.1"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0ee27d41ca5ec9a8c5f798321cef1e647a985eaa1c03bea8b4cdb917843d8d32
|
| 3 |
+
size 1447317080
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|im_start|>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>"
|
| 11 |
+
],
|
| 12 |
+
"is_local": false,
|
| 13 |
+
"local_files_only": false,
|
| 14 |
+
"model_max_length": 8192,
|
| 15 |
+
"pad_token": "<|im_end|>",
|
| 16 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 17 |
+
"unk_token": "<|endoftext|>",
|
| 18 |
+
"vocab_size": 49152
|
| 19 |
+
}
|