Dedicated Endpoints

Run this model inference on single tenant GPU with unmatched speed and reliability at scale.

Learn more
Container

Run this model inference with full control and performance in your environment.

Learn more

Get help setting up a custom Dedicated Endpoints.

Talk with our engineer to get a quote for reserved GPU instances with discounts.

README

License: apache-2.0

Model Details

  • Base model: Qwen/Qwen2.5-0.5B-Instruct
  • Fine-tuning method: LoRA (PEFT) + GatingNetwork (linear head over student hidden states)
  • Distillation strategy: Geometry-only (CKA) — Path B, tokenizer-agnostic
  • Language(s): English, Portuguese, Chinese (inherited from base)
  • License: Apache 2.0
  • Developed by: build-small-hackathon team

Teachers

TeacherParametersHidden dim
Qwen2.5-1.5B-Instruct1.5B1536
SmolLM2-1.7B-Instruct1.7B2048
Phi-3.5-mini-instruct3.8B3072
gemma-2-2b-it2.7B2304
MiniCPM-2B-sft-bf162.7B2304

Distillation Approach

Path B — geometry-only, tokenizer-agnostic:

  1. Each teacher processes its own tokenization of the same text. No shared vocabulary required.
  2. Sequence representations are pooled via masked mean (attention mask weighted) to a single vector per model.
  3. Linear projection heads map each teacher's hidden space into the student's hidden space (d=896).
  4. A GatingNetwork (linear layer over student pooled state → softmax over 5 teachers) learns which teacher's geometry to prioritize per input.
  5. Loss = task cross-entropy + λ·CKA geometry loss (student vs. gated teacher mixture).

The CKA geometry loss aligns the relational structure of representations (which samples are similar to which) rather than raw activation values, making it robust to dimension mismatch and tokenizer differences.

Usage

python

from transformers import AutoTokenizer
from peft import PeftModel, AutoPeftModelForCausalLM
model = AutoPeftModelForCausalLM.from_pretrained(
"build-small-hackathon/deku",
torch_dtype="auto",
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("build-small-hackathon/deku")
inputs = tokenizer("Explain gradient descent in one sentence.", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Additional Artifacts

  • GatingNetwork weights: gating.pttorch.load("gating.pt"), state_dict for a nn.Linear(896, 5)
  • Projection weights: projections.pt — list of 5 nn.Linear state dicts (teacher_i → student space)
  • Visualization data: build-small-hackathon/ofa-viz-data — raw projected embeddings for 3D UMAP soul space
  • Interactive Space: build-small-hackathon/one-for-all

Training

  • Steps: 5000
  • Batch size: 4 (gradient accumulation × 4 = effective 16)
  • Optimizer: AdamW, lr=2e-4, cosine decay
  • Hardware: Modal A10G (24 GB VRAM)
  • Data: subset of HuggingFaceTB/smoltalk (all-Pro split)

Model provider

build-small-hackathon

Model tree

Base

Qwen/Qwen2.5-0.5B-Instruct

Adapter

this model

Modalities

Input

Text

Output

Text

Pricing

Dedicated Endpoints

View details

Supported Functionality

Model APIs

Dedicated Endpoints

Container

More information

Explore FriendliAI today