--- license: apache-2.0 base_model: Qwen/Qwen3.5-9B library_name: peft tags: - lora - peft - qwen - qwen3.5 - geotechnical-engineering - civil-engineering language: - en pipeline_tag: text-generation --- # GeoTech-SLM-9B-LoRA LoRA adapters (`sd-a30/` and `grpo-60/`) for [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B), trained for geotechnical design calculations. Details are in the paper *A local small language model with frontier-agent fallback for geotechnical design calculations* (Youwai, KMUTT, 2026). **Do not merge the `grpo-60` adapter into bf16**; apply it as a runtime LoRA on the merged `sd-a30` model, or most of the GRPO update is lost. This model is not a substitute for a licensed engineer's checks. ## Performance (GeoTechBench v0.4.1 holdout, N = 338, thinking mode, 32k budget) | | Base 9B | SD (sdA-30) | SD+GRPO-60 | | --- | ---: | ---: | ---: | | Single reply at 32k (T 0.6) | 208 | 210 | 208 | | Same replies cut at 14k | 154 | 163 | 179 | | Median reply length (tokens) | 13,820 | 12,847 | 12,031 | | Truncated at 14k | 46.4% | 38.5% | 32.8% | | Truncated at 32k | 7.1% | 7.7% | 5.6% | | Accuracy of finished replies at 32k | 66.2% | 67.3% | 65.2% | | Vote of 8 (T 0.8), majority | 252 | 245 | 256 | | Vote of 8, mean single sample | 217.0 | 213.4 | 216.5 | | Vote of 8, pass@8 | 283 | 283 | 287 | | Vote of 8 cut at 14k, majority | 208 | 218 | 231 | At 14k, SD+GRPO vs base is +42/−17 (exact McNemar p = 0.0015). At 32k the single-reply differences are not significant (p = 0.905 for SD vs base, p = 1.0 for GRPO vs base). With the vote of 8, the fine-tuned and base models are statistically tied at 32k (exact McNemar p = 0.31 for SD vs base, p = 0.62 for SD+GRPO vs base). GRPO's gain is significant at 14k: SD+GRPO vs base is +31/−8 (p = 0.0003). ## Usage ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel base_id, repo = "Qwen/Qwen3.5-9B", "Sompote/GeoTech-SLM-9B-LoRA" tok = AutoTokenizer.from_pretrained(base_id) model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto") model = PeftModel.from_pretrained(model, repo, subfolder="sd-a30").merge_and_unload() model = PeftModel.from_pretrained(model, repo, subfolder="grpo-60") # runtime LoRA; do not merge ``` For the vote-of-8 result, draw 8 samples with `enable_thinking=True`, `max_new_tokens=32768`, temperature 0.8, top-p 0.95 and top-k 20, then majority-vote the answers. For vLLM, serve the merged `sd-a30` model and attach `grpo-60` with `--enable-lora --max-lora-rank 32`. ## License These adapters are released under [Apache 2.0](https://huggingface.co/Qwen/Qwen3.5-9B/blob/main/LICENSE), following the base model [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B). ## Citation ```bibtex @article{youwai2026geotechslm, author = {Youwai, Sompote}, title = {A local small language model with frontier-agent fallback for geotechnical design calculations}, journal = {under review}, year = {2026}, note = {King Mongkut's University of Technology Thonburi (KMUTT)} } ```