Small Gemma 3 270M LoRA adapter for extracting compact retrieval tags from
memory text and lookup queries.
The model is built for symmetric memory retrieval:
Run saved memory text through the tagger.
Run future lookup queries through the same tagger.
Rank memories using tag overlap together with embeddings.
This is useful for memory systems, RAG prefilters, support tools, and agent
workflows that need cheap, stable lookup tags without calling a larger language
model for every store and retrieve operation.
What It Returns
The model returns a JSON array of short lowercase tags.
Input:
text
1<memory_tags>
2Remember that billing incidents should be checked in Datadog first, then linked
3to the GitHub deployment.
4</memory_tags>
Tags should be durable lookup handles: services, tools, projects, product areas,
people, entities, workflows, and stable preferences. Generic conversation labels
such as request, task, user, message, help, thing, and information
are not useful tags.
Prompt Contract
Use the same wrapper for stored memories and retrieval queries:
text
1<memory_tags>
2{input_text}
3</memory_tags>
The sentinel wrapper is part of the training contract. Do not add a long
instruction prefix unless you evaluate that variant separately.
Recommended generation settings:
Temperature: 0
Max new tokens: 64
Context length: 2048 or higher
Output parser: JSON array first, quoted-string fallback if needed
Postprocessing: lowercase, trim, deduplicate, canonicalize known variants,
remove generic filler tags, then cap to the desired count
Integration Pattern
mermaid
1flowchart LR
2 M["Saved memory text"]--> P["Same sentinel wrapper"]3 Q["Lookup query"]--> P
4 P --> T["Memory tagger"]5 T --> N["Deterministic tag normalization"]6 N --> O["Tag overlap score"]7 M --> E1["Memory embedding"]8 Q --> E2["Query embedding"]9 E1 --> V["Vector score"]10 E2 --> V
11 O --> R["Final memory ranking"]12 V --> R
The tagger should not be the only retrieval signal. Tag overlap is best used as
a cheap lexical signal alongside embeddings. If tag extraction fails or times
out, continue with embedding-only retrieval.
Good Fits
Personal or team assistant memory.
Retrieval tags for short notes, facts, preferences, tasks, and runbook hints.
Cheap lexical prefiltering before vector ranking.
Existing memory stores that can be retagged with the same model used at query
time.
Poor Fits
General named-entity recognition.
Open-ended taxonomy design.
Prompt-injection detection.
Deciding whether a memory should be saved.
Replacing embedding search entirely.
Full-document understanding.
Artifacts
This adapter targets:
unsloth/gemma-3-270m-it
For CPU serving, merge the LoRA adapter into the base model and quantize the
merged model to GGUF. The evaluated CPU artifact for this version is:
gemma3-270m-memory-tags-v4-sentinel-q8_0.gguf
It is suitable for llama.cpp / llama-server style serving with a small
request timeout and an embedding-only fallback in the caller.
Training
Base model: unsloth/gemma-3-270m-it
Adapter type: LoRA
Prompt style: sentinel wrapper
Split source: data/splits_durable_v3_focused
Training rows: 10,762
Procedure: continued from the durable v3 adapter
Augmentation: one adversarial wrapped copy per training row
Epochs: 1
Training option: length-grouped batches
The training target is not a universal taxonomy. The target is consistency:
given similar saved text and lookup text, the model should emit overlapping tags
that help retrieve the same memory.
Evaluation Snapshot
Direct tag evaluation:
Split
F1
Precision
Recall
Exact Match
Avg Predicted Tags
Eval
48.6%
72.1%
37.9%
0.4%
4.82
Test
49.1%
73.8%
38.7%
1.2%
4.61
Compared with the previous durable adapter, this version improved direct tag F1
by +1.8pp on eval and +0.9pp on test.
Retrieval simulation on a fresh stored-memory corpus:
Query Tags
Stored Tags
Any Overlap
Top 1
Top 3
Top 5
v4
v4 retagged
95.3%
86.1%
96.1%
97.5%
v4
existing v3 tags
94.2%
86.1%
96.1%
97.0%
The fresh stored-memory corpus had 213 memories across 67 users, with an
average of 6.6 tags per memory. Results were similar with existing v3 tags and
with v4-retagged memories, which means this version is compatible with the
current tag dialect while still being a good candidate for full retagging.
Adversarial wrapper smoke test:
Model
F1
Precision
Recall
Avg Predicted Tags
Generic Junk Count
v3 unified
44.7%
67.1%
35.4%
4.73
0
v4 sentinel
46.3%
64.6%
37.4%
5.05
0
The sentinel format reduces dependence on a long runtime prompt, but the caller
should still parse and normalize tags deterministically.
Runtime Notes
Local GGUF smoke testing with llama.cpp showed warm responses around
80-140 ms on Apple M3 Max hardware for short inputs. Container and CPU host
latency depends on cold start, model load, and concurrency settings.
Keep the serving path simple:
Send only the sentinel wrapper and input text.
Use deterministic decoding.
Parse JSON.
Normalize tags.
Fall back to embedding-only retrieval on timeout or invalid output.
Limitations
The model is optimized for short memory entries and short lookup queries.
Very vague input can produce sparse tags. Sparse tags are usually better than
filler tags.
Crowded memory stores need ranking beyond flat tag overlap.
Existing corpora tagged by a different model should be evaluated in mixed mode
before retagging.
Multilingual input is supported by the base model, but each deployment should
validate its own language mix.