Building Reliable RF Anomaly Detection

WINTER 2026 · 7 MIN READ

Role
ML Engineer InternatPalitronica
Overview
I spent the winter at Palitronica working on Anvil's RF-based inference engine, calibrating anomaly-detection thresholds and building a monitoring system to track how RF data drifted over time.

During my internship as a Machine Learning Engineer at Palitronica, I worked across Anvil’s RF-based electronics assurance pipeline. Here, I’ll focus on two projects: calibrating a one-class anomaly-detection model in the inference framework and building historical tracking around an existing RF data-drift calculation. Both dealt with how new measurements are interpreted relative to a reference. Calibration refined the detector’s operating point using labeled examples, while drift tracking made changes in incoming measurement groups visible over time.

Electronics assurance through RF measurements

Palitronica, a YC W22 company, develops technology for verifying the physical integrity of electronics. Its Anvil Checkpoint platform uses radio-frequency reflectometry and machine learning to compare a device’s response with a nominal (known-good) profile. The public product description covers components, assemblies, and complete modules, with measurements taken through existing connectors or a test fixture. This black-box approach supports testing when the purchaser has limited access to the device’s schematics, bill of materials, or firmware.

That capability matters when electronics arrive through a third-party supply chain. A component substitution, an undocumented board revision, or tampering can change the physical device while its part number and apparent function remain familiar. Palitronica describes supply-chain assurance applications in incoming inspection, supplier validation, supply-chain security, and aerospace and defense electronics. Government procurement contexts present similar assurance needs for purchased hardware and mission-critical systems; the company’s public CanadaBuys profile describes screening incoming commercial off-the-shelf electronics and assemblies. These are public use cases for the technology, rather than descriptions of customers or deployments I worked on.

An RF measurement captures how a device responds across a range of frequencies. Reflected and transmitted signals provide different views of its electrical structure, and a physical change can alter that response. Nominal devices also vary, so a useful verification system has to distinguish ordinary variation from departures that deserve investigation.

Fig. 1Synthetic
Measuring an RF fingerprintA schematic board connected to an RF source and receiver. The reflection path is highlighted. Below, seven synthetic nominal captures overlap closely across 1 to 6 GHz, and a modified-device trace departs from them near 3.8 GHz.
Measuring an RF fingerprintA schematic board connected to an RF source and receiver. The reflection path is highlighted. Below, seven synthetic nominal captures overlap closely across 1 to 6 GHz, and a modified-device trace departs from them near 3.8 GHz.
freq
3.81 GHz
reflection
Port 1 → Port 1
nominal
-10.8 to -9.5 dB
modified
-2.4 dB (Δ 7.8)

Figure 1. Measuring an RF fingerprint. RF responses provide a measurable fingerprint of the electronics, with variation across both devices and measurement paths. The board, traces, and magnitudes are schematic and synthetic.

From RF traces to NND within Anvil’s inference framework

Anvil’s feature pipeline represents captures across RF paths, signal representations, and frequency bins. After feature extraction, the values associated with a particular path form a feature vector. A path can correspond to a reflection port or a transmission port combination, providing a distinct view of the device and its nominal variation.

The inference framework supported several anomaly-detection models for interpreting those features. One of the models I worked on was the Normal-distribution-based Novelty Detector (NND), which represented nominal measurements with a multivariate distribution and scored new measurements using Mahalanobis distance. The calibration project described here focused on this detector within the broader Anvil ML stack.

Fig. 2Illustrative
RF capture

capture 0042 · synthetic

Feature array
captures n×RF paths 3×representations 2×frequencies 161
Inference config
detector: nnd
split_by: rf_path
Supported detectorsSelect one
Split Areflection · P1
μ
fitted nominal mean
Σ
fitted covariance
q
3.1
Split Breflection · P2
μ
fitted nominal mean
Σ
fitted covariance
q
6.8
Split Ctransmission · P1 → P2
μ
fitted nominal mean
Σ
fitted covariance
q
5.6

