File size: 3,527 Bytes
f037ae5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
license: other
tags:
  - gguf
  - llama.cpp
  - qwen3.5
  - embeddinggemma
  - agentic
  - context-management
  - dsh-cortex
---

# dsh-cortex

Local, lightweight GGUF model weights for **dsh-cortex** — a local context-management and monitoring stack for coding agents.

All three models are quantized for fast CPU / iGPU inference via `llama.cpp` (`llama-server`).

## Repository Contents

| Directory | Files | Format | Description |
| :--- | :--- | :--- | :--- |
| `embeddinggemma-2/` | `embeddinggemma-2-Q8_0.gguf` | GGUF (`Q8_0`) | Original `embeddinggemma-2` weights for local semantic search over archived agent history. |
| `qwen3.5-0.8b-agentic-summarizer/` | `qwen3.5-0.8b-agentic-summarizer-Q4_K_M.gguf` | GGUF (`Q4_K_M`) | `Qwen3.5-0.8B` fine-tuned with LoRA (merged) to summarize each agent step into a concise single-line summary. |
| `qwen3.5-0.8b-agentic-monitor/` | `qwen3.5-0.8b-agentic-monitor-Q4_K_M.gguf`<br>`head.json` | GGUF (`Q4_K_M`) + Linear Head | `Qwen3.5-0.8B` fine-tuned with LoRA (merged) + linear classification head to score agent context quality from step summaries. |

---

## Model Details

### 1. `embeddinggemma-2`
- **Source**: Original unmodified `embeddinggemma-2` weights (`Q8_0` GGUF, 768-dim L2-normalized embeddings).
- **Role**: Encodes step summaries and queries for local hybrid lexical + semantic retrieval over offloaded agent conversation history.
- **License**: Subject to the original Gemma Terms of Use.

### 2. `qwen3.5-0.8b-agentic-summarizer`
- **Base Model**: `Qwen/Qwen3.5-0.8B`
- **Training**: Fine-tuned via LoRA (distilled from `Qwen3.5-2B`) and merged back into the base weights before `Q4_K_M` GGUF quantization.
- **Role**: Summarizes each coding-agent step (tool call + tool result, or final assistant response) into a compact single-line summary card for timeline tracking and semantic indexing.
- **License**: Apache-2.0 (inherited from Qwen3.5).

### 3. `qwen3.5-0.8b-agentic-monitor`
- **Base Model**: `Qwen/Qwen3.5-0.8B`
- **Training**: Fine-tuned via LoRA with a linear classification head (`head.json`: `weight[1024]` + `bias`) to evaluate agent context quality and degradation risk directly from the rolling sequence of step summaries.
- **Role**: Takes the timeline of step summaries produced by `qwen3.5-0.8b-agentic-summarizer`, extracts the last-token hidden state (`--embeddings --pooling last --embd-normalize -1`), and computes the context degradation score via `sigmoid(dot(h, weight) + bias)`.
- **License**: Apache-2.0 (inherited from Qwen3.5).

---

## Quick Usage with `llama-server`

```bash
# 1. Embeddings (embeddinggemma-2)
llama-server -m embeddinggemma-2/embeddinggemma-2-Q8_0.gguf --embeddings --pooling mean -c 2048 --port 8081

# 2. Step Summarizer (qwen3.5-0.8b-agentic-summarizer)
llama-server -m qwen3.5-0.8b-agentic-summarizer/qwen3.5-0.8b-agentic-summarizer-Q4_K_M.gguf -c 4096 --port 8082

# 3. Context Quality Monitor (qwen3.5-0.8b-agentic-monitor)
llama-server -m qwen3.5-0.8b-agentic-monitor/qwen3.5-0.8b-agentic-monitor-Q4_K_M.gguf \
  --embeddings --pooling last --embd-normalize -1 -c 8192 -b 8192 -ub 4096 --port 8083
```

For `qwen3.5-0.8b-agentic-monitor`, compute the scalar score from the unnormalized last-token embedding `h` returned by `/v1/embeddings` and `qwen3.5-0.8b-agentic-monitor/head.json`:

```python
import json, math

head = json.load(open("qwen3.5-0.8b-agentic-monitor/head.json"))
logit = sum(a * b for a, b in zip(h, head["weight"])) + head["bias"]
score = 1.0 / (1.0 + math.exp(-logit))
```