Downloads · 30 days
44
20% of all-time downloads
oopere/qwen3-0.6b-weather-geo-M
qwen3-0.6b-weather-geo-M 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 M is the second member of the specialist model family built in Chapter 13 of the book "Rearchitecting LLMs", and the first step of a cascaded pruning-and-distillation pipeline. It is derived from T, the LoRA fin…
Downloads · 30 days
44
20% of all-time downloads
All-time downloads
222
Public
Parameters
490M
19.2 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors980 MB · 99%
From the Hugging Face model README
Model M is the second member of the specialist model family built in Chapter 13 of the book "Rearchitecting LLMs", and the first step of a cascaded pruning-and-distillation pipeline. It is derived from T, the LoRA fine-tuned weather/geo tool-calling specialist, through depth pruning → width pruning → knowledge distillation, in that order.
Depth is ranked on the intact teacher T, then width pruning is applied to the depth-pruned model. Both pruning stages share the same calibration prompts, while the knowledge-distillation teacher remains the unpruned T — the only model in the family that has never lost capability, providing the cleanest supervision signal.
Model M will, in turn, serve as the pruning source and distillation teacher for Model S, the next and smallest member of the family.
Evaluation uses exact-match and tolerant-match (functionally equivalent values — superset city names, coordinates within 0.05°) on the same 54-example held-out test set used for T, across every stage of the cascade.
| Stage | Valid JSON | Exact Match | Tolerant Match | No Call | Wrong Function | Wrong Args |
|---|---|---|---|---|---|---|
| T (28L, 3072) | 100.0% | 96.3% | 96.3% | 0 | 0 | 2 |
| Depth only (25L, 3072) | 61.1% | 44.4% | 61.1% | 21 | 0 | 0 |
| Depth+Width, pre-KD (25L, 2304) | 68.5% | 48.1% | 63.0% | 17 | 0 | 3 |
| M, post-KD (25L, 2304) | 100.0% | 98.1% | 98.1% | 0 | 0 | 1 |
Pruning alone — before distillation — collapses accuracy (96.3% → 48.1% exact match), mostly through the model failing to emit a tool call at all (17 of 54 cases). Knowledge distillation from T fully recovers this gap and slightly exceeds the teacher's exact-match score on this test set.
| Seed | Exact Match |
|---|---|
| 43 | 92.6% |
| 44 | 90.7% |
| 42 (canonical) | 98.1% |
Seed 42 was fixed as the canonical Model M run before training, to avoid selecting the checkpoint based on test-set performance. The spread across seeds (92.6%–98.1%) corresponds to a 4-example swing out of 54, which is within the range expected from batch-order noise at this dataset size.
| Model | Mean | 95% CI |
|---|---|---|
| T | 96.3% | [90.7%, 100.0%] |
| Pre-KD | 48.1% | [35.2%, 61.1%] |
| M | 98.1% | [94.4%, 100.0%] |
| Function | Exact Match |
|---|---|
local_weather_api | 10/10 |
get_ip_zipcode | 25/26 |
get_city_from_zipcode | 18/18 |
M's single failure on the test set is not a new error introduced by pruning or distillation — checking against T's failures directly, M has zero failures that T did not also make (both models share the same 2 error-prone cases, with M recovering one of them).
| T | M | |
|---|---|---|
| Layers | 28 | 25 |
| MLP intermediate size | 3072 | 2304 |
| Expansion rate (intermediate/hidden) | 300% | 225% |
| Non-embedding params | 596.0M | 489.9M |
| Total params | 751.6M | 645.5M |
| Embeddings share of total | 21% | 24% |
[13, 23, 25] in T, selected by ascending cosine-distance importance with protection for the first 4 and last 2 layers, and no adjacent removalsMAW (hybrid, data-driven Mean Absolute Weight) neuron selection, targeting a 225% expansion rate (divisor 128) — 3072 → 2304 per layer, applied uniformly across all 25 surviving layersdepth_index_map (new index → original T index) is preserved and handed off for use by the next notebook in the cascadeSame curated and deduplicated split used for T: Salesforce/xlam-function-calling-60k, filtered to 3 domain functions, 177 examples after deduplication, split 123 train / 54 test (stratified by function, test_size=0.30, random_state=42) — reused across every stage of the family for comparability.
α·Task CE + β·KL(student‖teacher logits), feature losses disabled
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "oopere/qwen3-0.6b-weather-geo-M"
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 an intermediate checkpoint for readers following the full pruning cascade to Model S.
get_ip_zipcode, get_city_from_zipcode, local_weather_api); no general-purpose tool-calling capability was evaluatedIf 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.