Downloads · 30 days
53
42% of all-time downloads
oopere/qwen3-0.6b-weather-geo-S
qwen3-0.6b-weather-geo-S is a machine learning model from oopere. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Model S is the third and smallest member of the specialist model family built in Chapter 13 of the book "Rearchitecting LLMs", and the second step of the cascaded pruning-and-distillation pipeline. It is derived from…
Downloads · 30 days
53
42% of all-time downloads
All-time downloads
125
Public
Parameters
415M
19.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors830 MB · 99%
From the Hugging Face model README
Model S is the third and smallest member of the specialist model family built in Chapter 13 of the book "Rearchitecting LLMs", and the second step of the cascaded pruning-and-distillation pipeline. It is derived from M through depth pruning → width pruning → knowledge distillation, mirroring the procedure used to derive M from the original specialist T — with layer importance and activation statistics recomputed on M rather than reused from T.
In this run, the knowledge-distillation teacher is M itself (the notebook supports switching to T as an alternative teacher via a single configuration flag). T remains available as the tokenizer source and as a reference point for tracking whether errors compound down the cascade.
Evaluation uses the same exact-match / tolerant-match protocol and 54-example held-out test set as T and M.
| Stage | Valid JSON | Exact Match | Tolerant Match | No Call | Wrong Function | Wrong Args |
|---|---|---|---|---|---|---|
| M (25L) — teacher | 100.0% | 98.1% | 98.1% | 0 | 0 | 1 |
| Depth only (22L) | 96.3% | 24.1% | 25.9% | 2 | 29 | 9 |
| Depth+Width, pre-KD | 96.3% | 20.4% | 20.4% | 2 | 31 | 10 |
| S, post-KD (22L) | 100.0% | 94.4% | 94.4% | 0 | 0 | 3 |
Pruning collapses accuracy far more sharply here than at the T→M stage: the intermediate pruned model mostly selects the wrong function (29-31 cases) rather than failing to emit a call at all. Distillation from M recovers this almost completely — S lands at 94.4% exact match, within 4 points of M's 98.1%.
| Seed | Exact Match |
|---|---|
| 43 | 90.7% |
| 44 | 90.7% |
| 42 (canonical) | 94.4% |
Seed 42 was fixed as the canonical checkpoint before training. The spread across seeds is 2 of 54 examples.
| Model | Mean | 95% CI |
|---|---|---|
| M | 98.1% | [94.4%, 100.0%] |
| Pre-KD | 20.4% | [11.1%, 31.5%] |
| S | 94.4% | [87.0%, 100.0%] |
| Function | Exact Match |
|---|---|
get_ip_zipcode | 25/26 |
get_city_from_zipcode | 18/18 |
local_weather_api | 8/10 |
local_weather_api remains the function where S's compression cost concentrates, though less severely than in earlier runs. Of the 3 test failures, 2 are extra relative to M — both on this function. One drops the num_of_days argument while getting everything else right; the other correctly extracts every argument except lang, generating "fr" instead of "es" for a query stated in Spanish — a plausible confusion given the two queries appear close together in phrasing.
| M | S | |
|---|---|---|
| Layers | 25 | 22 |
| MLP intermediate size | 2304 | 1792 |
| Expansion rate (intermediate/hidden) | 225% | 175% |
| Non-embedding params | 489.9M | 415.2M |
| Total params | 645.5M | 570.7M |
| Embeddings share of total | 24% | 27% |
[12, 14, 21] in M's numbering, selected by ascending cosine-distance importance with protection for the first 4 and last 2 layers, no adjacent removalsMAW (hybrid, data-driven) neuron selection; expansion_rate=175 is resolved relative to the model being pruned (M's 2304), landing at an absolute 175% of hidden size (1792), confirmed after pruning rather than assumeds_to_m_index_map is recorded in the handoff file. The s_to_t_index_map (S index → original T index) is not available for this run — it depends on M's handoff file, which was not present when this notebook ran, so tracing an S layer back to T requires composing the maps by hand from the two notebooks' outputsSame curated and deduplicated split reused across the whole family: Salesforce/xlam-function-calling-60k, 177 examples after deduplication, split 123 train / 54 test (stratified, test_size=0.30, random_state=42).
KD_TEACHER config flag)α·Task CE + β·KL(student‖teacher logits) + γ·Feature Alignment
Note on training length: the logits (KL) loss goes slightly negative from epoch 5 onward, which the notebook flags as the KL term collapsing into numerical noise once the student has converged close to the teacher — a signal that further epochs mainly refine the task loss rather than the distillation signal itself.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "oopere/qwen3-0.6b-weather-geo-S"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [{"role": "user", "content": "What's the weather in Barcelona?"}]
tools = [...] # weather/geo tool schemas — see the book's companion notebook
prompt = tokenizer.apply_chat_template(
messages, tools=tools, tokenize=False, add_generation_prompt=True, enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
This is an educational model created as part of the Hands-on Lab in Chapter 13 of "Rearchitecting LLMs". It demonstrates:
Not intended for production use. This model serves as a learning artifact within a three-function toy domain and as the final checkpoint of the book's pruning cascade example.
get_ip_zipcode, get_city_from_zipcode, local_weather_api); no general-purpose tool-calling capability was evaluatedlocal_weather_api: accuracy on this function is 8/10, with both errors concentrated in argument extraction (a missing num_of_days, a confused lang value) rather than function selectionIf you use this model or the techniques described in your research or projects, please cite:
@book{martra2026rearchitecting,
author = {Pere Martra},
title = {Rearchitecting LLMs: Structural techniques for efficient models},
publisher = {Manning Publications},
year = {2026},
url = {https://hubs.la/Q040tvtp0}
}
@software{optipfair2024,
author = {Pere Martra},
title = {OptiPFair: Structural Pruning and Bias Analysis for LLMs},
year = {2024},
url = {https://github.com/peremartra/optipfair}
}
This model was created following the methodologies taught in "Rearchitecting LLMs" (Manning Publications, 2026). Special thanks to the Manning editorial team and the open-source community behind Hugging Face Transformers and PyTorch.