Text Generation
PEFT
Safetensors
GGUF
MLX
English
lora
gemma4
agent-memory
memory
structured-output
json
ollama
contradiction-detection
Eval Results (legacy)
conversational
Run this model with HF Jobs
Run sebs-clude/CludeMem-e4b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/sebs-clude/CludeMem-e4b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/sebs-clude/CludeMem-e4b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/sebs-clude/CludeMem-e4b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/sebs-clude/CludeMem-e4b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use sebs-clude/CludeMem-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use sebs-clude/CludeMem-e4b 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, "sebs-clude/CludeMem-e4b") - MLX
How to use sebs-clude/CludeMem-e4b with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("sebs-clude/CludeMem-e4b") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use sebs-clude/CludeMem-e4b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf sebs-clude/CludeMem-e4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf sebs-clude/CludeMem-e4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf sebs-clude/CludeMem-e4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf sebs-clude/CludeMem-e4b:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf sebs-clude/CludeMem-e4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf sebs-clude/CludeMem-e4b:Q4_K_M
Use Docker
docker model run hf.co/sebs-clude/CludeMem-e4b:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use sebs-clude/CludeMem-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sebs-clude/CludeMem-e4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sebs-clude/CludeMem-e4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sebs-clude/CludeMem-e4b:Q4_K_M
- Ollama
How to use sebs-clude/CludeMem-e4b with Ollama:
ollama run hf.co/sebs-clude/CludeMem-e4b:Q4_K_M
- Unsloth Desktop
- Pi
How to use sebs-clude/CludeMem-e4b with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sebs-clude/CludeMem-e4b"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "sebs-clude/CludeMem-e4b" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use sebs-clude/CludeMem-e4b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "sebs-clude/CludeMem-e4b"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "sebs-clude/CludeMem-e4b" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sebs-clude/CludeMem-e4b", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use sebs-clude/CludeMem-e4b with Docker Model Runner:
docker model run hf.co/sebs-clude/CludeMem-e4b:Q4_K_M
- Lemonade
How to use sebs-clude/CludeMem-e4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sebs-clude/CludeMem-e4b:Q4_K_M
Run and chat with the model
lemonade run user.CludeMem-e4b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use sebs-clude/CludeMem-e4b with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sebs-clude/CludeMem-e4b"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default sebs-clude/CludeMem-e4b
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use sebs-clude/CludeMem-e4b with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sebs-clude/CludeMem-e4b"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "sebs-clude/CludeMem-e4b" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
CludeMem-E4B v3: adapter, GGUF Q8_0/Q4_K_M, Modelfile, prompts, card
Browse filesFiles changed (10)
- .gitattributes+2
- LICENSEAdded+202
- NOTICEAdded+13
- README.md+314-1
- adapter_config.jsonAdded+173
- adapter_model.safetensorsAdded+3
- gguf/ModelfileAdded+37
- gguf/cludemem-e4b-v3.Q4_K_M.ggufAdded+3
- gguf/cludemem-e4b-v3.Q8_0.ggufAdded+3
- prompts.jsonAdded+443
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363732 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textgguf/cludemem-e4b-v3.Q8_0.gguf filter=lfs diff=lfs merge=lfs -textgguf/cludemem-e4b-v3.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.12345678910111213CludeMem-E4BCopyright 2026 Clude
This repository contains the CludeMem LoRA adapter, developed by Clude, and GGUFfiles in which that adapter is merged into Gemma 4 E4B.
Gemma 4 is developed by Google DeepMind and is distributed under the ApacheLicense, Version 2.0. Base model: google/gemma-4-e4b-it(https://huggingface.co/google/gemma-4-e4b-it). Gemma 4 license information:https://ai.google.dev/gemma/docs/gemma_4_license
The CludeMem adapter and the merged GGUF files are distributed under the ApacheLicense, Version 2.0. See the LICENSE file.123---license: mit---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316---base_model: google/gemma-4-e4b-itlibrary_name: peftlicense: apache-2.0language: [en]pipeline_tag: text-generationtags: [lora, peft, gemma4, agent-memory, memory, structured-output, json, gguf, ollama, mlx, contradiction-detection]model-index:- name: CludeMem-E4Bresults:- task: {type: text-generation, name: "Contradiction detection (RECONCILE)"}dataset: {type: dnli, name: "DNLI_gp (Dialogue NLI gate-passing test subset)", split: test}metrics:- {type: accuracy, name: "Strict 4-way accuracy", value: 74.0}- {type: precision, name: "Contradiction precision", value: 93.5}- task: {type: text-generation, name: "Contradiction detection (RECONCILE)"}dataset: {type: decode, name: "DECODE_gp (DECODE gate-passing test subset)", split: test}metrics:- {type: accuracy, name: "Strict 4-way accuracy", value: 77.3}- {type: precision, name: "Contradiction precision", value: 92.9}---# CludeMem-E4B**Structured memory operations for AI agents, on your own hardware.**CludeMem-E4B is a LoRA adapter for Gemma 4 E4B that gives an agent a working memory: nine operations, fromextracting and classifying memories to reconciling contradictions and answering from cited evidence. Eachoperation is trained to return one JSON object with a fixed schema, so replies can be validated and storeddirectly, and the merged GGUF builds run offline in Ollama, so the memories an agent keeps about its user neverhave to leave the device. RECONCILE, the operation that catches contradictions, is measured on two human-labelleddialogue benchmarks and on four runtimes; the other eight ship with reference pairs checked on every runtime.## At a glance- **Measured on human-labelled dialogue: 74.0% and 77.3% strict 4-way accuracy.** RECONCILE, thecontradiction-detection operation, scores **74.0%** (95% CI 70.7–77.0) on DNLI_gp and **77.3%** (74.0–80.2) onDECODE_gp, 1,450 human-labelled pairs in all. The majority class scores 33.3% and 50.0%, and thestrongest surface-cue baseline 36.4% and 54.1%.- **Contradiction flags you can act on: 93.5% and 92.9% precision.** On these label-balanced samples,93.5% (DNLI_gp) and 92.9% (DECODE_gp) of its contradiction flags are correct, and it flags only 2.6% and5.1% of the pairs that do not contradict. As a yes/no contradiction detector it is right on 89.7% and81.0% of the pairs, against 66.7% and 50.0% for the majority class. Precision depends on how commoncontradictions are in your data; the false-flag rate is the figure to carry over (*Usage notes*).- **When it misses, it keeps both memories.** It finds 74.4% and 67.1% of the gold contradictions;177 of the 179 it misses come back as `consistent`, so a missed contradiction leaves both memories in placerather than dropping one.- **Runs offline in Ollama on a 5.3 GB file, within 1.1 points of PyTorch.** On the same items, GGUF Q8_0 scores73.7 / 77.9, GGUF Q4_K_M 72.9 / 76.7 and MLX 74.1 / 77.9, each within 1.1 points ofPyTorch (74.0 / 77.3). PyTorch and MLX gave the same verdict on 1,440 of the 1,450 pairs. The Q4_K_M build is5.3 GB, the Q8_0 build 8.0 GB; both include the base model.- **JSON without a grammar: 5,798 of 5,800 replies parsed.** Across those four RECONCILE runs, under plain greedydecoding with no grammar or schema constraint, 5,798 of 5,800 replies parsed as a JSON object with all four keys,including all 1,450 from PyTorch. Of the parsed replies, 25 carried a verdict outside the four labels; they andthe 2 that did not parse were scored as wrong and count against the accuracies above.- **No DNLI or DECODE data was used in training.** The adapter was trained on synthetic persona timelines andtested on human-written dialogue (*Training* has the overlap check).## The nine operationsEach call sends the operation's system prompt as the system message and the memory data as the user message,rendered with the Gemma 4 chat template and decoded greedily. Pass `enable_thinking=True`: it only adds the`<|think|>` line that opened the system turn in training. The model does not write a thinking block; it replieswith one JSON object. `prompts.json` documents each input format, the output keys and values, and a referenceinput/output pair.| Operation | What it does | System prompt (exact) ||---|---|---|| `CLASSIFY` | Types one memory as episodic or semantic and scores its importance and emotional valence, with tags and concepts. | `Classify the memory. Output JSON: {type, importance (0-1), tags[], concepts[], emotional_valence (-1..1)}.` || `EXTRACT` | Turns a dialogue into atomic memories, skipping lines that carry none (logs, tables, tool-call JSON, code). | `Extract atomic memories from the text. Output JSON: {memories:[{content, summary, type}]}.` || `ENTITIES` | Extracts people, locations, organizations and projects, with aliases and relations such as `lives_in`. | `Extract entities and relations. Output JSON: {entities:[{name,type,aliases}], relations:[{head,type,tail}]}.` || `TEMPORAL` | Dates a new event and links it as before or after the known events. | `Extract the event date and its temporal links to the known events. Output JSON: {event_date, precision, links:[{type,target}]}.` || `CONSOLIDATE` | Consolidates a set of memories into insights, each citing its evidence ids. | `Consolidate the memories into evidence-linked insights. Output JSON: {insights:[{content, evidence[]}]}.` || `COMPACT` | Compacts old memories into one summary that preserves the entities and the date range. | `Compact the old memories into one summary, preserving entities and the date range. Output JSON: {summary, preserved_entities[], date_range:{start,end}}.` || `RECONCILE` | Decides whether two memories are consistent, contradict, duplicate, or one supersedes the other; names the weaker one. | `Decide how the two memories relate. Output JSON: {verdict, resolution, weaker_id, confidence}.` || `QUERY` | Expands a question into search queries, entities, time constraints and an intent. | `Understand the query. Output JSON: {expanded_queries[], temporal_constraints, type_filters[], entities[], intent}.` || `ANSWER` | Answers only from the supplied memories, cites them, and abstains when they do not support an answer. | `Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}.` |## Quick startAll three examples send the ANSWER prompt with a test item from `prompts.json`.### Ollama (offline)```bashhf download sebs-clude/CludeMem-e4b gguf/cludemem-e4b-v3.Q4_K_M.gguf gguf/Modelfile --local-dir cludemem-v3cd cludemem-v3/ggufollama create cludemem-e4b-v3 -f Modelfile # the Modelfile's FROM line names cludemem-e4b-v3.Q4_K_M.ggufcurl -s http://localhost:11434/api/chat -d '{"model": "cludemem-e4b-v3", "stream": false, "options": {"temperature": 0},"messages": [{"role": "system", "content": "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}."},{"role": "user", "content": "Question: Where does Maya live now?\n\nMemories:\n[f2] Maya moved to Austin on 2026-10-22.\n[f1] Maya lives in Lisbon.\n[f3] Maya currently resides in Austin."}]}'```Leave `think` unset: the prompt then matches the training prompt token for token, while `"think": false` dropsthe `<|think|>` line. Recorded `message.content`, parsed (Q4_K_M, Ollama 0.34.2): `{"rationale": "Supported by f2.", "answer": "Austin", "citations": ["f2"], "confidence": 0.9, "abstain": false}`### Transformers + PEFT```pythonimport json, torchfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom peft import PeftModelBASE = "google/gemma-4-e4b-it" # full precision (bf16), not 4-bit; "unsloth/gemma-4-E4B-it" has the same weightstok = AutoTokenizer.from_pretrained(BASE)model = AutoModelForCausalLM.from_pretrained(BASE, dtype=torch.bfloat16, device_map="auto")model = PeftModel.from_pretrained(model, "sebs-clude/CludeMem-e4b").eval()def run(system, user, max_new_tokens=512):messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]inputs = tok.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True,return_tensors="pt", return_dict=True).to(model.device)out = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False)return json.loads(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))SYSTEM = "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}."USER = "Question: Where does Maya live now?\n\nMemories:\n[f2] Maya moved to Austin on 2026-10-22.\n[f1] Maya lives in Lisbon.\n[f3] Maya currently resides in Austin."print(run(SYSTEM, USER))```### MLX (Apple silicon; converts the PEFT adapter to mlx-lm's layout on the fly)```pythonimport jsonfrom pathlib import Pathimport mlx.core as mxfrom huggingface_hub import snapshot_downloadfrom mlx_lm import generatefrom mlx_lm.utils import load_adapters, load_model, load_tokenizerbase = Path(snapshot_download("google/gemma-4-e4b-it"))peft = Path(snapshot_download("sebs-clude/CludeMem-e4b", allow_patterns=["adapter_*"]))# convert the PEFT adapter to mlx-lm's layout: lora_a = A.T, lora_b = B.T, scale = lora_alpha / rcfg = json.loads((peft / "adapter_config.json").read_text())adapter = Path("cludemem-e4b-mlx")adapter.mkdir(exist_ok=True)weights = mx.load(str(peft / "adapter_model.safetensors"))mx.save_safetensors(str(adapter / "adapters.safetensors"), {k.replace("base_model.model.model.language_model.", "language_model.model.").replace(".lora_A.weight", ".lora_a").replace(".lora_B.weight", ".lora_b"): v.T for k, v in weights.items()})lora = {"keys": ["mlp.gate_proj", "mlp.up_proj", "mlp.down_proj"], "rank": cfg["r"],"scale": cfg["lora_alpha"] / cfg["r"], "dropout": 0.0}(adapter / "adapter_config.json").write_text(json.dumps({"fine_tune_type": "lora", "num_layers": 42, "lora_parameters": lora}))model, _ = load_model(base, strict=False) # mlx-lm does not use the base's 54 KV-shared-layer tensorsmodel = load_adapters(model, str(adapter)).eval()eos = json.loads((base / "generation_config.json").read_text())["eos_token_id"]tok = load_tokenizer(base, eos_token_ids=eos if isinstance(eos, list) else [eos])def run(system, user, max_tokens=512):messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]prompt = tok.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True, tokenize=False)return json.loads(generate(model, tok, prompt=prompt, max_tokens=max_tokens)) # greedy by defaultSYSTEM = "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}."USER = "Question: Where does Maya live now?\n\nMemories:\n[f2] Maya moved to Austin on 2026-10-22.\n[f1] Maya lives in Lisbon.\n[f3] Maya currently resides in Austin."print(run(SYSTEM, USER))```Both scripts printed `{'rationale': 'Supported by f2.', 'answer': 'Austin', 'citations': ['f2'], 'confidence': 0.9, 'abstain': False}` when run on the files in this repo.The adapter the MLX script writes has the same 252 tensors, bit for bit, as the adapter behind the MLXresults in *Evaluation*; `strict=False` is there because mlx-lm does not use the base's 54 KV-shared-layertensors.**Checked as printed.** The code above was run on the files in this repo for all 10 examples in `prompts.json`(one per operation, plus an answerable ANSWER item) with Transformers 5.15.1, PEFT 0.20.0 and PyTorch2.14.0 on Apple MPS, mlx-lm 0.31.3 and Ollama 0.34.2. Every reply was a JSON object with theoperation's output keys. Exact matches with the reference outputs: Transformers 10/10, MLX 10/10, Ollama Q8_0 10/10, Ollama Q4_K_M 9/10; theQ4_K_M difference is in RECONCILE (see *Usage notes*). This checks that the code and files work as printed;accuracy is measured in *Evaluation*.## EvaluationRECONCILE is scored on two public, human-labelled benchmarks; the other eight operations ship with referencepairs checked on every runtime:| Operation | Evidence in this release ||---|---|| `RECONCILE` | DNLI_gp and DECODE_gp: 1,450 human-labelled pairs, scored on four runtimes (below). They cover `consistent`, `contradicts` and `duplicate`; `supersedes` needs time-ordered pairs, which these datasets do not have. || `CLASSIFY`, `EXTRACT`, `ENTITIES`, `TEMPORAL`, `CONSOLIDATE`, `COMPACT`, `QUERY`, `ANSWER` | The reference input/output pairs in `prompts.json` (for ANSWER, one abstaining and one answerable item), matched exactly on all four runtimes (*Quick start*). No public benchmark in this release; check them on a sample of your own data before relying on them. |### Contradiction detection: DNLI_gp and DECODE_gpDialogue NLI (Welleck et al. 2019) and DECODE (Nie et al. 2021) are human-labelled statement pairs from personadialogues; each pair is sent to RECONCILE as Memory A and Memory B. DNLI's entailment, neutral and contradictionlabels map to `duplicate`, `consistent` and `contradicts`. A DECODE contradiction pairs the turn that annotatorsmarked with the final turn; a DECODE non-contradiction pairs an earlier turn by the same speaker with a finalturn that annotators verified contradicts nothing before it, and its gold verdict is `consistent`. Only theverdict is scored.The `_gp` sets are gate-passing subsets of the test splits, filtered until lexical rules and a bag-of-wordsclassifier score near chance, so word overlap does not solve them. The baseline rows below confirm that filter:they are a check on the test, not competitors. Because of the filter, these scores are not comparable withpublished results on the full test sets.Label-balanced samples (seed 20260821): DNLI_gp 750 of 2,622 items (250 per label), DECODE_gp 700 of 1,454 (350 perlabel). They were not used in training. Strict 4-way accuracy counts a reply as right only when its verdict, oneof four, equals the gold label; replies that do not parse or whose verdict is not one of the four labels count as wrong (27 of the 5,800 across thefour runs). DNLI gold uses three verdicts and DECODE two; these pairs carry no time order, so `supersedes` alwayscounts as wrong. A flag is a `contradicts` or `supersedes` verdict; brackets are 95% Wilson intervals. PyTorch ranon `unsloth/gemma-4-E4B-it` in 16-bit, whose `model.safetensors` has the same SHA-256 as `google/gemma-4-e4b-it`'s(`cfbd3d2f1cd71bd4…`), MLX on `google/gemma-4-e4b-it`, and the GGUF rows are the files in this repo served by Ollama,checked to be the same items by item id and prompt.| System (same items, same harness) | DNLI_gp, n = 750 | DECODE_gp, n = 700 | Flag precision | Flag recall ||---|---:|---:|---:|---:|| **CludeMem-E4B**, PyTorch, 16-bit base | **74.0** [70.7, 77.0] | **77.3** [74.0, 80.2] | 93.5 / 92.9 | 74.4 / 67.1 || CludeMem-E4B, MLX, full-precision base | 74.1 [70.9, 77.1] | 77.9 [74.6, 80.8] | 93.5 / 94.0 | 74.8 / 66.9 || CludeMem-E4B, GGUF Q8_0 (Ollama) | 73.7 [70.5, 76.8] | 77.9 [74.6, 80.8] | 93.5 / 93.3 | 74.4 / 67.4 || CludeMem-E4B, GGUF Q4_K_M (Ollama) | 72.9 [69.6, 76.0] | 76.7 [73.4, 79.7] | 94.0 / 92.8 | 75.6 / 66.0 || Majority class | 33.3 | 50.0 | n/a | n/a || Bag-of-words logistic regression (strongest surface-cue baseline) | 36.4 | 54.1 | n/a | n/a |Other systems appear in this table only when they were scored on these same items with this harness.**Where the errors go (PyTorch).** The model answers `consistent` on 97.2% of the DNLI_gp and 88.3% of theDECODE_gp pairs whose gold verdict is `consistent`, and when it misses a gold contradiction it nearly always says`consistent` (177 of 179 misses). Its high precision and its lower recall are two sides of one conservativeoperating point: on both datasets it raised fewer flags (199 and 253) than there are gold contradictions(250 and 350), and most of the flags it raised were right. On DNLI_gp `duplicate` pairs it is right on 50.4%, and115 of the 124 it misses come back as `consistent`. A DNLI entailment pair is two sentences annotated with thesame fact, and in 164 of the 250 sampled pairs one side is a dialogue turn that carries that fact alongside othercontent, so `duplicate` is the loosest of the three label mappings. By annotator agreement: on the 602DNLI_gp pairs whose three annotations agreed on the label, strict accuracy is 78.6%; on the 148 with asplit vote, 55.4%.## Usage notesPractical tips for getting the most out of the model:- **Let code do the arithmetic.** ANSWER answers from the memories it cites. Compute sums, counts and datedifferences in code from those cited memories rather than asking the model to work them out.- **RECONCILE on Q4_K_M: treat an empty `weaker_id` as `null`, or use Q8_0.** In the 10-example check, Q4_K_M'sRECONCILE reply had the right verdict but an empty-string `weaker_id` and a different `resolution` sentence;Q8_0 matched the reference exactly.- **English in, JSON out.** Send English, single-turn calls; expect one JSON object per reply. Validate eachreply against the output keys in `prompts.json` and retry on a miss.- **Plan for the contradiction rate of your own data.** The 93.5% and 92.9% precision above come fromlabel-balanced samples; the false-flag rate is the figure to carry over. With 2.6% and 5.1% of non-contradictingpairs flagged, a store where contradictions are rare will see a larger share of false flags among what itflags, so confirm `contradicts` verdicts on important memories before overwriting anything.- **Decide on verdicts, not scores.** `confidence` and `importance` take a few fixed values in the trainingtargets (ANSWER's `confidence` target is 0.9 for an answer and 0.8 for an abstention). Treat them as coarselabels and base decisions on `verdict` and `abstain`.- **Batch large memory sets.** Training sequences, prompt plus reply, were at most 2,816 tokens. Send largermemory sets to CONSOLIDATE, COMPACT and ANSWER in batches that fit.- **Reference dates.** QUERY and TEMPORAL inputs begin with `Today is YYYY-MM-DD.`; nearly all of their traininginputs used `Today is 2026-06-01.`, so check date handling with your own dates.- **Full-precision base.** Load the adapter on the bf16 base, not a 4-bit one; the base's `model.safetensors` is16.0 GB. The GGUF builds already include the base: 8.0 GB (Q8_0) and 5.3 GB (Q4_K_M).## Training- **Method:** QLoRA on a 4-bit (NF4) copy of Gemma 4 E4B with bf16 compute; the adapter runs on the full-precision model.- **Adapter:** rank 16, alpha 32 (scale 2.0), dropout 0.05, on the MLP projections (`gate_proj`,`up_proj`, `down_proj`) of all 42 decoder layers; attention is untouched. 25,804,800 trainable parameters.- **Optimisation:** AdamW (8-bit), learning rate 1e-4, cosine decay, weight decay 0, bf16, batch 4 withgradient accumulation 4, sequences up to 2,816 tokens, loss on the assistant reply only.- **Data:** synthetic persona timelines with planted facts, changes, contradictions and duplicates; the examplesfor all nine operations are derived from each timeline's ground truth. A second seeded generator builds RECONCILEpairs from hidden facts (same or different subject, attribute, value, time span) and derives each verdict from them.- **No DNLI or DECODE data was used in training.** A text-overlap check found none of the 2,765 DNLI_gpmemory texts in any training message, and one of the 2,879 DECODE_gp memory texts, a phrase of 1-3 tokens(these texts are model inputs, not labels).- **Software:** PEFT 0.20.0, TRL 0.24.0, Transformers 5.5.0, Unsloth 2026.9.4, PyTorch 2.12.1.## Files| File | Size | Contents ||---|---:|---|| `adapter_model.safetensors` | 103.3 MB | LoRA weights (PEFT) || `adapter_config.json` | 7.6 KB | PEFT config; base `google/gemma-4-e4b-it` || `prompts.json` | 15.5 KB | system prompts, input formats, output keys and values, one example per operation || `gguf/cludemem-e4b-v3.Q8_0.gguf` | 8.03 GB | adapter merged into the base, 8-bit, text weights; preferred for RECONCILE || `gguf/cludemem-e4b-v3.Q4_K_M.gguf` | 5.34 GB | adapter merged into the base, 4-bit, text weights || `gguf/Modelfile` | 1.6 KB | Ollama template and parameters (FROM names the Q4_K_M file) || `LICENSE` | 11.4 KB | Apache License 2.0 || `NOTICE` | 0.6 KB | attribution |SHA-256 checksums. After `hf download sebs-clude/CludeMem-e4b --local-dir <dir>`, save these lines as `SHA256SUMS` in `<dir>`and run `shasum -a 256 -c SHA256SUMS` there:```text4a3e16637e7e24a15eb5e2fc6392009e595b8218776971a353647d5d920d27f8 adapter_model.safetensors12fa78677f246fd57967fcb30fb482312113d15294fd8b77c49fec9062a9f842 adapter_config.json53abc92c14ce9fda2f517818adcaade7202626ad88b8dcb32174faa7fa1c6070 prompts.json9bc6dbe4adb0b49aa59ac93db7ffc14fe81b0c5b802d4083e51591127e3d26c1 gguf/cludemem-e4b-v3.Q8_0.gguf16d63338794b58bb0a62d7ff410ceaf33754dcb419de672506f643d59439dee2 gguf/cludemem-e4b-v3.Q4_K_M.gguf221ef8867d32d2a768c1297f0760209a30de527c9f61d25f123e9a67f1807b5a gguf/Modelfilecfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE3ec43cb8576fed652d4ec1d590eeddf452438dccb7656ac82755bcb68dc5fb16 NOTICE```## License and attributionCludeMem-E4B (the adapter and the merged GGUF builds) is released under the Apache License 2.0 (`LICENSE`). It isbuilt on Gemma 4 E4B by Google DeepMind ([`google/gemma-4-e4b-it`](https://huggingface.co/google/gemma-4-e4b-it)), whose Hugging Face repository listed itslicense as `apache-2.0` on 2026-09-22 (revision `ee0ef602…`) and links the [Gemma 4 license page](https://ai.google.dev/gemma/docs/gemma_4_license); check therepository for the current terms. See `NOTICE`. Evaluation data: Dialogue NLI (Welleck et al. 2019) and DECODE (Nie et al. 2021).## Citation```bibtex@misc{cludemem_e4b,title = {CludeMem-E4B: structured agent-memory operations on Gemma 4 E4B},author = {Clude},year = {2026},howpublished = {\url{https://huggingface.co/sebs-clude/CludeMem-e4b}}}```
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4", "unsloth_fixed": true }, "base_model_name_or_path": "google/gemma-4-e4b-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 32, "lora_bias": false, "lora_dropout": 0.05, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.20.0", "qalora_group_size": 16, "r": 16, "rank_pattern": {}, "revision": null, "target_modules": [ "model.language_model.layers.9.mlp.gate_proj", "model.language_model.layers.13.mlp.up_proj", "model.language_model.layers.41.mlp.up_proj", "model.language_model.layers.34.mlp.down_proj", "model.language_model.layers.20.mlp.down_proj", "model.language_model.layers.23.mlp.down_proj", "model.language_model.layers.35.mlp.up_proj", "model.language_model.layers.3.mlp.gate_proj", "model.language_model.layers.2.mlp.up_proj", "model.language_model.layers.22.mlp.down_proj", "model.language_model.layers.29.mlp.gate_proj", "model.language_model.layers.5.mlp.down_proj", "model.language_model.layers.1.mlp.down_proj", "model.language_model.layers.36.mlp.down_proj", "model.language_model.layers.40.mlp.gate_proj", "model.language_model.layers.33.mlp.gate_proj", "model.language_model.layers.38.mlp.gate_proj", "model.language_model.layers.12.mlp.down_proj", "model.language_model.layers.14.mlp.up_proj", "model.language_model.layers.27.mlp.down_proj", "model.language_model.layers.3.mlp.up_proj", "model.language_model.layers.40.mlp.up_proj", "model.language_model.layers.41.mlp.gate_proj", "model.language_model.layers.7.mlp.gate_proj", "model.language_model.layers.30.mlp.up_proj", "model.language_model.layers.32.mlp.up_proj", "model.language_model.layers.0.mlp.up_proj", "model.language_model.layers.8.mlp.gate_proj", "model.language_model.layers.4.mlp.down_proj", "model.language_model.layers.21.mlp.gate_proj", "model.language_model.layers.23.mlp.up_proj", "model.language_model.layers.16.mlp.down_proj", "model.language_model.layers.21.mlp.up_proj", "model.language_model.layers.3.mlp.down_proj", "model.language_model.layers.24.mlp.up_proj", "model.language_model.layers.7.mlp.up_proj", "model.language_model.layers.26.mlp.down_proj", "model.language_model.layers.9.mlp.down_proj", "model.language_model.layers.30.mlp.down_proj", "model.language_model.layers.19.mlp.up_proj", "model.language_model.layers.6.mlp.up_proj", "model.language_model.layers.17.mlp.up_proj", "model.language_model.layers.37.mlp.up_proj", "model.language_model.layers.18.mlp.down_proj", "model.language_model.layers.38.mlp.up_proj", "model.language_model.layers.29.mlp.up_proj", "model.language_model.layers.25.mlp.up_proj", "model.language_model.layers.2.mlp.down_proj", "model.language_model.layers.30.mlp.gate_proj", "model.language_model.layers.31.mlp.down_proj", "model.language_model.layers.10.mlp.gate_proj", "model.language_model.layers.5.mlp.gate_proj", "model.language_model.layers.8.mlp.down_proj", "model.language_model.layers.11.mlp.down_proj", "model.language_model.layers.19.mlp.down_proj", "model.language_model.layers.18.mlp.up_proj", "model.language_model.layers.17.mlp.down_proj", "model.language_model.layers.32.mlp.gate_proj", "model.language_model.layers.29.mlp.down_proj", "model.language_model.layers.37.mlp.down_proj", "model.language_model.layers.20.mlp.up_proj", "model.language_model.layers.14.mlp.gate_proj", "model.language_model.layers.12.mlp.gate_proj", "model.language_model.layers.15.mlp.down_proj", "model.language_model.layers.27.mlp.up_proj", "model.language_model.layers.15.mlp.up_proj", "model.language_model.layers.26.mlp.up_proj", "model.language_model.layers.41.mlp.down_proj", "model.language_model.layers.7.mlp.down_proj", "model.language_model.layers.14.mlp.down_proj", "model.language_model.layers.21.mlp.down_proj", "model.language_model.layers.0.mlp.down_proj", "model.language_model.layers.2.mlp.gate_proj", "model.language_model.layers.15.mlp.gate_proj", "model.language_model.layers.23.mlp.gate_proj", "model.language_model.layers.1.mlp.up_proj", "model.language_model.layers.22.mlp.gate_proj", "model.language_model.layers.40.mlp.down_proj", "model.language_model.layers.16.mlp.up_proj", "model.language_model.layers.28.mlp.up_proj", "model.language_model.layers.28.mlp.gate_proj", "model.language_model.layers.39.mlp.up_proj", "model.language_model.layers.34.mlp.up_proj", "model.language_model.layers.18.mlp.gate_proj", "model.language_model.layers.12.mlp.up_proj", "model.language_model.layers.5.mlp.up_proj", "model.language_model.layers.36.mlp.up_proj", "model.language_model.layers.37.mlp.gate_proj", "model.language_model.layers.35.mlp.down_proj", "model.language_model.layers.22.mlp.up_proj", "model.language_model.layers.36.mlp.gate_proj", "model.language_model.layers.24.mlp.down_proj", "model.language_model.layers.8.mlp.up_proj", "model.language_model.layers.35.mlp.gate_proj", "model.language_model.layers.11.mlp.gate_proj", "model.language_model.layers.24.mlp.gate_proj", "model.language_model.layers.6.mlp.down_proj", "model.language_model.layers.4.mlp.up_proj", "model.language_model.layers.31.mlp.up_proj", "model.language_model.layers.19.mlp.gate_proj", "model.language_model.layers.33.mlp.down_proj", "model.language_model.layers.33.mlp.up_proj", "model.language_model.layers.1.mlp.gate_proj", "model.language_model.layers.27.mlp.gate_proj", "model.language_model.layers.38.mlp.down_proj", "model.language_model.layers.17.mlp.gate_proj", "model.language_model.layers.13.mlp.gate_proj", "model.language_model.layers.11.mlp.up_proj", "model.language_model.layers.25.mlp.down_proj", "model.language_model.layers.10.mlp.down_proj", "model.language_model.layers.31.mlp.gate_proj", "model.language_model.layers.39.mlp.down_proj", "model.language_model.layers.16.mlp.gate_proj", "model.language_model.layers.20.mlp.gate_proj", "model.language_model.layers.26.mlp.gate_proj", "model.language_model.layers.32.mlp.down_proj", "model.language_model.layers.0.mlp.gate_proj", "model.language_model.layers.9.mlp.up_proj", "model.language_model.layers.28.mlp.down_proj", "model.language_model.layers.34.mlp.gate_proj", "model.language_model.layers.4.mlp.gate_proj", "model.language_model.layers.13.mlp.down_proj", "model.language_model.layers.6.mlp.gate_proj", "model.language_model.layers.10.mlp.up_proj", "model.language_model.layers.25.mlp.gate_proj", "model.language_model.layers.39.mlp.gate_proj" ], "target_parameters": null, "task_type": "CAUSAL_LM", "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:4a3e16637e7e24a15eb5e2fc6392009e595b8218776971a353647d5d920d27f8size 10325613612345678910111213141516171819202122232425262728293031323334353637# CludeMem-E4B for Ollama: the CludeMem adapter merged into google/gemma-4-e4b-it (text weights only).## ollama create cludemem-e4b-v3 -f Modelfile## FROM expects the GGUF next to this file. For the 8-bit build (preferred for RECONCILE), change it to# ./cludemem-e4b-v3.Q8_0.gguf.## The template renders the prompt the adapter was trained with, i.e. the Hugging Face tokenizer's# apply_chat_template([system, user], add_generation_prompt=True, enable_thinking=True):## <bos><|turn>system\n<|think|>\n{system}<turn|>\n<|turn>user\n{user}<turn|>\n<|turn>model\n## <bos> is not written here: the GGUF sets tokenizer.ggml.add_bos_token=true, so the runtime prepends it.# The <|think|> line is part of the training prompt; the model does not emit a thinking block, it replies# with one JSON object. No SYSTEM is baked in: each operation sends its own instruction as the system message.# The template covers the one-system, one-user shape every operation uses; send content without leading or# trailing whitespace.## Ollama 0.34: `ollama create` attaches its built-in gemma4 renderer and parser, and /api/chat renders with# them. Leave "think" unset: the prompt is then token-identical to the training prompt, while "think": false# drops the <|think|> line.FROM ./cludemem-e4b-v3.Q4_K_M.gguf
TEMPLATE """<|turn>system<|think|>{{ .System }}<turn|>{{- range .Messages }}{{- if ne .Role "system" }}<|turn>{{ if eq .Role "assistant" }}model{{ else }}{{ .Role }}{{ end }}{{ .Content }}<turn|>{{- end }}{{- end }}<|turn>model"""
PARAMETER temperature 0PARAMETER stop "<turn|>"PARAMETER stop "<eos>"PARAMETER num_ctx 8192123version https://git-lfs.github.com/spec/v1oid sha256:16d63338794b58bb0a62d7ff410ceaf33754dcb419de672506f643d59439dee2size 5335291936123version https://git-lfs.github.com/spec/v1oid sha256:9bc6dbe4adb0b49aa59ac93db7ffc14fe81b0c5b802d4083e51591127e3d26c1size 8031242272123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443{ "model": "CludeMem-E4B", "about": "One entry per memory operation. Send the task's system_prompt as the system message and the input, formatted as user_format describes, as the user message; the reply is one JSON object with output_keys. output_values lists the values those fields take in the training targets. The examples are test items whose inputs do not occur in the training data; example.output is the reference reply.", "chat_template": { "apply_chat_template_kwargs": { "add_generation_prompt": true, "enable_thinking": true }, "rendered_form": "<bos><|turn>system\n<|think|>\n{system}<turn|>\n<|turn>user\n{user}<turn|>\n<|turn>model\n", "note": "enable_thinking=True reproduces the training prompt: a '<|think|>' line opens the system turn. The model does not emit a thinking block; it replies with one JSON object. transformers' apply_chat_template omits the line unless enable_thinking=True is passed.", "tokenizers_checked": [ "google/gemma-4-e4b-it", "unsloth/gemma-4-E4B-it" ] }, "decoding": "greedy (temperature 0)", "tasks": { "CLASSIFY": { "system_prompt": "Classify the memory. Output JSON: {type, importance (0-1), tags[], concepts[], emotional_valence (-1..1)}.", "user_format": { "template": "{memory text}", "description": "One memory statement as free text on a single line." }, "output_keys": [ "type", "importance", "tags", "concepts", "emotional_valence" ], "output_values": { "type": [ "episodic", "semantic" ], "importance": [ 0.3, 0.4, 0.8, 0.6, 0.5, 0.85, 0.9 ], "emotional_valence": [ 0.2, 0, -0.3, 0.3, 0.5, -0.4 ] }, "example": { "system": "Classify the memory. Output JSON: {type, importance (0-1), tags[], concepts[], emotional_valence (-1..1)}.", "user": "By the way, around then on 2026-02-16, Priya spent the afternoon reviewing the Polaris roadmap, triaged the mobile backlog, and noted follow-ups for the data sync. It came up while we were chatting.", "output": { "type": "episodic", "importance": 0.3, "tags": [ "event", "task", "priya" ], "concepts": [ "event", "task" ], "emotional_valence": 0.2 } } }, "EXTRACT": { "system_prompt": "Extract atomic memories from the text. Output JSON: {memories:[{content, summary, type}]}.", "user_format": { "template": "{Speaker}: {utterance}\\n{Speaker}: {utterance}\\n...", "description": "A dialogue block, one 'Name: utterance' line per turn. Some rows mix in non-dialogue lines (log lines, markdown tables, tool-call JSON, code fences) that carry no memory." }, "output_keys": [ "memories" ], "output_values": { "memories[].type": [ "episodic", "semantic" ] }, "example": { "system": "Extract atomic memories from the text. Output JSON: {memories:[{content, summary, type}]}.", "user": "Tomas: Actually, scratch what I said before — tomas now prefers matcha, having switched from cola.\nTomas: By the way, around then tomas started a new job at Brightwell on 2026-07-18. It came up while we were chatting.\n{\"tool\":\"search\",\"status\":\"ok\",\"hits\":1}", "output": { "memories": [ { "content": "Tomas now prefers matcha, having switched from cola.", "summary": "Tomas now prefers matcha, having switched from cola.", "type": "semantic" }, { "content": "Tomas started a new job at Brightwell on 2026-07-18.", "summary": "Tomas started a new job at Brightwell on 2026-07-18.", "type": "episodic" } ] } } }, "ENTITIES": { "system_prompt": "Extract entities and relations. Output JSON: {entities:[{name,type,aliases}], relations:[{head,type,tail}]}.", "user_format": { "template": "{memory text}", "description": "One memory statement as free text on a single line." }, "output_keys": [ "entities", "relations" ], "output_values": { "entities[].type": [ "person", "location", "organization", "project" ], "relations[].type": [ "lives_in", "works_at", "leads" ] }, "example": { "system": "Extract entities and relations. Output JSON: {entities:[{name,type,aliases}], relations:[{head,type,tail}]}.", "user": "Actually, scratch what I said before — on 2026-05-02, Theo spent the afternoon reviewing the Beacon roadmap, triaged the mobile backlog, and noted follow-ups for the product sync.", "output": { "entities": [ { "name": "Theo", "type": "person", "aliases": [] } ], "relations": [] } } }, "TEMPORAL": { "system_prompt": "Extract the event date and its temporal links to the known events. Output JSON: {event_date, precision, links:[{type,target}]}.", "user_format": { "template": "Today is {YYYY-MM-DD}.\\nNew event [fN]: {text}\\nKnown events:\\n[fN] {text} ({YYYY-MM-DD})\\n...", "description": "Reference date, the new event with its id, then the known events, each followed by its date in parentheses. A few rows have no known events (the 'Known events:' block is absent)." }, "output_keys": [ "event_date", "precision", "links" ], "output_values": { "precision": [ "day" ], "links[].type": [ "happens_before", "happens_after" ] }, "example": { "system": "Extract the event date and its temporal links to the known events. Output JSON: {event_date, precision, links:[{type,target}]}.", "user": "Today is 2026-06-01.\nNew event [f57]: I think on 2026-03-19, Nina spent the afternoon reviewing the Quartz roadmap, triaged the mobile backlog, and noted follow-ups for the data sync. At least that's my sense of it.\nKnown events:\n[f25] On 2026-03-01, Nina spent the afternoon reviewing the Beacon roadmap, triaged the infra backlog, and noted follow-ups for the data sync. (2026-03-01)\n[f41] On 2026-03-01, Nina spent the afternoon reviewing the Quartz roadmap, triaged the growth backlog, and noted follow-ups for the data sync. (2026-03-01)\n[f23] On 2026-03-10, Nina spent the afternoon reviewing the Sable roadmap, triaged the growth backlog, and noted follow-ups for the design sync. (2026-03-10)\n[f22] On 2026-03-24, Nina spent the afternoon reviewing the Quartz roadmap, triaged the mobile backlog, and noted follow-ups for the platform sync. (2026-03-24)\n[f14] On 2026-04-04, Nina spent the afternoon reviewing the Beacon roadmap, triaged the mobile backlog, and noted follow-ups for the ops sync. (2026-04-04)\n[f34] On 2026-04-06, Nina spent the afternoon reviewing the Echo roadmap, triaged the infra backlog, and noted follow-ups for the design sync. (2026-04-06)", "output": { "event_date": "2026-03-19", "precision": "day", "links": [ { "type": "happens_after", "target": "f25" }, { "type": "happens_after", "target": "f41" }, { "type": "happens_after", "target": "f23" }, { "type": "happens_before", "target": "f22" }, { "type": "happens_before", "target": "f14" }, { "type": "happens_before", "target": "f34" } ] } } }, "CONSOLIDATE": { "system_prompt": "Consolidate the memories into evidence-linked insights. Output JSON: {insights:[{content, evidence[]}]}.", "user_format": { "template": "[fN] {memory}\\n[fN] {memory}\\n...", "description": "One memory per line, each prefixed with its id." }, "output_keys": [ "insights" ], "output_values": {}, "example": { "system": "Consolidate the memories into evidence-linked insights. Output JSON: {insights:[{content, evidence[]}]}.", "user": "[f1] Kai lives in Austin.\n[f2] Kai moved to Seoul on 2026-10-21.\n[f3] Kai currently resides in Seoul.\n[f4] Kai enjoys living in Seoul.\n[f5] Kai prefers cola over matcha.\n[f6] Kai now prefers matcha, having switched from cola.\n[f7] Kai started a new job at Aperture on 2026-08-16.\n[f8] Kai is allergic to gluten.", "output": { "insights": [ { "content": "Kai lives in Austin.", "evidence": [ "f1" ] }, { "content": "Kai currently resides in Seoul.", "evidence": [ "f3" ] }, { "content": "Kai enjoys living in Seoul.", "evidence": [ "f4" ] }, { "content": "Kai prefers cola over matcha.", "evidence": [ "f5" ] }, { "content": "Kai now prefers matcha, having switched from cola.", "evidence": [ "f6" ] }, { "content": "Kai is allergic to gluten.", "evidence": [ "f8" ] } ] } } }, "COMPACT": { "system_prompt": "Compact the old memories into one summary, preserving entities and the date range. Output JSON: {summary, preserved_entities[], date_range:{start,end}}.", "user_format": { "template": "[fN] {memory}\\n[fN] {memory}\\n...", "description": "One old memory per line, each prefixed with its id." }, "output_keys": [ "summary", "preserved_entities", "date_range" ], "output_values": {}, "example": { "system": "Compact the old memories into one summary, preserving entities and the date range. Output JSON: {summary, preserved_entities[], date_range:{start,end}}.", "user": "[f2] Aisha moved to Lisbon on 2026-03-18.\n[f7] Aisha started a new job at Northstar on 2026-10-22.\n[f9] The Beacon project shipped on 2026-04-13.", "output": { "summary": "Aisha: 3 events covering Aisha, Lisbon, Northstar, Beacon.", "preserved_entities": [ "Aisha", "Lisbon", "Northstar", "Beacon" ], "date_range": { "start": "2026-03-18", "end": "2026-10-22" } } } }, "RECONCILE": { "system_prompt": "Decide how the two memories relate. Output JSON: {verdict, resolution, weaker_id, confidence}.", "user_format": { "template": "Memory A [fN]: {text}\\nMemory B [fN]: {text}", "description": "Exactly two lines, the two memories to compare with their ids. weaker_id in the output names one of these ids, or is null." }, "output_keys": [ "verdict", "resolution", "weaker_id", "confidence" ], "output_values": { "verdict": [ "contradicts", "supersedes", "duplicate", "consistent" ], "confidence": [ 0.9, 0.8, 0.75, 0.95, 0.85 ], "resolution": [ "Memory A and Memory B cannot be ordered; the conflict is unresolved.", "Memory B conflicts with Memory A; treat B as current.", "Memory B is the current truth; Memory A is outdated.", "Memory B restates Memory A; keep one.", "Memory A and Memory B agree; both are kept.", "Separate periods; both memories are kept.", "Different attributes; both memories are kept.", "Memory A is dated later than Memory B; treat Memory A as current.", "Memory B is dated later than Memory A; treat Memory B as current.", "Different people; both memories are kept.", "The memories overlap in time and cannot be ordered; the conflict is unresolved.", "Memory B restates Memory A with a coarser date; keep Memory A.", "Memory A is outdated; Memory B is the current truth.", "Memory A restates Memory B with a coarser date; keep Memory B.", "Memory B restates Memory A using another form of the same value; keep Memory A.", "Memory B is outdated; Memory A is the current truth.", "Memory A restates Memory B using another form of the same value; keep Memory B.", "Memory B names the same person as Memory A by a short form; keep Memory A.", "Memory A names the same person as Memory B by a short form; keep Memory B." ], "weaker_id": [ "one of the two input ids", "null" ] }, "example": { "system": "Decide how the two memories relate. Output JSON: {verdict, resolution, weaker_id, confidence}.", "user": "Memory A [f2]: Caleb moved to Toronto on 2026-03-06.\nMemory B [f4]: Caleb enjoys living in Toronto.", "output": { "verdict": "consistent", "resolution": "Memory A and Memory B agree; both are kept.", "weaker_id": null, "confidence": 0.9 } } }, "QUERY": { "system_prompt": "Understand the query. Output JSON: {expanded_queries[], temporal_constraints, type_filters[], entities[], intent}.", "user_format": { "template": "Today is {YYYY-MM-DD}.\\n{question}", "description": "Reference date on the first line, the user's question on the second." }, "output_keys": [ "expanded_queries", "temporal_constraints", "type_filters", "entities", "intent" ], "output_values": { "intent": [ "lookup", "temporal_lookup" ], "type_filters": [ [] ] }, "example": { "system": "Understand the query. Output JSON: {expanded_queries[], temporal_constraints, type_filters[], entities[], intent}.", "user": "Today is 2026-06-01.\nDid Zara move to Lyon on 2026-04-19?", "output": { "expanded_queries": [ "Did Zara move to Lyon on 2026-04-19?", "Did Zara move to Lyon on 2026-04-19" ], "temporal_constraints": { "after": null, "before": null }, "type_filters": [], "entities": [ "Zara", "Lyon" ], "intent": "temporal_lookup" } } }, "ANSWER": { "system_prompt": "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}.", "user_format": { "template": "Question: {question}\\n\\nMemories:\\n[fN] {memory}\\n[fN] {memory}\\n...", "description": "The question, a blank line, 'Memories:', then one retrieved memory per line with its id. citations in the output are ids from this list." }, "output_keys": [ "rationale", "answer", "citations", "confidence", "abstain" ], "output_values": { "abstain": [ false, true ], "confidence": [ 0.9, 0.8 ], "answer (when abstain is true)": [ "I do not have enough information to answer that." ] }, "example": { "system": "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}.", "user": "Question: Did Tomas move to Lisbon on 2026-03-14?\n\nMemories:\n[f1] Tomas lives in Toronto.\n[f2] Tomas moved to Lisbon on 2026-03-12.", "output": { "rationale": "No provided memory answers this.", "answer": "I do not have enough information to answer that.", "citations": [], "confidence": 0.8, "abstain": true } }, "example_answerable": { "system": "Answer ONLY from the provided memories; abstain if unsupported. Output JSON: {rationale, answer, citations[], confidence, abstain}.", "user": "Question: Where does Maya live now?\n\nMemories:\n[f2] Maya moved to Austin on 2026-10-22.\n[f1] Maya lives in Lisbon.\n[f3] Maya currently resides in Austin.", "output": { "rationale": "Supported by f2.", "answer": "Austin", "citations": [ "f2" ], "confidence": 0.9, "abstain": false } } } }}.gitattributes+2
LICENSEAdded+202
NOTICEAdded+13
README.md+314-1
adapter_config.jsonAdded+173
adapter_model.safetensorsAdded+3
gguf/ModelfileAdded+37
gguf/cludemem-e4b-v3.Q4_K_M.ggufAdded+3
gguf/cludemem-e4b-v3.Q8_0.ggufAdded+3
prompts.jsonAdded+443