Figure 2. Anvil’s inference framework, with NND in focus. Anvil’s inference framework supported multiple anomaly-detection models; this calibration project focused on NND. The other card stands in for additional detectors and is not a model inventory.

NND learned its reference distribution from nominal measurements in a one-class setup. For each feature split, corresponding here to an RF path, it fitted a multivariate nominal model with a mean and covariance structure. Samples labeled Nominal and Anomaly were available for validation, while the underlying nominal model was fitted using the nominal group.

For path ii, the squared Mahalanobis distance of a feature vector xx is

qi(x)=Di2(x)=(x−μi)⊤Σi+(x−μi),q_i(x) = D_i^2(x) = (x-\mu_i)^\top\Sigma_i^{+}(x-\mu_i),

where μi\mu_i is the fitted nominal mean, Σi\Sigma_i is its covariance matrix, and Σi+\Sigma_i^{+} denotes the covariance pseudoinverse. I use qiq_i throughout to keep the squared distance distinct from its square root.

NND’s covariance accounts for the direction of a departure as well as its size. A feature can move substantially along a direction that varies naturally among nominal captures, while a smaller movement across a tightly concentrated direction can be more unusual. Correlations between features also matter: several frequency bins can move together as part of ordinary variation.

Fig. 3Synthetic
q = 1q = 4q = 9μ

Drag the test point, or focus it and use the arrow keys.

Test point
‖x − μ‖
1.50
q
1.00
√q
1.00
Equal step, ‖d‖ = 1.50
  • long axisq = 1.00
  • short axisq = 12.76
Synthetic Σ
[ 1.63  0.95 ]
[ 0.95  0.79 ]

Figure 3. Covariance-aware distance in feature space. The same numerical displacement can have different significance depending on the nominal covariance structure. Axes are an illustrative two-feature slice; every contour and readout is computed from one synthetic covariance matrix.

Why calibrate a statistically derived boundary?

The existing NND implementation used a statistically derived threshold based on the nominal model. That produced one distance threshold shared across the path submodels. Each path had its own fitted mean and covariance, while the decision boundary did not come from labeled examples.

This gave the one-class detector a principled decision boundary, but it did not use labeled Nominal and Anomaly examples to choose its operating point. Those validation examples still described classification behavior: which nominal samples fell beyond the boundary and which anomaly samples remained inside it.

My NND tuning work added a calibration step that evaluated the labeled distances separately for each split and selected a threshold for each one. The fitted nominal model continued to supply the distance; calibration supplied the decision boundary. This made it possible to express the desired false-positive/false-negative tradeoff using observed validation behavior.

At inference time, the Mahalanobis distance is compared with the calibrated threshold to determine whether the sample remains within the nominal boundary.

Fig. 4Synthetic
Validation set
From a nominal model to a calibrated boundaryTop: a fitted normal curve over one illustrative feature with nominal fit samples. Middle: the same samples on a squared-distance axis with a dashed statistical threshold at 7. Labeled validation samples are added; the calibrated threshold for split A is 4.66. Bottom: three RF splits each receive their own calibrated threshold.FEATURE VIEWsigned illustrative feature, fitted normalDISTANCE VIEWq = squared Mahalanobis distance, q ≥ 0nominal model + statistical thresholdPER-SPLIT THRESHOLDSexpands at step 4Split A · reflection P1Split B · reflection P2Split C · transmission P1→P2
From a nominal model to a calibrated boundaryTop: a fitted normal curve over one illustrative feature with nominal fit samples. Middle: the same samples on a squared-distance axis with a dashed statistical threshold at 7. Labeled validation samples are added; the calibrated threshold for split A is 4.66. Bottom: three RF splits each receive their own calibrated threshold.FEATURE VIEWsigned illustrative feature, fitted normalDISTANCE VIEWq = squared Mahalanobis distance, q ≥ 0nominal model+ statistical thresholdPER-SPLIT THRESHOLDSexpands at step 4Split A · reflection P1Split B · reflection P2Split C · transmission P1→P2
τ
7 stat.
FP
—
FN
—
total
—
FP/FN
—

