PreprintPDF Available

Local Units as Domain Gates: A Multineutral Algebra View on Retrieval-Augmented Generation

Authors:
  • Alpha Codes s.r.o.
Preprints and early-stage research may not have been peer reviewed yet.

Abstract

We show how to construct local units for each semantic cluster in an embedding space and how these units act as domain-specific masks (gates) in Retrieval-Augmented Generation (RAG). The construction is formulated purely algebraically, dispensing with implementation and revealing the direct connection to multineutral structures .
Local Units as Domain Gates:
A Multineutral Algebra View on
Retrieval-Augmented Generation
Ondˇrej Br˚uha1
1Alpha Codes s.r.o. ondrej.bruha@alphacodes.eu
2025
Abstract
We show how to construct local units [1] for each semantic clus-
ter in an embedding space and how these units act as domain-specific
masks (gates) in Retrieval-Augmented Generation (RAG). The con-
struction is formulated purely algebraically, dispensing with imple-
mentation and revealing the direct connection to multineutral struc-
tures.
1 Preliminaries
Let ERn×dbe a matrix whose rows eiare d–dimensional text embeddings
and let L {−1,0, . . . , C 1}nbe cluster labels produced by any clustering
algorithm (e.g. HDBSCAN), where label 1 denotes noise.
For a fixed cluster index c0 define the index set Ic:= {i|Li=c}. We
assume Ic=(otherwise the cluster is absent). We denote the cardinality
of Icby k.
Denote by e(c) {0,1}dthe local unit of cluster c; components are defined
as for some ϵ > 0
e(c)
j:= (1 iff1
kPiIc|Eij |> ϵ,
0 otherwise. (1)
1
Thus e(c)
j= 1 precisely when at least one member of the cluster exhibits
non-zero activity in dimension j.
2 Gating with Local Units
Given a query embedding qRd, its cluster-gated variant is
q
c:= qe(c),(2)
where is the Hadamard (component-wise) product. The operation is idem-
potent and commutative inside the multineutral field determined by the em-
bedding space and the masking vectors.
Relevance test. Let scbe the cosine similarity between qcand the nearest
neighbour vector retrieved inside the cluster c. If scfalls below a threshold
τwe discard the cluster; otherwise, the corresponding passages are included
in the RAG context.
3 Algebraic Properties
1. Idempotence. e(c)e(c)=e(c)by definition.
2. Commutativity. e(c)e(d)=e(d)e(c)for all c, d.
3. Local unity. For every embedding xbelonging to cluster cwe have
xe(c)=x, because every non–zero coordinate of xsurvives the mask
according to (1).
These three facts show that the set {e(c)}c0forms a system of local units in
the sense of multineutral algebra [1].
4 Discussion
Local units are extremely cheap to compute and store; a single pass over
the embeddings suffices. Although cruder than centroids or soft masks, they
work well when the dominant goal is to filter away irrelevant dimensions
rather than to re-weight them.
Future work will explore smooth relaxations e(c)
j[0,1] that allow differ-
entiable learning of mask values.
2
References
[1] Bruha, Ondrej. (2025). Locally Regular Algebraic Struc-
tures: A Unified Approach to Multineutral Groups and Fields.
10.13140/RG.2.2.32459.50729.
3
ResearchGate has not been able to resolve any citations for this publication.
Preprint
Full-text available
We introduce the concept of multineutral structures, such as groups and fields, which generalize von Neumann regularity by allowing for localized units and weak inverses. We study their algebraic properties, define an associated notion of dimension, and show how every linear vector space can be extended to a multineutral field. Furthermore, we introduce an ordering on multineutral monoids and relate it to structural properties of local behavior.