Instructions to use Kobarac/gemma4-31b-factual-tool-selector-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Kobarac/gemma4-31b-factual-tool-selector-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-31B-it") model = PeftModel.from_pretrained(base_model, "Kobarac/gemma4-31b-factual-tool-selector-lora") - Notebooks
- Google Colab
- Kaggle
Gemma 4 31B Factual Tool Selector LoRA
PEFT LoRA adapter for the deterministic-tool routing stage of a factuality judge. For each atomic claim, the selector emits at most one supported tool call or defers to the architecture's fixed claim verifier.
This artifact is the manually selected v1.1 checkpoint 176. It is a selector, not a standalone factuality judge and not an autonomous fact-checking authority.
Lineage
| Field | Value |
|---|---|
| Base model | google/gemma-4-31B-it |
| Base revision | 842da3794eaa0b77d5f08bae87a17459d91ff475 |
| Adapter format | PEFT LoRA |
| PEFT version | 0.20.0 |
| Rank / alpha / dropout | 8 / 160 / 0 |
| Target layers | Final eight transformer layers, 52–59 |
| Target modules | q/k/v/o projections and gate/up/down projections |
| Dataset | Kobarac/gemma4-31b-tool-selector-sft-v1.1 |
| Prompt variant | selector_v1 |
| Maximum calls | 1 per claim |
| Repository commit | ccdf925a5b5e635caccc566367276a311509d73f |
Training used a quantized frozen base with trainable BF16 LoRA parameters. The adapter itself is not quantized. A merged BF16 convenience model, when available, must be published separately and verified against adapter-on-base inference.
Evaluation
Checkpoint 176 was selected manually on development data. On the frozen
128-example family evaluation, hybrid correctness improved from 115/128 (89.84%)
to 124/128 (96.88%): nine repairs and zero tool-caused regressions. See
lineage/selector_checkpoint_decision.json and lineage/manifest.json for the
recorded evidence and hashes.
The decision artifact records pending_explicit_activation. Publishing this
adapter does not imply that it is enabled by default in the full architecture.
Loading
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "google/gemma-4-31B-it"
revision = "842da3794eaa0b77d5f08bae87a17459d91ff475"
tokenizer = AutoTokenizer.from_pretrained(base_id, revision=revision)
base = AutoModelForCausalLM.from_pretrained(
base_id,
revision=revision,
torch_dtype="auto",
device_map="auto",
)
model = PeftModel.from_pretrained(
base,
"Kobarac/gemma4-31b-factual-tool-selector-lora",
)
Use the exact selector prompt and deterministic tool registry from the linked dataset or source repository.
Tools and execution contract
The matching dataset publishes the exact executable implementation:
source/deterministic_tools.py.
The selector can choose exactly one of:
arithmetic_relation_v1: ratio, percent-change, and relative-percent checks;masked_aggregate_v1: masked counts and sums;currency_relation_v1: common-basis largest/smallest/total and basis checks;scaled_number_v1: coefficient-times-multiplier equality.
Calls use primitive JSON arguments only. Strict validation rejects extra or missing keys, non-finite decimals, oversized vectors, missing currency bases, ambiguous ties, unsupported operations, and partial-claim routes. Rejection, selector deferral, malformed output, and runtime failure all fall back to the fixed neural verifier.
Concrete comparison
On recorded test example E008, a Gemma 4 31B direct judge counted 2 unsupported
facts even though all 3 response claims were wrong. Claim extraction exposed all
three independently. The fallback verifier still missed the “18% revenue
increase” error, but the selector called arithmetic_relation_v1 with Q1
4,940,000, Q2 6,273,800, and claimed value 18; the tool calculated 27
and marked the claim unsupported. The hybrid therefore returned the correct
count of 3. See the dataset card for the complete input, call, result, caveat,
and links to raw run artifacts.
Integrity
adapter_config.json:e1f95d84402ed0b49333127db77a51f60db79f12a96798bd1707789193b99002adapter_model.safetensors:29d318f92641297fd1442d698df2b79ecd4a4532defc9296fe375ced19d1621elineage/manifest.json:1a66f06c8f41d45b2891740c77a5d6298ebe3332d97521c3d42f7db1e3f2a446lineage/selector_checkpoint_decision.json:7252c346e83e5455f624788f986f49f70ea8c6fee0264675486babcf350018b0
Limitations
The selector supports only the versioned primitive registry. Partial-claim routing, malformed plans, and unsupported operations must defer. Performance was measured on a small targeted benchmark and may not generalize to other domains, languages, prompts, or tool implementations.
Licensed under Apache-2.0. Gemma is a trademark of Google LLC; use of the name is descriptive and does not imply endorsement. Preserve upstream notices.
- Downloads last month
- 33