Team Ai
Modelpublic

Fortytwo-Network/Strand-Rust-Coder-14B-v1

sourceHugging Faceapache-2.0updated 9mo agoView on Hugging Face
208likes713downloads
README.md238 linesDownload Raw Back to root
1---2license: apache-2.03datasets:4- Fortytwo-Network/Strandset-Rust-v15base_model:6- Qwen/Qwen2.5-Coder-14B-Instruct7pipeline_tag: text-generation8library_name: transformers9---10 11![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/63aeda3a2314b93f9e706a68/I6WwY8U7I5V8lc138UmGt.jpeg)12 13# Strand-Rust-Coder-14B-v114 15## Overview16 17**Strand-Rust-Coder-14B-v1** is the first domain-specialized Rust language model created through **Fortytwo’s Swarm Inference**, a decentralized AI architecture where multiple models collaboratively generate, validate, and rank outputs through peer consensus.18 19The model fine-tunes **Qwen2.5-Coder-14B** for Rust-specific programming tasks using a **191K-example synthetic dataset** built via multi-model generation and peer-reviewed validation.  20It achieves **43–48% accuracy** on Rust-specific benchmarks – surpassing much larger proprietary models like GPT-5 Codex on Rust tasks – while maintaining competitive general coding performance.21 22[Strand-Rust-Coder-v1: Technical Report](https://huggingface.co/blog/Fortytwo-Network/strand-rust-coder-tech-report)23 24## Key Features25 26- **Rust-specialized fine-tuning** on 15 diverse programming task categories  27- **Peer-validated synthetic dataset** (191,008 verified examples, 94.3% compile rate)  28- **LoRA-based fine-tuning** for efficient adaptation  29- **Benchmarked across Rust-specific suites:**30  - **RustEvo^2**  31  - **Evaluation on Hold-Out Set**32- **Deployed in the Fortytwo decentralized inference network** for collective AI reasoning  33 34---35 36## Performance Summary37 38| **Model** | **Hold-Out Set** | **RustEvo^2** |39|------------|------------------|---------------|40| **Fortytwo-Rust-One-14B (Ours)** | **48.00%** | **43.00%** |41| openai/gpt-5-codex | 47.00% | 28.00% |42| anthropic/claude-sonnet-4.5 | 46.00% | 21.00% |43| anthropic/claude-3.7-sonnet | 42.00% | 31.00% |44| qwen/qwen3-max | 42.00% | 40.00% |45| qwen/qwen3-coder-plus | 41.00% | 22.00% |46| x-ai/grok-4 | 39.00% | 37.00% |47| deepseek/deepseek-v3.1-terminus | 37.00% | 33.00% |48| Qwen3-Coder-30B-A3B-Instruct | 36.00% | 20.00% |49| openai/gpt-4o-latest | 34.00% | 39.00% |50| deepseek/deepseek-chat | 34.00% | 41.00% |51| google/gemini-2.5-flash | 33.00% | 7.00% |52| Qwen2.5-Coder-14B-Instruct (Base) | 29.00% | 30.00% |53| Qwen2.5-Coder-32B-Instruct | 29.00% | 31.00% |54| google/gemini-2.5-pro | 28.00% | 22.00% |55| qwen/qwen-2.5-72b | 28.00% | 32.00% |56| Tesslate/Tessa-Rust-T1-7B | 23.00% | 19.00% |57 58*Benchmarks on code tasks measured using unit-test pass rate@1 in Docker-isolated Rust 1.86.0 environment.*59 60---61 62## Task Breakdown63 64| Task | Base | Strand-14B |65|------|------|-------------|66| test_generation | 0.00 | 0.51 |67| api_usage_prediction | 0.27 | 0.71 |68| function_naming | 0.53 | 0.87 |69| code_refactoring | 0.04 | 0.19–0.20 |70| variable_naming | 0.87 | 1.00 |71| code_generation | 0.40 | 0.49 |72 73Largest improvements appear in *test generation*, *API usage prediction*, and *refactoring* – areas demanding strong semantic reasoning about Rust’s ownership and lifetime rules.74 75---76 77## Dataset78 79**Fortytwo-Network/Strandset-Rust-v1 (191,008 examples, 15 categories)**  80Built through Fortytwo’s *Swarm Inference* pipeline, where multiple SLMs generate and cross-validate examples with peer review consensus and output aggregation.81 82- 94.3% compile success rate  83- 73.2% consensus acceptance  84- Coverage of 89% of Rust language features  85- Tasks include:86  - `code_generation`, `code_completion`, `bug_detection`, `refactoring`, `optimization`87  - `docstring_generation`, `code_review`, `summarization`, `test_generation`88  - `naming`, `API usage prediction`, `search`  89 90Dataset construction involved 2,383 crates from crates.io, automatic compilation tests, and semantic validation of ownership and lifetime correctness.91 92Dataset: [Fortytwo-Network/Strandset-Rust-v1](https://huggingface.co/datasets/Fortytwo-Network/Strandset-Rust-v1)93 94---95 96## Training Configuration97 98| Setting | Value |99|----------|-------|100| Base model | Qwen2.5-Coder-14B-Instruct |101| Method | LoRA (r=64, α=16) |102| Learning rate | 5e-5 |103| Batch size | 128 |104| Epochs | 3 |105| Optimizer | AdamW |106| Precision | bfloat16 |107| Objective | Completion-only loss |108| Context length | 32,768 |109| Framework | PyTorch + FSDP + Flash Attention 2 |110| Hardware | 8× H200 GPUs |111 112---113 114## Model Architecture115 116- **Base:** Qwen2.5-Coder (14 B parameters, GQA attention, extended RoPE embeddings)  117- **Tokenizer:** 151 k vocabulary optimized for Rust syntax  118- **Context:** 32 k tokens  119- **Fine-tuning:** Parameter-efficient LoRA adapters (≈1% of parameters updated)  120- **Deployment:** Compatible with local deployment and Fortytwo Capsule runtime for distributed swarm inference  121 122---123 124## Evaluation Protocol125 126- All evaluations executed in Docker-isolated Rust 1.86.0 environment  127- **Code tasks:** measured via unit test pass rate  128- **Documentation & naming tasks:** scored via LLM-based correctness (Claude Sonnet 4 judge)  129- **Code completion & API tasks:** syntax-weighted Levenshtein similarity  130- **Comment generation:** compilation success metric  131 132---133 134## Why It Matters135 136Rust is a high-safety, low-level language with complex ownership semantics that make it uniquely challenging for general-purpose LLMs.  137At the same time, there is simply **not enough high-quality training data on Rust**, as it remains a relatively modern and rapidly evolving language.  138This scarcity of large, reliable Rust datasets – combined with the language’s intricate borrow checker and type system – makes it an ideal benchmark for evaluating true model understanding and reasoning precision.139 140**Strand-Rust-Coder** demonstrates how **specialized models** can outperform giant centralized models – achieving domain mastery with a fraction of the compute.  141Through **Fortytwo’s Swarm Inference**, the network was able to generate an **extremely accurate synthetic dataset**, enabling a **state-of-the-art Rust model** to be built through an efficient **LoRA fine-tune** rather than full retraining.142 143This work validates Fortytwo’s thesis: **intelligence can scale horizontally through networked specialization rather than centralized scale.**144 145---146 147## 🔬 Research & References148 149- [Fortytwo: Swarm Inference with Peer-Ranked Consensus (arXiv)](https://arxiv.org/abs/2510.24801) - *Fortytwo Swarm Inference – Technical Report*  150- [Self-Supervised Inference of Agents in Trustless Environments (arXiv)](https://arxiv.org/abs/2409.08386) – *High-level overview of Fortytwo architecture*  151 152---153 154## Intended Use155 156- Rust code generation, completion, and documentation  157- Automated refactoring and test generation  158- Integration into code copilots and multi-agent frameworks  159- Research on domain-specialized model training and evaluation  160 161### Limitations162- May underperform on purely algorithmic or multi-language tasks (e.g., HumanEval-style puzzles).  163- Not suitable for generating unverified production code without compilation and test validation.  164 165---166 167## Integration with Fortytwo Network168 169Strand-Rust-Coder models are integrated into **Fortytwo’s decentralized Swarm Inference Network**, where specialized models collaborate and rank each other’s outputs.  170This structure enables **peer-reviewed inference**, improving reliability while reducing hallucinations and cost.171 172To run a Fortytwo node or contribute your own models and fine-tunes, visit: [fortytwo.network](https://fortytwo.network)173 174---175 176## Inference Examples177 178### Using `pipeline`179 180```python181from transformers import pipeline182 183pipe = pipeline("text-generation", model="Fortytwo-Network/Strand-Rust-Coder-14B-v1")184messages = [185    {"role": "user", "content": "Write a Rust function that finds the first string longer than 10 characters in a vector."},186]187pipe(messages)188```189 190### Using Transformers Directly191 192```python193# Load model directly194from transformers import AutoTokenizer, AutoModelForCausalLM195 196tokenizer = AutoTokenizer.from_pretrained("Fortytwo-Network/Strand-Rust-Coder-14B-v1")197model = AutoModelForCausalLM.from_pretrained("Fortytwo-Network/Strand-Rust-Coder-14B-v1")198 199messages = [200    {"role": "user", "content": "Write a Rust function that finds the first string longer than 10 characters in a vector."},201]202 203inputs = tokenizer.apply_chat_template(204    messages,205    add_generation_prompt=True,206    tokenize=True,207    return_dict=True,208    return_tensors="pt",209).to(model.device)210 211outputs = model.generate(**inputs, max_new_tokens=40)212print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))213```214 215---216 217## Quantized Versions218 219Optimized GGUF quantizations of **Strand-Rust-Coder-14B-v1** are available for local and Fortytwo Node deployment, offering reduced memory footprint with minimal performance trade-off.220 221These builds are compatible with **llama.cpp**, **Jan**, **LM Studio**, **Ollama**, and other runtimes supporting the GGUF format.222 223| **Quantization** | **Size** | **Bit Precision** | **Description** |224|------------------|-----------|------------------|----------------|225| **Q8_0** | 15.7 GB | **8-bit** | Near-full precision, for most demanding local inference |226| **Q6_K** | 12.1 GB | **6-bit** | Balanced performance and efficiency |227| **Q5_K_M** | 10.5 GB | **5-bit** | Lightweight deployment with strong accuracy retention |228| **Q4_K_M** | 8.99 GB | **4-bit** | Ultra-fast, compact variant for consumer GPUs and laptops |229 230Quant versions: [Fortytwo-Network/Strand-Rust-Coder-14B-v1-GGUF](https://huggingface.co/Fortytwo-Network/Strand-Rust-Coder-14B-v1-GGUF)231 232---233 234**Fortytwo – An open, networked intelligence shaped collectively by its participants**  235 236Join the swarm: [fortytwo.network](https://fortytwo.network)237 238X: [@fortytwo](https://x.com/fortytwo)