Instructions to use jakemaly/Gemma4-31B-Socratic-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use jakemaly/Gemma4-31B-Socratic-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-31B-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "jakemaly/Gemma4-31B-Socratic-LoRA") - Notebooks
- Google Colab
- Kaggle
Socratic Gemma 4 31B LoRA โ epoch 2
A research-preview LoRA adapter for a Socratic Python tutor. It is trained to refuse completed programming solutions while diagnosing the learner's likely conceptual error and asking for a useful next step.
This repository contains the adapter only. Download the base model separately:
unsloth/gemma-4-31B-it-unsloth-bnb-4bit.
The base model revision used for training was:
8e256fc6d63003fc0ca8c91b976e6dcc38433385.
Evaluation
On the project's fixed 48-case benchmark, this checkpoint scored:
- Judged leakage: 0/48 (0.00%)
- Actionable diagnosis: 32/48 (66.67%)
These are scoped research results, not a universal safety, security, or leak-proof claim. The benchmark had no disjoint benign/holdout suite, no human calibration, and no adaptive prompt-injection evaluation.
Training
- Base: Gemma 4 31B instruction-tuned, pre-quantized 4-bit
- Method: SFT with QLoRA
- Adapter: rank 16, alpha 32, all-linear language/attention/MLP targets
- Loss: assistant responses only
- Training data: 400 synthetic dialogues across four behavior families
- Run: four epochs; this is the epoch-2 snapshot (
global_step: 200) - Hardware: one NVIDIA RTX 3090
The raw training pool and training environment are not included. The complete experiment record is in the companion source repository: https://github.com/jakemaly/socratic
Intended use
Research, reproducibility, and demonstration of narrow-domain Socratic tutoring behavior. Use a separate application-level policy and evaluation suite before using this adapter in a product or educational setting.
Limitations and risks
The adapter can still produce completed solutions, over-refuse benign tutoring, or behave differently with another prompt template, decoding configuration, base revision, or composed adapter. The reported judge score is evidence for a fixed benchmark only. It does not establish prompt-injection resistance, privacy guarantees, general tutoring quality, or suitability for high-stakes use.
Loading
Use the same Gemma 4 and Unsloth stack as the training run. Load the pinned base revision first, then attach this PEFT adapter. For text-only use, apply the base model's Gemma 4 chat template and the canonical tutor system prompt used by the evaluation.
from unsloth import FastModel
BASE = "unsloth/gemma-4-31B-it-unsloth-bnb-4bit"
BASE_REVISION = "8e256fc6d63003fc0ca8c91b976e6dcc38433385"
ADAPTER = "jakemaly/Gemma4-31B-Socratic-LoRA"
model, tokenizer = FastModel.from_pretrained(
model_name=BASE,
revision=BASE_REVISION,
max_seq_length=1024,
load_in_4bit=True,
full_finetuning=False,
)
model.load_adapter(ADAPTER)
Refer to the base model card and Gemma 4 documentation for hardware, quantization, chat-template, and license requirements.
License and attribution
The adapter is released under the Apache License 2.0, subject to the terms and
attribution requirements applicable to the Gemma 4 base model. See LICENSE
and NOTICE. Gemma 4 is provided by Google under the
Apache License 2.0. This artifact is
not endorsed by Google or Unsloth.
- Downloads last month
- -
Model tree for jakemaly/Gemma4-31B-Socratic-LoRA
Base model
google/gemma-4-31B