Nominal model. The fitted nominal distribution and its statistically derived threshold, shown in feature space and in squared-distance space.

Rule: anomaly when q > τ

Figure 4. From a nominal model to a calibrated boundary. Calibration uses labeled validation distances to choose a boundary for each RF path. Squared distances are not normally distributed, so the two views use separate axes. All values are synthetic.

Choosing a threshold when the classes separate

For one path, let NN contain the squared distances of labeled nominal examples and AA contain those of labeled anomaly examples. When

max⁡(N)<min⁡(A),\max(N)<\min(A),

the observations leave a gap between the two classes. The tuner places the threshold within that gap using a configurable interpolation position gg:

τ=max⁡(N)+g(min⁡(A)−max⁡(N)).\tau=\max(N)+g\bigl(\min(A)-\max(N)\bigr).

An interior choice, 0<g<10<g<1, separates all observed examples. The interpolation controls the boundary’s position between the most distant nominal example and the nearest anomaly example; it does not establish how unseen samples will behave.

The exact NND boundary rule matters here. NND classifies a sample as Anomaly only when

q>τ.q>\tau.

Equality remains nominal. Consequently, the observed zero-error interval is [max⁡(N),min⁡(A))[\max(N),\min(A)). The nominal endpoint is valid under this rule, while the Anomaly-class endpoint would accept the nearest anomaly observation.

Fig. 5Synthetic
zero-error interval [2.0, 3.0)0.81.11.52.03.03.64.2τ = 2.50
zero-error interval [2.0, 3.0)0.81.11.52.03.03.64.2τ = 2.50
g
0.50
τ
2.50
FP
0
FN
0

τ = max(N) + g · (min(A) − max(N)) = 2.0 + 0.50 · 1.0 = 2.50

every observed example is separated

Figure 5. The clean-separation gap and its endpoints. A clean gap provides several valid thresholds, with endpoint behavior determined by the classifier’s comparison rule. The nominal endpoint is closed and the anomaly endpoint is open because NND flags a sample only when q > τ.

Choosing a tradeoff when the classes overlap

Overlapping distances require a different decision. Lowering the threshold flags more anomalies, but it can also reject more nominal measurements. Raising it accepts more nominal variation while allowing more anomaly examples through. For the strict comparison used by NND, the relevant counts are

FP⁡(τ)=#{n∈N:n>τ},FN⁡(τ)=#{a∈A:a≤τ}.\operatorname{FP}(\tau)=\#\{n\in N:n>\tau\},\qquad \operatorname{FN}(\tau)=\#\{a\in A:a\leq\tau\}.
FP⁡(τ)=#{n∈N:n>τ},\operatorname{FP}(\tau)=\#\{n\in N:n>\tau\},
FN⁡(τ)=#{a∈A:a≤τ}.\operatorname{FN}(\tau)=\#\{a\in A:a\leq\tau\}.

The tuning routine evaluated candidate boundaries and compared their observed FP/FN ratios with a configurable target. The extreme settings directly prioritized minimizing false positives or false negatives; finite targets selected the candidate closest to the requested FP/FN ratio. These are counts on the supplied labeled data, so the balance of nominal and anomaly examples affects the ratio.

After selecting a candidate operating point, the routine placed the boundary in an adjacent interval between observations. An interior threshold preserves a classification partition while avoiding unnecessary coincidence with a sample value. When two differently labeled examples have exactly the same distance, threshold movement alone cannot separate them, so the strict comparison must apply consistently to both.

