compctx-0.8b

A compact model that turns AI agent execution traces into structured memory notes.

compctx takes an agent's work log and compresses it into a concise, structured summary of the task, constraints, completed actions, failures, decisions, and next steps.

It is designed for agent memory systems where preserving useful execution context matters more than generating conversational responses.

Overview

  • Base model: Qwen/Qwen3.5-0.8B
  • Architecture: Qwen3_5ForCausalLM
  • Parameters: 752M
  • Modality: Text-only
  • Fine-tuning: Supervised fine-tuning (SFT) with LoRA
  • LoRA configuration: rank 128, alpha 128
  • Weights: LoRA merged into the base model

The original multimodal architecture was converted into a text-only causal language model. The trained language-model weights were transferred, and the LoRA adapter was converted and merged into the resulting checkpoint.

Output format

The model produces notes using a fixed structure:

Goal: <what the user wants, one sentence>
Constraints: <rules and limits, or "none">
State:
- [done] <completed action and its result>
- [failed] <action and exact error>
- [planned] <intended action without a confirmed result>
Decisions: <approach chosen or rejected, and why>
Next: <next unfinished step, or "unclear">

The model distinguishes between completed actions, failures, and planned work. It is instructed to use only information present in the trace and avoid inventing missing details.

Usage

The tokenizer's chat template includes the system prompt and a few-shot demonstration. Provide a single user message containing the agent trace:

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "aksern/compctx-0.8b"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

trace = """
[TRACE] [2026-10-30 06:24:00] [AGENT: Orchestrator]
User Prompt: "Find the errors in the file script.py and fix them."

[SPAN] [Thinking Process]
"To solve the task, I first need to read the contents of the file script.py. I will use the view_file tool."

[SPAN] [Tool Call: view_file]
Arguments: {"path": "script.py"}
Response: "def main():\n  print('Hello' + 5)"

[SPAN] [Thinking Process]
"There is a TypeError in the code: you cannot add a string and a number together. You need to replace 5 with '5' or use an f-string. I am invoking the patch_file tool."

[SPAN] [Tool Call: patch_file]
Arguments: {"path": "script.py", "edit": "print(f'Hello {5}')"}
Response: "File patched successfully."

[TRACE END] Agent completed the task.
"""

messages = [
    {"role": "user", "content": trace},
]

prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

inputs = tokenizer(
    prompt,
    return_tensors="pt",
    add_special_tokens=False,
).to(model.device)

with torch.inference_mode():
    output = model.generate(
        **inputs,
        max_new_tokens=512,
        do_sample=False,
    )

result = tokenizer.decode(
    output[0][inputs["input_ids"].shape[1]:],
    skip_special_tokens=True,
)

print(result)

The chat template automatically:

  • Adds the system instructions.
  • Includes the few-shot example used during training.
  • Wraps the input in <trace> tags.
  • Adds the assistant generation prefix.

Input: one user message containing a plain-text agent trace.

Output: a structured memory note.

Intended use

  • Compressing AI agent execution logs.
  • Preserving task progress between agent sessions.
  • Extracting completed actions and unresolved errors.
  • Creating compact context for long-running agent workflows.
  • Building lightweight memory components for tool-using agents.

Limitations

  • Not a general-purpose conversational assistant.
  • Designed around the specific structured output format above.
  • Accuracy depends on the information available in the input trace.
  • May omit details when the input exceeds its context or output budget.

Training

Fine-tuned from Qwen3.5-0.8B using supervised fine-tuning and LoRA.

The training objective was to transform agent execution traces into structured memory notes while preserving exact technical details such as paths, commands, identifiers, and error messages.

The resulting adapter was merged into a standalone text-only checkpoint.

License

This model is based on Qwen3.5-0.8B. Check the base model's license and applicable terms before redistribution or commercial use. The license for this model is OpenMDW-1.1

Downloads last month
233
Safetensors
Model size
0.8B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for aksern/compctx-0.8b

Adapter
(616)
this model
Adapters
1 model