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
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Shared sparse-feature types used by both CLT and SAE modules.
//!
//! [`FeatureId`] is a marker trait for feature identifiers, and
//! [`SparseActivations`] stores the non-zero activations in descending
//! magnitude order. These live here so that the public type identity is
//! stable regardless of which feature flags are enabled.
/// Marker trait for feature identifiers in sparse activation vectors.
///
/// Implemented by `CltFeatureId` (CLT features with layer + index,
/// requires `clt` feature) and `SaeFeatureId` (SAE features with index
/// only, requires `sae` feature).
/// Sparse representation of feature activations.
///
/// Only features with non-zero activation are stored,
/// sorted by activation magnitude in descending order.
///
/// Generic over the feature identifier type `F`:
/// - `CltFeatureId` for CLT features (layer + index, requires `clt` feature)
/// - `SaeFeatureId` for SAE features (index only, requires `sae` feature)