3.1. Multi-Task Dual-Channel Temporal Risk Scoring
Above all, we denote a taxpayer by
, time by
, and module by
for Payroll, Benefits, and Healthcare. The raw feature vector for module
at time
is
, and the missingness mask is
. We concatenate masked values and the mask to form the effective input so the model can learn patterns, which are common in compliance data and should not be treated as random noise by Equation (1).
where
denotes element-wise multiplication, ensuring unobserved values do not leak arbitrary numerical placeholders into the network. The concatenation operator
appends the binary mask so downstream layers can condition at each feature position. Because modules differ in scale and semantics, we embed each module into a common latent space before cross-module fusion. This projection also reduces heteroskedasticity across modules and creates a unified interface for later temporal modeling. We use a module-specific nonlinear encoder
to produce a fixed-width representation
, enabling apples-to-apples fusion between Payroll, Benefits, and Healthcare signals by Equation (2).
where
and
are learnable matrices tailored to module
, while
is a pointwise nonlinearity. The hidden width
is shared across modules so that later attention or gating operations can compare and combine module embeddings.
We explicitly define three supervised tasks and one self-supervised temporal task: T1 predicts a risk probability for proxy label using binary cross-entropy ; T2 predicts a severity score for proxy severity using Huber loss ; T3 predicts a consistency-anomaly probability for sublabel derived from cross-field residual exceedance using .
To jointly learn payroll risk factors across multiple compliance tasks, we adopt a shared Mixture-of-Experts (MoE) trunk with task-adaptive routing. The core rationale is that some latent risk mechanisms are shared, while different tasks emphasize different slices of the signal. MoE decomposes representation learning into multiple experts and uses a gating network per task to select and weight these experts, both shared learning and task-specific flexibility as Equation (3).
Each expert
can be instantiated as a cross-module attention block or a multilayer fusion network. The number of experts
controls capacity and the diversity of learned risk mechanisms. Practically, experts allow the model to separate patterns, which improves both detection accuracy and downstream interpretability. We compute task-specific gating weights
from the concatenated module embeddings. This explicit routing also provides an internal dependency signal that we later reuse when constructing gated edges for risk-path generation. The softmax normalization ensures the routing weights are nonnegative and sum to Equation (4), which is valuable for stability and for interpreting which experts dominate each task at each time.
In above gating equation, is a task-specific projection, and the concatenation aggregates the three module embeddings into a single routing context. The index denotes compliance tasks; for example, can represent noncompliance classification, underpayment magnitude regression, cross-form inconsistency detection, etc. Because routing is computed at each , the model can adapt when a firm’s behavior changes over time, which is essential for detecting gradual drifts rather than only abrupt shocks.
The shared task representation
is then the convex combination of expert outputs. Equation (5) integrates payroll, benefits, and healthcare risk factors into a single task-conditioned state, while maintaining separability across tasks. This representation is the input to the temporal anomaly detector.
where
is the expert output width, and
is the
-th component of the gating vector. The convex structure yields numerical stability and an implicit regularization effect that reduces overfitting on noisy compliance signals. Conceptually,
represents the model believes matters right now for task
after looking jointly at payroll, benefits, and healthcare inputs.
Subsequently, we score time-varying anomalies using a dual-channel temporal architecture by Equation (6). A Transformer channel for long-range dependencies and an LSTM channel for local drift and seasonal residuals. This design mirrors real-world compliance dynamics, where evasion can be gradual or sudden. Running both channels in parallel and fusing them improves sensitivity across different anomaly regimes.
In the Transformer channel,
is a positional encoding that injects time order information, and
selects the
-th output token. In the LSTM channel, the recurrent state naturally models local patterns such as month-to-month payroll changes or contribution timing effects. We use task-specific temporal models
and
so that each compliance target can emphasize different temporal structures. We fuse both temporal embeddings to produce the final task risk score
. For regression tasks we replace it with an appropriate output layer. This fused score is the risk score that triggers the subsequent interpretability and risk-path stages by Equation (7).
The vector and bias are task-specific parameters; the concatenation allows each task to learn how much to trust long-range versus local evidence. This fusion step is intentionally simple because we want interpretability to remain tractable when later attributing risk to upstream features. Overly complex fusion can make SHAP-based decompositions less stable in high-dimensional temporal settings.
We generate interpretable risk paths on a directed acyclic graph (DAG) whose nodes are module–time pairs . We include only time-forward edges to preserve causality and optionally same-time cross-module edges when a learned dependency is present. Each node receives a score computed by aggregating SHAP attributions within module.
Finally, to stabilize audit triggers and reduce oscillatory alerts, we add a bidirectional consistency regularization between the Transformer-only posterior and the LSTM-only posterior. This directly implements the abstract’s claim of consistency constraints in the temporal detector. In practice, it discourages cases where one channel signals high risk while the other signals low risk without strong evidence by Equations (8) and (9).
where
and
produce channel-specific posteriors, and
is the Kullback–Leibler divergence. The symmetric KL form penalizes disagreement in both directions, improving calibration and temporal stability. KL divergence is only defined between valid probability distributions. Therefore, for each supervised task we convert both channels’ outputs into distributions before applying KL. For binary tasks (T1, T3), each channel produces a logit
, and we form Bernoulli parameters
. We then compute
to enforce consistency between Transformer and LSTM channels.
3.2. SHAP-Guided Risk Path Generation on a Heterogeneous Temporal Graph
Furthermore, we begin by defining SHAP attributions at the level of task
and evaluation time
. Let
denote the trained predictor producing
from the full set of input features within the window
. Expand the full feature set into a flattened index
that includes module, time, and atomic feature coordinates. SHAP defines the contribution of each feature as a Shapley value from cooperative game theory, guaranteeing additivity and a fair allocation of the prediction difference from a baseline as Equation (10).
In above expression, ranges over all subsets of features excluding , and denotes the model prediction when only features in are present. The factorial weighting term is the canonical Shapley coefficient that averages marginal contributions over all feature orderings. We use SHAP because its additivity enables accounting consistency, meaning auditors can reconcile a path-level explanation back to the model score without hidden residuals.
We compute (a) cross-field consistency residuals
defined by domain-agnostic constraints
, and (b) temporal jump scores
normalized within peer groups to reduce scale effects. A sample is labeled positive
if any year violates a high-confidence threshold.To align explanations with audit practice, we do not keep SHAP at the atomic feature level. Instead, we explicitly index each feature as a triple
, where
is the module,
is the time index, and
is the atomic feature within module
. This yields a granular attribution tensor
, which we then aggregate to produce interpretable units as Equation (11).
where
represents which module at which time drove risk,
measures which time window is most suspicious, and
denotes which compliance module is the dominant source.
However, even module–time attributions can remain fragmented, producing many small peaks rather than a coherent narrative. To assemble a risk path, we build a heterogeneous temporal graph for each taxpayer
, where nodes represent module–time pairs and edges encode two kinds of structure: temporal continuity within the same module and contemporaneous coupling across modules. This graph formalizes the risk transmission intuition used by auditors when they trace inconsistencies from payroll to benefits to healthcare obligations by Equation (12).
Nodes correspond to the audit-relevant unit module at time . The edge set includes intra-module temporal edges and cross-module edges for . Temporal edges capture drift and persistence, while cross-module edges capture structural mismatch mechanisms.
We explicitly partition variables into a rule only set
and a model feature set
. We enforce:
, and any deterministic transform of rule variables including threshold indicators, binned versions, rule residuals
, jump scores
, and any features directly used to compute the proxy label is excluded from
. To ensure paths reflect taxpayer-specific dynamics rather than global averages, we parameterize edge weights with gated dependencies by Equation (13).
The quantity is a representation-level change magnitude that highlights potential structural breaks or sudden shifts in a module’s latent state. The gating entropy measures how concentrated the task routing is over experts, lower entropy means a clearer underlying mechanism, which we treat as more reliable for constructing paths. For module with raw features, let be the raw input at time , and let be a binary availability mask.