This calibration changes which mistakes NND prefers on the available validation data. Its performance on future measurements still depends on how representative those examples are. The useful outcome of the project was an explicit, deterministic calibration mechanism, rather than an assumed universal improvement in production error rates.

Fig. 6Synthetic
flagged · q > τNominal0.81.42.12.83.2Anomaly1.82.53.03.6τ = 2.30
flagged · q > τNominal0.81.42.12.83.2Anomaly1.82.53.03.6τ = 2.30
Confusion matrix
Actual classpred. nominalpred. anomaly
nominalTN 3FP 2
anomalyFN 1TP 3

FP/FN 2

Candidate partitions
  1. (−∞, 0.8)5/0 · ∞
  2. [0.8, 1.4)4/0 · ∞
  3. [1.4, 1.8)3/0 · ∞
  4. [1.8, 2.1)3/1 · 3
  5. [2.1, 2.5)2/1 · 2
  6. [2.5, 2.8)2/2 · 1
  7. [2.8, 3.0)1/2 · 0.5
  8. [3.0, 3.2)1/3 · 0.33
  9. [3.2, 3.6)0/3 · 0
  10. [3.6, ∞)0/4 · 0

Interval · FP/FN counts · ratio

Figure 6. Inspecting overlapping distances. Overlap makes threshold selection a choice about the observed balance of false positives and false negatives. Counts are recomputed from the displayed values with q > τ.

Within NND, the architectural change connected calibration to the existing path submodels. Before calibration, NND used a shared threshold across those submodels. Calibration allowed each RF path to use a threshold informed by its own validation behavior. A threshold still belongs to the path whose fitted mean and covariance produced its distances.

Fig. 7Synthetic
Calibration

Labeled validation distances per split

Choose τ for each split

Threshold config

τ = 6.0

One shared threshold for every path, from the nominal model.

Splitqq > τPath output
Split Areflection · P13.13.1 > 6.0inside
Split Breflection · P26.86.8 > 6.0beyond
Split Ctransmission · P1→P25.65.6 > 6.0inside

A sample is beyond the nominal boundary only when q > τ. Equality stays inside.

Figure 7. NND shared threshold to per-split calibration. Per-split NND calibration changes the decision boundaries while retaining the fitted nominal distance models. Features, fitted parameters, and distances are identical in both views; outputs stop at the path level.

Following the measurement distribution over time

NND calibration refined how individual measurements were classified, while the second project looked at how groups of incoming RF measurements changed relative to a reference over time. A detector can retain a well-defined threshold while the data reaching it gradually shifts, making that history useful context for interpreting its behavior.

The existing drift calculation already compared two groups of RF-derived features and summarized their separation for each RF path. Unlike NND, which evaluates an individual measurement against a fitted nominal distribution, drift compares groups using their average responses and observed variation. My contribution was the tracking system around that calculation: identifying new measurement groups, resolving suitable references, reconstructing comparable inputs, and retaining the results over time.

The drift metric increases as the average RF responses separate relative to their spread, with larger departures contributing more strongly. It is not an anomaly probability or universal acceptance threshold, and its interpretation depends on comparing compatible RF paths, representations, and frequency grids.

Fig. 8Synthetic
Presets
— baseline X- - current Y
— baseline X- - current Y
Region, GHz
Path drift

0.49

f
3.55 GHz
baseline
-9.6 dB
current
-5.6 dB

Figure 8. Comparing RF traces for drift. Baseline and current mean traces, with bands showing the variation within each group. The drift readout grows when those averages separate relative to the spread. All traces are synthetic.

Building a reproducible history

Turning a one-shot drift calculation into a monitoring system raised a different set of engineering questions:

  • Which new datasets should be evaluated?
  • Which historical data should be considered the reference?
  • How do you ensure both groups use compatible feature extraction?
  • What happens if the tracker misses several days?
  • Can somebody reproduce a suspicious drift point later?

