Skip to content
Other

dsh-cortex

a local context management stack for coding agents

2 min readupdated

A set of three lightweight quantized models by author Logic-z, designed for local memory control and context quality management in AI programming agents. Instead of bloating chat history, the stack compresses each agent step into a single line, searches through action archives, and evaluates the risk of context degradation directly on a CPU or integrated graphics using llama.cpp. Two of the included models are based on Qwen3.5-0.8B (fine-tuned via LoRA [a method for efficient weight adaptation]), while the third uses original embeddinggemma-2 weights. This solution is useful for developers of local agent systems who need fast session state monitoring without relying on external APIs.

Key features

  • Agentic Summarizer: a fine-tuned Qwen3.5-0.8B model (distilled from Qwen3.5-2B) that collapses tool calls and agent responses into a compact, single-line card.
  • Agentic Monitor: a Qwen3.5-0.8B version with a linear classification head (head.json) that computes a context degradation score based on the step history.
  • Semantic search: the original embeddinggemma-2 model in Q8_0 quantization for generating 768-dimensional embeddings and searching through dialogue archives.
  • Lightweight local run: all weights are packaged in GGUF format (Q4_K_M and Q8_0) for fast inference on CPUs and iGPUs using llama-server.

What you can do

  • Integrate it into your own AI programming agent to automatically compress long tool call logs and save context window space.
  • Set up an automatic session cleanup or restart trigger when the agentic-monitor signals a high risk of context degradation.
  • Organize local hybrid search across past agent actions and decisions using embeddinggemma-2.

Example

# Запуск суммаризатора шагов и монитора качества через llama-server
llama-server -m qwen3.5-0.8b-agentic-summarizer/qwen3.5-0.8b-agentic-summarizer-Q4_K_M.gguf -c 4096 --port 8082
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
Read moreDetails
Contents: embeddinggemma-2-Q8_0.gguf, qwen3.5-0.8b-agentic-summarizer-Q4_K_M.gguf, qwen3.5-0.8b-agentic-monitor-Q4_K_M.gguf + head.json.
Training: models based on Qwen/Qwen3.5-0.8B were fine-tuned using LoRA (merged with base weights), and the summarizer was distilled from Qwen3.5-2B.
Degradation scoring: extracts the hidden state of the last token via /v1/embeddings and runs it through sigmoid(dot(h, weight) + bias).
Licenses: Apache-2.0 for Qwen3.5-based models, Gemma Terms of Use for embeddinggemma-2.
Discuss Telegram 0 190

Will it run?

Runs in GGUF Q4_K_M

The most precise of the ready quantised files fits.

  • GGUF Q4_K_Mweights 1.0 GB · ready files1.6 GB
  • GGUF Q8_0recommendedweights 0.3 GB · ready files0.8 GB

Tip: go 8-bit.GGUF Q8_0 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

What to get for this model

Massed ComputeOpen Massed Compute

Your own GPU: GGUF Q8_0 — from RTX 2060 · GGUF Q4_K_M — from RTX 2060

Massed Compute hourly prices, November 2026. The discounted price applies with the coupon at checkout.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # Logic-z/dsh-cortex
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download Logic-z/dsh-cortex --local-dir ~/models/dsh-cortex
    # The model is in ~/models. How to run it is in the model card (link above).
    Add more LoRAs to dsh-cortex
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b41from November 25, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

New posts about versions of dsh-cortex (quants, finetunes, LoRAs) will show up under the bell.

No known relatives of this model yet. All derivatives on Hugging Face

About the model

Logic-z/dsh-cortex
Author
Logic-z
Category
Other
Released
Posted

On NeyroLearn

Hugging Face

1900

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments