Join our Newsletter — 33% off our NHI Course
Home Glossary AI Security Macro F1
AI Security

Macro F1

← Back to Glossary
By NHI Mgmt Group Updated September 6, 2026 Domain: AI Security

Macro F1 calculates F1 for each class separately and then averages the class scores equally. It is useful when every class deserves the same attention, including rare ones. This makes it a better fit when minority-class failures matter as much as performance on the majority class.

Expanded Definition

Macro F1 is a class-balanced evaluation metric, so it treats each label as equally important even when the dataset is imbalanced. That makes it especially useful in security and governance contexts where rare classes can represent the outcomes that matter most, such as abuse, compromise, or policy violation.

Unlike weighted or micro-averaged scores, Macro F1 does not let large classes dominate the final result. A model can look strong overall while still failing badly on minority classes, and Macro F1 is designed to expose that gap. In practice, this means the metric is often more honest for detection problems than accuracy alone.

The boundary to watch is that Macro F1 is a measurement choice, not a guarantee of better real-world performance. It can reward balanced treatment of all classes even when one class is operationally far more important, so the right use depends on whether each class truly deserves equal attention. For a broader control context, NIST SP 800-53 Rev 5 Security and Privacy Controls helps frame the surrounding governance and monitoring expectations.

Examples and Use Cases

Macro F1 is most often used when a model must perform reliably across all categories, not just the majority class. In security workflows, that is common when rare classes carry high operational value or risk.

  • Evaluating a phishing classifier where legitimate mail is common, but rare malicious campaigns must still be detected.
  • Comparing alert triage models that classify events into multiple incident types, including low-frequency but high-impact categories.
  • Testing a secrets detection system that labels findings by severity or leak type, where uncommon classes should not be ignored.
  • Assessing an access-review classifier that separates routine access from anomalous or unauthorized patterns across several labels.
  • Measuring an agent or workflow classifier that routes requests into multiple action classes, especially when minority classes represent exceptions or escalations.

The main tradeoff is that Macro F1 can penalise a model heavily for poor performance on rare classes even when the overall volume is small. That is useful when minority failures matter, but it can be misleading if some classes are noisy, weakly defined, or not equally actionable.

Security Implications

In security programs, Macro F1 matters because skewed datasets can hide failure on the very class an organisation cares about most. A detector that performs well on normal traffic but misses rare malicious cases may still produce a respectable aggregate score if the evaluation is not class-balanced.

That creates a governance problem as well as a technical one: teams may believe a model is ready for production when it is actually uneven across critical labels. The practical symptom is often a system that looks stable in aggregate reports but fails during edge cases, escalation paths, or low-frequency abuse patterns.

NHIMG research shows that 80% of identity breaches involved compromised non-human identities such as service accounts and API keys, which is a useful reminder that rare classes can be disproportionately important in real security outcomes. Macro F1 helps surface whether a model is truly treating those minority outcomes as first-class cases rather than statistical noise. In other words, the metric can expose whether detection quality is balanced enough for operational trust.

Domain and Governance Relevance

Macro F1 is not a governance control by itself, but it is highly relevant to model oversight, especially when security teams use ML for detection, classification, prioritisation, or routing. It forces reviewers to ask whether the evaluation standard matches the operational stakes of the problem.

In NHI and agentic AI settings, this matters when models classify events involving service accounts, tokens, secrets, or autonomous actions. If rare compromise states, privilege-abuse patterns, or exception paths are under-scored, teams can miss the failure modes that matter most to identity assurance and response readiness.

For that reason, Macro F1 is most valuable when paired with clear class definitions, documented label ownership, and an explicit decision about whether equal class weighting is justified. The metric is strongest when it supports governance decisions about model acceptance rather than merely producing a single headline score.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK address the attack surface, NIST CSF 2.0, CIS Controls v8 and NIST AI RMF set the technical controls, and ISO/IEC 42001:2023 define the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0ID.IM-1 — Improvements Are Identified and ManagedMacro F1 supports evaluating whether detection model improvements close class-specific gaps.
Recommendation — Use Macro F1 to verify that model improvements raise minority-class performance, not just aggregate score.
CIS Controls v88.5 — Account Audit Log ManagementMacro F1 is relevant when class-balanced detection quality affects alert and event classification.
Recommendation — Measure class-balanced detection quality so low-frequency security events are not lost in dominant classes.
MITRE ATT&CKT1036 — MasqueradingMacro F1 helps assess models that must distinguish deceptive activity from benign lookalikes.
Recommendation — Tune classifiers to preserve performance on deceptive minority labels that attackers may try to blend into.
NIST AI RMFMAP — MapMacro F1 is an evaluation choice that should align model metrics with intended risk and context.
Recommendation — Map Macro F1 to the risk context so evaluation reflects whether minority errors are acceptable.
ISO/IEC 42001:20238.2 — AI Risk TreatmentMacro F1 informs AI oversight when balanced class performance is required for governed use.
Recommendation — Require Macro F1 evidence when deciding whether a model is fit for governed deployment.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 6, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org