I built a tracker around these concerns. The prototype recorded how far evaluation had progressed, evaluated new data incrementally, and could replay missed daily windows to preserve the temporal meaning of the history.

Each comparison also needed a suitable reference dataset and compatible feature extraction. Because a drift value depends on both, the tracker preserved enough provenance to reconstruct how each historical point was produced.

The early implementation kept tracker state and outputs in a form that made replay and reference reconstruction easy to test. The resulting drift metrics were later integrated into Prometheus and Grafana, giving the team a monitoring view of RF drift over time.

Fig. 9Synthetic
Historical drift-tracking architectureNew measurements in a time window are compared with a selected reference. Both sides are reconstructed into comparable features, drift is calculated, and the result is stored with its provenance. That history is shown in Prometheus and Grafana.TRACKINGMONITORINGNew measurementsincoming groupSelect referencereference datasetComparable featuressame extractionCalculate driftgroup comparisonHistoryresult + provenancePrometheusGrafanaHistorical drift-tracking architectureNew measurements in a time window are compared with a selected reference. Both sides are reconstructed into comparable features, drift is calculated, and the result is stored with its provenance. That history is shown in Prometheus and Grafana.TRACKINGMONITORINGNew measurementsincoming groupSelect referencereference datasetComparable featuressame extractionCalculate driftgroup comparisonHistoryresult + provenancePrometheusGrafana
History
Record · Day 14Day 14 00:00 → Day 15 00:00
current
Day 14 measurements
group
device family A · fixture 1
captures
n = 29
reference
Reference dataset
captures
n = 120
paths
A, B, C
reps
magnitude, phase
grid
1–6 GHz · 161 bins
max refl.
0.451 · path A
max trans.
0.296 · path C
  • RF paths match
  • Representations match
  • Frequency coordinates match

Figure 9. Historical drift-tracking architecture. Each historical drift point connects a time window, the measurements being compared, a reference dataset, and the settings used to reconstruct them. Labels are synthetic.

Validating the tracking workflow

I built helper tooling to inspect historical collections and models, find device/setup groups with usable data, and replay the tracker with a controlled notion of the present. Replay used separate state so historical runs could advance without overwriting the active tracker state.

Another helper reconstructed baseline and current feature arrays for a selected comparison and ran the same drift calculation directly. This provided a way to inspect the inputs independently of the window-discovery workflow. I also verified that historical comparisons could be reconstructed from their stored provenance.

These tools made the surrounding system easier to inspect. A suspicious history point could be traced back to its inputs, while a missing point could be investigated through collection availability, reference selection, and retrieval. The historical value became something the team could examine, rather than a scalar detached from the measurements that produced it.

Fig. 10Synthetic data
RF drift · device family A / fixture 1Prometheussynthetic data
not evaluatedreference changed
not evaluatedreference changed
max reflection driftmax transmission drift
window
Day 11 00:00 → Day 12 00:00
max refl.
0.190 · path A
max trans.
0.140 · path C
current
n = 31
reference
different reference · n = 64

Figure 10. Synthetic Prometheus/Grafana drift monitoring. A drift history supplies temporal context, with source details available for investigating changes. Missing evaluations are gaps, never zeros, and the panel has no universal pass/fail threshold. All values are synthetic.

What I took away from the work

These two projects improved different parts of the same measurement pipeline. Threshold tuning used labeled examples to make NND’s operating point explicit for each RF path, while drift tracking connected recurring group comparisons to a reproducible history and monitoring view. Their value depended on details that could easily disappear behind a single score: the exact inequality at the boundary, which threshold belonged to which RF path, the chosen reference, and the configuration used to reconstruct the data.

Working on both reinforced how much ML engineering depends on making those details inspectable. A statistical model provides a foundation, labeled calibration defines an operating choice, and historical monitoring gives the team context as measurements evolve. For electronics assurance, that connection between physical measurements, decisions, and their provenance was one of the most interesting engineering problems I worked on during the internship.