Text Generation
Transformers
Safetensors
English
gemma
code
reasoning
codegemma
safe-tensors
distillation
synthetic-dataset
text-generation-inference
Instructions to use WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled") model = AutoModelForCausalLM.from_pretrained("WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled
- SGLang
How to use WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled 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 "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled with Docker Model Runner:
docker model run hf.co/WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
| 1 |
-
Here is a complete, professional, and well-structured Hugging Face model card (README.md) designed specifically for WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled.
|
| 2 |
-
You can copy and paste the raw Markdown block below directly into your repository’s README.md file.
|
| 3 |
---
|
| 4 |
license: apache-2.0
|
| 5 |
tags:
|
| 6 |
- text-generation
|
| 7 |
- code
|
| 8 |
- reasoning
|
|
|
|
| 9 |
- gemma
|
| 10 |
- safe-tensors
|
| 11 |
-
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
library_name: transformers
|
| 15 |
language:
|
|
@@ -18,47 +24,43 @@ language:
|
|
| 18 |
|
| 19 |
# Gemini3.5-Code.Reasoner-2b-Distilled
|
| 20 |
|
| 21 |
-
Gemini3.5-Code.Reasoner-2b-Distilled is a
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
## Model Details
|
| 26 |
|
| 27 |
- **Developed by:** WithinUsAI
|
| 28 |
-
- **Model Type:** Causal Language Model (Fine-tuned / Distilled)
|
| 29 |
-
- **Base Model:**
|
| 30 |
-
- **Architecture:** GemmaForCausalLM
|
| 31 |
-
- **Language(s):** English (Primary), Code languages (Python, JavaScript, C++, Go, etc.)
|
| 32 |
- **License:** Apache 2.0
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
| 37 |
-
- **Local Code Assistance:** Fast autocompletion, code translation, and docstring generation on consumer-grade hardware.
|
| 38 |
-
- **Reasoning-focused Scripting:** Handling multi-step software logic tasks where the model must think step-by-step before writing out a block of code.
|
| 39 |
-
- **Mobile & Edge Deployments:** Thanks to its 2B parameter scale, it is optimal for low-latency setups.
|
| 40 |
|
| 41 |
-
|
| 42 |
-
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
##
|
| 46 |
-
|
| 47 |
-
### Using Transformers Pipeline
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
Write a Python function to find the longest palindromic substring in a string.
|
| 56 |
-
"""
|
| 57 |
|
| 58 |
-
|
| 59 |
-
print(outputs[0]["generated_text"])
|
| 60 |
|
| 61 |
-
|
| 62 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 63 |
import torch
|
| 64 |
|
|
@@ -71,31 +73,12 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 71 |
device_map="auto"
|
| 72 |
)
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
# Start the OpenAI-compatible vLLM server
|
| 84 |
-
vllm serve "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled"
|
| 85 |
-
|
| 86 |
-
You can then query it via curl:
|
| 87 |
-
curl -X POST "http://localhost:8000/v1/completions" \
|
| 88 |
-
-H "Content-Type: application/json" \
|
| 89 |
-
--data '{
|
| 90 |
-
"model": "WithinUsAI/Gemini3.5-Code.Reasoner-2b-Distilled",
|
| 91 |
-
"prompt": "<bos>Explain the time complexity of QuickSort.",
|
| 92 |
-
"max_tokens": 512,
|
| 93 |
-
"temperature": 0.2
|
| 94 |
-
}'
|
| 95 |
-
|
| 96 |
-
Repository Structure
|
| 97 |
-
The weight distribution includes both the base model layers and structural adapter targets for easy loading:
|
| 98 |
-
* model.safetensors (~5.01 GB) - The primary model weights.
|
| 99 |
-
* adapter_model.safetensors (~49.9 MB) & adapter_config.json - LoRA configuration fine-tuned for code extraction and reasoning properties.
|
| 100 |
-
* tokenizer.json & tokenizer_config.json - Tokenizer structures mapped to the base Gemma profile.
|
| 101 |
-
---
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
tags:
|
| 4 |
- text-generation
|
| 5 |
- code
|
| 6 |
- reasoning
|
| 7 |
+
- codegemma
|
| 8 |
- gemma
|
| 9 |
- safe-tensors
|
| 10 |
+
- distillation
|
| 11 |
+
- synthetic-dataset
|
| 12 |
+
base_model: google/codegemma-1.1-2b
|
| 13 |
+
datasets:
|
| 14 |
+
- WithinUsAI/GeminiPro3.2_max_distill_god_seed_25k
|
| 15 |
+
- WithinUsAI/gemini_3.5_flash_distilled_25k
|
| 16 |
+
- WithinUsAI/Gemini_3.2_Pro_Distilled
|
| 17 |
+
- WithinUsAI/codegemma_gemini_pro_32_distilled_25k
|
| 18 |
+
- WithinUsAI/DEEPMIND_Alpha_Distilled
|
| 19 |
pipeline_tag: text-generation
|
| 20 |
library_name: transformers
|
| 21 |
language:
|
|
|
|
| 24 |
|
| 25 |
# Gemini3.5-Code.Reasoner-2b-Distilled
|
| 26 |
|
| 27 |
+
Gemini3.5-Code.Reasoner-2b-Distilled is a highly efficient, reasoning-dense model tailored for advanced coding tasks, algorithmic problem-solving, and logical chain-of-thought workflows.
|
| 28 |
|
| 29 |
+
By applying a specialized Low-Rank Adaptation (LoRA) layer over **CodeGemma 1.1 2B**, this model infuses frontier-level reasoning mechanics into a compact, 2-billion parameter architecture. It bridges the gap between massive cloud-hosted models and local, edge-compute hardware.
|
| 30 |
|
| 31 |
## Model Details
|
| 32 |
|
| 33 |
- **Developed by:** WithinUsAI
|
| 34 |
+
- **Model Type:** Causal Language Model (Fine-tuned / Knowledge Distilled)
|
| 35 |
+
- **Base Model:** [google/codegemma-1.1-2b](https://huggingface.co/google/codegemma-1.1-2b)
|
| 36 |
+
- **Architecture:** GemmaForCausalLM (CodeGemma variant) + LoRA Adapters
|
|
|
|
| 37 |
- **License:** Apache 2.0
|
| 38 |
|
| 39 |
+
## Training & Dataset Recipe
|
| 40 |
|
| 41 |
+
The "Reasoner" capabilities of this model are distilled from a multi-source synthetic pipeline focusing on complex coding logic, algorithmic optimization, and step-by-step thinking patterns. The training mixture leverages approximately 100K+ high-quality reasoning examples across five core datasets:
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
| Dataset Name | Source / Focus | Approx. Size |
|
| 44 |
+
| :--- | :--- | :--- |
|
| 45 |
+
| `WithinUsAI/GeminiPro3.2_max_distill_god_seed_25k` | High-quality frontier seed prompts for code generation. | ~25k samples |
|
| 46 |
+
| `WithinUsAI/gemini_3.5_flash_distilled_25k` | Fast, iterative logical steps and multi-turn debugging data. | ~25k samples |
|
| 47 |
+
| `WithinUsAI/Gemini_3.2_Pro_Distilled` | Heavy math logic, structural coding, and system design patterns. | Premium corpus |
|
| 48 |
+
| `WithinUsAI/codegemma_gemini_pro_32_distilled_25k` | Target-aligned distillation data optimized for the CodeGemma vocabulary. | ~25k samples |
|
| 49 |
+
| `WithinUsAI/DEEPMIND_Alpha_Distilled` | Deep algorithmic competitive programming and math reasoning. | Premium corpus |
|
| 50 |
|
| 51 |
+
## Intended Use
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
- **Local Code Assistants:** Ideal for IDE plugins requiring fast, low-latency code completion and instruction following.
|
| 54 |
+
- **Logical Chain-of-Thought:** Designed to output its reasoning process before writing the final code block, minimizing syntax and logical errors.
|
| 55 |
+
- **Resource-Constrained Environments:** Can easily be deployed on mobile devices, single-GPU setups, or local laptops using frameworks like `vLLM`, `Ollama`, or `SGLang`.
|
| 56 |
|
| 57 |
+
## Quickstart Guide
|
| 58 |
|
| 59 |
+
### Inference with Hugging Face Transformers
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
Because CodeGemma utilizes specialized tokens for coding workflows, it's recommended to structure your prompts cleanly to prompt the model's inner chain-of-thought.
|
|
|
|
| 62 |
|
| 63 |
+
```python
|
| 64 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 65 |
import torch
|
| 66 |
|
|
|
|
| 73 |
device_map="auto"
|
| 74 |
)
|
| 75 |
|
| 76 |
+
# Prompt the model to think step-by-step before delivering code
|
| 77 |
+
prompt = """<bos>Analyze the problem and think step-by-step before writing any code.
|
| 78 |
+
Problem: Write a Python generator function that yields the Fibonacci sequence up to n elements.
|
| 79 |
+
Answer:"""
|
| 80 |
|
| 81 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 82 |
+
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2)
|
| 83 |
+
|
| 84 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|