Objectives¶
An objective consists of a loss function and a decoder. Node-level objectives compute a loss for every node in a time-window graph, whereas edge-level ones compute a loss for every edge. This makes node-level objectives usually faster but less powerful than edge-level objectives to capture pair-wise information.
| Level | Objective | Learns to | Used by |
|---|---|---|---|
| Edge | predict_edge_type |
Predict the type of each edge | Velox, Orthrus, Kairos |
| Edge | predict_edge_contrastive |
Tell real edges from negative ones (link prediction) | Euler, Argus, Jbeil, E-GraphSAGE, ShadeWatcher |
| Edge | autoencode_edge_embeddings |
Reconstruct the embedding of each edge | LARES |
| Edge | deep_graph_infomax |
Tell edges from those of a corrupted graph | Anomal-E |
| Edge | reconstruct_edge_embeddings |
Reconstruct edge embeddings | |
| Edge | predict_edge_supervised |
Separate benign edges from given attack edges | Supervised fine-tuning |
| Node | predict_node_type |
Predict the type of each node | Flash, ThreaTrace |
| Node | predict_process_tag |
Predict the name of the executable of each process, which is removed from its features (doc2vec.truncate_process_name); scores processes by the loss, or by the distance to K-Means clusters of training processes (detection: kmeans) |
R-Caid |
| Node | reconstruct_node_features, reconstruct_node_embeddings |
Reconstruct node features or embeddings | NodLink |
| Node | reconstruct_masked_features, predict_masked_struct |
Reconstruct masked features and structure | MAGIC |
| Node | one_class |
Map benign nodes into a hypersphere per node type (Deep SVDD) | OCR-APT |
| Node | predict_snapshot_embedding |
Predict the graph2vec embedding of each time window; nodes are scored by their key indicators | ProGrapher |
Objectives are not tied to a family of datasets, except predict_node_type, which needs at least two node types: network datasets only have hosts (see Running across families for the combinations that are tested). On network datasets, predict_edge_type predicts the operation of events (e.g. LogOn), or the attribute set as edge type with construction.edge_type (e.g. logon_type).
predict_edge_contrastive- Link prediction: the decoder scores the edges of the graph against negative edges.
lossisbce(default),ap, the surrogate average precision loss of Argus, orbpr, the pairwise ranking loss of ShadeWatcher between each negative edge and the positive edge it was drawn for.neg_samplingdraws the negatives:shuffle_dst(default) pairs each source with the destination of another edge,uniformanduniform_dstdraw uniform nodes (neg_rationegatives per edge), andtgnuses destinations embedded by the TGN (requiresbatching.intra_graph_batching.tgn_last_neighbor.negative_destinations). With theinner_productdecoder,inner_product.negatescores edges by the negated inner product, as ShadeWatcher, whose inner product is the probability that two entities would not interact. autoencode_edge_embeddings- The edge autoencoder of LARES: edge embeddings combine the embeddings of the two nodes with the edge features (gated skip connection,
use_edge_feats), and edges are scored by their reconstruction error. deep_graph_infomax- Deep Graph Infomax on edge embeddings, as in Anomal-E: edges are scored by the reconstruction error of their embedding by a PCA (
pca_components) fitted on the training edges. predict_snapshot_embedding- The objective of ProGrapher, used with the
textrcnnencoder: the loss of a time window is the L2 distance between its graph2vec embedding and the embedding predicted from the previous windows. At inference, each node of the window gets the score of the window weighted by the rank of its key indicator: the rooted subgraphs (RSGs) of the window are ranked by how much more likely they are under the actual embedding than under the prediction, and a node getsscore × (1 − rank / #RSGs)from the best-ranked RSG rooted at it. The maximum node score of a window is the window's score, so the same losses servetw_evaluationandnode_evaluation. Withtop_k, only the nodes of thetop_kfirst RSGs keep a score. Its validation score (best_model_selection: best_val_score) is the opposite of the mean validation error.
autoencode_edge_embeddings, deep_graph_infomax and predict_snapshot_embedding have no decoder (decoder: none).
predict_edge_type also accepts loss: AMS, an additive margin softmax configured in its AMS section.
predict_edge_supervised is the only supervised objective: it learns from attack edges that you provide. See Supervised Fine-Tuning.
Arguments¶
- predict_edge_supervised
- decoder: str (1)
- mode: str (2)
- top_n_attacks: int (3)
- attack_patterns: list (4)
- max_edges_per_pattern: int (5)
- attack_edges_path: str (6)
- pos_weight: float (7)
- predict_edge_type
- loss: str (8)
- decoder: str (9)
- balanced_loss: bool
- use_triplet_types: bool
- edge_type_in_msg: bool (10)
- AMS
- version: int
- margin: float
- scale: int
- predict_node_type
- decoder: str (11)
- balanced_loss: bool
- flash_snapshots: bool (12)
- flash_drop_conf: float (13)
- predict_process_tag
- decoder: str (14)
- balanced_loss: bool
- detection: str (15)
- predict_masked_struct
- loss: str (16)
- decoder: str (17)
- balanced_loss: bool
- max_samples: int (18)
- detect_edge_few_shot
- decoder: str (19)
- predict_edge_contrastive
- decoder: str (20)
- loss: str (21)
- ap_margin: float (22)
- neg_sampling: str (23)
- neg_ratio: float (24)
- deep_graph_infomax
- decoder: str (25)
- pca_components: int (26)
- predict_snapshot_embedding
- decoder: str (27)
- top_k: int (28)
- reconstruct_node_features
- loss: str (29)
- decoder: str (30)
- reconstruct_node_embeddings
- loss: str (31)
- decoder: str (32)
- autoencode_edge_embeddings
- decoder: str (33)
- use_edge_feats: bool (34)
- reconstruct_edge_embeddings
- loss: str (35)
- decoder: str (36)
- reconstruct_masked_features
- loss: str (37)
- mask_rate: float
- decoder: str (38)
- one_class
- decoder: str (39)
- beta: float (40)
- eps: float (41)
- warmup: int (42)
- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - 'scores': pick top-N from an edge_scores pkl; 'patterns': match hand-crafted TTP patterns; 'synthetic': use pre-computed embeddings for explicit attack edge definitions.
Available options (one selection):scorespatternssynthetic - (scores mode) Number of top-loss edges to use as attack examples.
- (patterns mode) List of TTP pattern dicts.
- (patterns mode) Max edges collected per pattern.
- (synthetic mode) Path to YAML file with explicit (src_type, src_label, edge_type, dst_type, dst_label) attack edge definitions.
- BCE pos_weight for the attack class (on top of 1:1 oversampling).
- Loss used to predict the edge type. AMS: additive margin softmax (see
AMS).
Available options (one selection):cross_entropyBCEAMS - Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Keeps the edge type in the edge messages
msg(TGN memory andmsgedge features), as in Kairos. Messages of an edge are only used after its type is predicted. By default, the edge type is removed from the messages. - Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - With the
flashthreshold method: trains each epoch on the training nodes still misclassified, and flags a node only if no snapshot of the epochs so far predicts its type correctly with a confidence above the threshold, as in FLASH. - With
flash_snapshots: training nodes predicted with this confidence or more are removed after an epoch, as the correctly predicted ones (0.9 in FLASH). - Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Score of the processes at inference.
loss: cross-entropy of their tag (tags unseen in training have their own class, never predicted).kmeans: distance of their embedding to the median of the nearest K-Means cluster of training processes (as in the paper).
Available options (one selection):losskmeans
Available options (one selection):cross_entropyBCE- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Number of existing edges sampled per batch as positives, with as many negative node pairs, capped by the number of nodes (MAGIC: 10000). 0 uses all the edges.
- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone bce: binary cross-entropy of positive vs. random negative edges (default),ap: surrogate average precision loss of Argus,bpr: pairwise BPR loss of ShadeWatcher, softplus(s_neg - s_pos) between each negative edge and its positive edge.
Available options (one selection):bceapbpr- Margin of the squared hinge of the
aploss (default: 0.8). - Negative edges:
shuffle_dstpairs each source with the destination of another edge of the graph (negatives keep the degree of destinations),uniformdraws sources and destinations uniformly among the embedded nodes (as Euler and Argus),uniform_dstpairs the source of each edge with uniform destinations among the embedded nodes,tgnpairs it with a uniform destination of the dataset embedded by the TGN (as TGN and Jbeil, requirestgn_last_neighbor.negative_destinations).
Available options (one selection):shuffle_dstuniformuniform_dsttgn - Number of negatives per positive edge with
uniformsampling. - Unused: the discriminator of DGI is bilinear.
Available options (one selection):none - Number of principal components of the PCA fitted on the embeddings of training edges. Edges are scored by the reconstruction error of their embedding.
- Unused: the encoder predicts the embedding.
Available options (one selection):none - Number of top-ranked rooted subgraphs (key indicators) whose nodes get a score: other nodes get 0. 0 scores all nodes by the rank of their best rooted subgraph.
Available options (one selection):SCEMSEMSE_sumMAEnone- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone
Available options (one selection):SCEMSEMSE_sumMAEnone- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Unused: the objective has its own autoencoder.
Available options (one selection):none - Adds the edge features (
batching.edge_features) to the edge embedding through a gated skip connection, as LARES.
Available options (one selection):SCEMSEMSE_sumMAEnone- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone
Available options (one selection):SCEMSEMSE_sumMAEnone- Decoder used before computing loss.
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Decoder applied to embeddings before the hypersphere; use 'none' (identity).
Available options (one selection):edge_mlpnode_mlpmagic_gatnodlinkinner_productnone - Soft-boundary fraction; radius is the (1-beta) distance quantile.
- Center slack keeping |c| away from zero.
- Kept for parity; a no-op (c/r update every train step).