Add KV-BSS (Key-Value Binding Softmax Sharpening) attention hook

#11
by F-Labs - opened

KV-BSS: Key-Value Binding Softmax Sharpening for 128K Context Inference

This Pull Request adds the standalone KV-BSS (Key-Value Binding Softmax Sharpening) attention hook module for MiniCPM5-2B.

Background & Motivation

In ultra-long context inference (up to 131,072 tokens), standard attention logits suffer from entropy dispersion (attention haze), which reduces associative retrieval accuracy on structured bindings (e.g. ["key"] => "value", AST parsing, schema extraction).

What KV-BSS does:

  1. Focus Factor Scaling (τ_focus = 1.10): Steeping attention logits concentrates probability mass around exact antecedent keys.
  2. Attention Haze Floor Filtering: Masks logits falling more than 12.0 nats below the maximum attention score to -inf, eliminating associative noise.
Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment