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.
OpenBMB org

Thank you for the contribution and for the detailed explanation of KV-BSS.

The idea looks interesting, especially for reducing attention haze and improving associative retrieval in ultra-long-context inference. For this functionality, we would currently prefer to rely on your own repository as the recommended way to use and maintain KV-BSS, rather than merging the standalone hook module directly into this repo.

Thanks again for sharing this work and for contributing to the community.

xcjthu changed pull request status to closed

Sign up or log in to comment