Instructions to use fritzra/gemma-4-e4b-ipl-chase-recommendation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use fritzra/gemma-4-e4b-ipl-chase-recommendation with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it") model = PeftModel.from_pretrained(base_model, "fritzra/gemma-4-e4b-ipl-chase-recommendation") - Notebooks
- Google Colab
- Kaggle
Gemma 4 E4B IPL Chase Policy LoRA
Current CricketRec policy adapter. It was trained for one narrow job on top of
google/gemma-4-E4B-it inside an IPL chase
planning system: ask for missing evidence in the expected order, use values
that are visible in the conversation, and stop after a short recommendation.
External cricket tools do the arithmetic and historical retrieval. The adapter handles the conversation around those results. A controller must supply match state, available players, prior-only checkpoint evidence, player profiles, and live tactical context as the model asks for them.
The repository contains PEFT LoRA weights. Download the base model separately. Use Google's Gemma 4 E4B instruction model.
Source code, evaluation scripts, publication results, and the full technical record are available in the CricketRec IPL Chase Agent GitHub repository.
Artifact details
| Field | Value |
|---|---|
| Public status | Current accepted CricketRec adapter |
| Internal lineage label | V18 evidence-complete policy |
| Base model | google/gemma-4-E4B-it |
| Adapter format | PEFT LoRA |
| LoRA rank, alpha, dropout | 8, 16, 0.05 |
| Adapter parameters | 17,440,768 |
| Weight file size | 34,957,656 bytes |
| Weight-file SHA-256 | a3213420908abe7f27aac1da68e61714a488e21f775c5363625d34c679d63cbe |
| Composite weights-and-config identity | ce447f66c6285b7499a00eece257271e9e932a7315aa33dcfb438739d27865e5 |
| PEFT version at save time | 0.19.1 |
| Task type | Causal language modeling |
The composite identity is the SHA-256 of a canonical JSON object containing
the separate weight-file and adapter-configuration hashes. Exact values are in
provenance.json.
LoRA targets the text-language attention Q, K, V, and O projections plus the MLP gate, up, and down projections. Audio and vision towers stay untouched.
What the adapter expects
The accepted interaction moves through five evidence families:
- available batting options and candidate bowlers
- prior-only score, wicket, and provenance evidence
- qualified phase profiles for available batters
- qualified phase profiles for candidate bowlers
- striker, non-striker, confirmed next bowler, and risk preference
An unavailable result still resolves that evidence family. The controller should state the absence plainly, retain the full visible history, and let the adapter move to the next unresolved question. Recommendation waits until every required family is resolved.
Supported planning transitions are 0 to 6 overs, 6 to 10 overs, and 10 to 15 overs. Later intervals begin from the real score and wicket state recorded at their boundary.
Load the adapter
The example below uses 4-bit NF4 quantization, which matches the project's local inference setup closely enough for a first run.
import torch
from peft import PeftModel
from transformers import (
AutoModelForMultimodalLM,
AutoTokenizer,
BitsAndBytesConfig,
)
BASE_MODEL = "google/gemma-4-E4B-it"
ADAPTER = "fritzra/gemma-4-e4b-ipl-chase-recommendation"
quantization = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
# Load the tokenizer from this repository to retain the accepted chat template.
tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
base_model = AutoModelForMultimodalLM.from_pretrained(
BASE_MODEL,
quantization_config=quantization,
dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(
base_model,
ADAPTER,
is_trainable=False,
)
model.eval()
The base model is large. On the 16 GB development machine, CricketRec kept the frozen per-layer embedding on CPU while the language layers and adapter ran on the GPU. Other machines may need different placement.
Use the saved chat template when encoding the visible conversation:
messages = [
{
"role": "user",
"content": (
"Match: Royal Challengers Bengaluru vs Sunrisers Hyderabad.\n"
"Chase: RCB are 0/0 after 0 overs, target 202. "
"Plan through 6 overs.\n"
"Available batting options: ...\n"
"Candidate bowlers: ..."
),
}
]
encoded = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
)
At this point the expected assistant action is a compact evidence question,
such as a request for prior-only score, wicket, and provenance support. The
controller answers with tool output. It continues until Recommendation:
appears.
Training data
The analytical cricket corpus contained 290 usable IPL matches, 69,851 deliveries, and 2,900 checkpoint states from the 2022 through 2025 seasons. Those records powered the deterministic evidence tools.
The accepted lineage uses a smaller supervised surface. Across four stages, it saw 340 full-conversation examples and completed 980 optimizer updates.
| Stage | Training years | Train examples | Purpose |
|---|---|---|---|
| V14 | 2022-2023 | 60 | Answer-conditioned stopping |
| V15 | 2022-2023 | 110 | Broader evidence transitions |
| V17 | 2022-2023 | 60 | Recommendation grounding and quality |
| V18 | 2022-2023 | 110 | Evidence-complete question policy |
Each row is a complete visible conversation prefix. Loss applies only to the final assistant turn. Separate 2024 cases were used during development. The accepted stages excluded 2025, although earlier experiments had already consulted that season, so 2025 is outside the untouched-holdout claim.
Training procedure
- 4-bit NF4 base model with double quantization
- BF16 compute
- paged AdamW 8-bit optimizer
- LoRA rank 8, alpha 16, dropout 0.05
- batch size 1
- learning rate
1e-4in the final stage - two final-stage epochs and 220 final-stage updates
- final-assistant-turn-only target mask
- maximum audited final-stage materialized length of 447 tokens
The final stage took 164.44 seconds and reported aggregate training loss of 0.2571. Acceptance came from fresh-process conversation tests rather than the training loss.
Evaluation
Frozen base-versus-adapter replay
Six conversation prefixes were run through the same base model with the adapter disabled and enabled. The tokenizer, prompt, greedy decoding settings, stop tokens, and 128-token limit stayed fixed.
| Metric | Base | Adapter |
|---|---|---|
| Correct next action | 1/6 | 6/6 |
| Strict expected response | 0/6 | 5/6 |
| 128-token cap hits | 6/6 | 0/6 |
| Mean output tokens | 128.0 | 28.5 |
The single strict miss returned the right endpoint band and wicket cap but left out one expected median. Six cases are enough to confirm the intended policy change. They do not establish broad resilience across new prompt forms.
Corrected 2024 development gate
The accepted adapter was compared with its V17 predecessor on 12 evidence-complete conversations.
| Metric | V17 predecessor | Current adapter |
|---|---|---|
| Fully correct conversations | 0/12 | 12/12 |
| Correct required questions | 3/54 | 54/54 |
| Early recommendations | 42 | 0 |
| Correct grounded final responses | 3/12 | 12/12 |
IPL 2026 season study
The full CricketRec system processed 74 matches and 222 checkpoints at 6, 10, and 15 overs. It produced 193 usable endpoint recommendations. All 193 copied the selected deterministic endpoint exactly, and all 177 evidence-backed wicket values matched the supplied wicket reference.
On 129 checkpoints shared with forward-looking expert tactical targets and actual scores, the system recorded run MAE of 11.08 versus 14.42 for the expert targets. The paired difference was 3.34 runs, with a match-cluster bootstrap 95% interval from 0.88 to 5.94 runs.
That season comparison measures the complete pipeline. Historical retrieval or required-rate arithmetic supplied the numerical target, while the adapter managed evidence order, grounding, wording, and stopping.
Intended use
This adapter is suited to experiments on small-data behavioral post-training, auditable tool-guided conversations, and IPL checkpoint planning with a controller that supplies structured evidence.
Do not use it for betting, financial decisions, or unsupported live-match claims. Generated recommendations need validation against the supplied tool results before they are shown to a user.
Limitations
- The supervised curriculum contains only 340 examples across four stages.
- Accepted training contexts remain below 480 tokens.
- The controlled base comparison contains six cases.
- Numerical endpoints come from deterministic tools outside the adapter.
- The 2026 study was exploratory and was not preregistered as a final test.
- Expert powerplay coverage is sparse compared with the later checkpoints.
- Earlier experiments consulted 2025, removing it as an untouched holdout.
- Paraphrases, conflicting evidence, corrections, and adversarial prompts need a larger frozen evaluation.
Files in this repository
adapter_model.safetensors: LoRA weightsadapter_config.json: PEFT adapter configurationtokenizer.jsonandtokenizer_config.json: accepted tokenizer fileschat_template.jinja: accepted conversation templateprovenance.json: lineage and artifact hashes without local machine pathsLICENSE: Apache License 2.0
Training checkpoints, optimizer state, provider payloads, raw tweets, and base model weights are intentionally absent.
License
This adapter is released under Apache License 2.0. The base model has its own Gemma 4 model card and license page. Data sources and third-party providers remain subject to their respective terms.
- Downloads last month
- -