Downloads · 30 days
9
15% of all-time downloads
brunogonzaga/pinhao-gemma4-rag-adapter
pinhao-gemma4-rag-adapter is a text generation model from brunogonzaga. Use it when you need the model to write or continue text. It is set up for peft.
Public LoRA/PEFT adapter for google/gemma-4-E4B-it.
Downloads · 30 days
9
15% of all-time downloads
All-time downloads
62
Public
Repo size
102 MB
Likes
0
Public
Click a slice to open those files.
.safetensors69.8 MB · 68%
From the Hugging Face model README
Public LoRA/PEFT adapter for google/gemma-4-E4B-it.
This is a learning experiment for answer behavior in a local Obsidian RAG workflow. It is not a memory store and does not contain private vault notes.
Use this adapter with local RAG context to encourage:
[S#] format;The knowledge source is still the local RAG system. The adapter only shapes behavior and output format.
google/gemma-4-E4B-itUse of this adapter still requires access to, and compliance with, the base Gemma model terms.
Training used only synthetic data generated for the lab:
data/gemma4-rag-contract-train.jsonl: 160 synthetic chat rowsdata/gemma4-rag-contract-eval.jsonl: 40 synthetic holdout rowsThe dataset contains fake project names, fake source paths, fake decisions, and fake next steps. It intentionally excludes real Obsidian notes, SQLite indexes, embeddings, personal data, secrets, receipts, CPF, email, phone numbers, and private vault content.
2.11.0+cu128, transformers 5.12.1, TRL 1.6.0, PEFT 0.19.1LoRA targets were limited to model.language_model.* modules to avoid multimodal wrapper incompatibilities.
Holdout eval: 40 synthetic RAG contract rows.
Scores are counts over 40 synthetic holdout rows. The adapter changes response behavior, not vault memory.
| Variant | Answer contract | Raw strict | Served strict after cleanup | Exact refusal | Expected citations | No invented citations |
|---|---|---|---|---|---|---|
| base | 18/40 | 14/40 | 18/40 | 33/40 | 27/40 | 40/40 |
| adapter | 37/40 | 20/40 | 37/40 | 40/40 | 37/40 | 40/40 |
Interpretation:
model, thought, or trailing refusal fragments;The adapter was served in an interactive RunPod pod with:
GET /healthPOST /v1/chat/completions127.0.0.1:18000 to pod 127.0.0.1:8000End-to-end smoke:
local rag_ask.py -> local retrieval -> SSH tunnel -> RunPod adapter server
Final smoke result:
[S1] and [S2] citations;Question:
o que aconteceu no serving smoke do adapter Pinhao?
Answer:
O serving smoke do adapter Pinhao validou um servidor HTTP mínimo [S1].
* O servidor respondeu `ok` ao `/health` e teve uma resposta limpa no POST único [S1, S2].
* O mini-eval HTTP obteve 5/5 no contrato estrito e 5/5 no formato limpo [S1, S2].
* Não houve envio de vault, SQLite, embeddings ou nota real ao pod [S1].
* O servidor foi parado após o smoke, e a GPU voltou ao estado idle [S1, S2].
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForMultimodalLM, BitsAndBytesConfig
import torch
base_id = "google/gemma-4-E4B-it"
adapter_id = "brunogonzaga/pinhao-gemma4-rag-adapter"
tokenizer = AutoTokenizer.from_pretrained(adapter_id, use_fast=False)
quantization = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
base = AutoModelForMultimodalLM.from_pretrained(
base_id,
device_map="auto",
quantization_config=quantization,
)
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()
This repository is public and contains adapter artifacts plus documentation only. It was trained on synthetic data and does not include Obsidian vault notes, SQLite indexes, embeddings, secrets, or real personal data. The intended production workflow should still keep the actual vault and retrieval index local/private.