Inferensys

Glossary

Time-Decay Function

A mathematical function that assigns exponentially or inversely decreasing weights to older observations in a sequence, reflecting the intuition that recent transactions are more indicative of current behavior than older ones.
Legal team reviewing EU AI Act compliance documents on laptop in modern office, coffee cups and papers on table, casual meeting.
Temporal Weighting Mechanism

What is Time-Decay Function?

A mathematical function that assigns decreasing importance to observations as they recede into the past, operationalizing the principle that recent behavior is more predictive of future actions than historical data.

A time-decay function is a mathematical weighting scheme that systematically reduces the influence of older data points in a sequence while amplifying the importance of recent observations. In fraud detection, this function is applied to transaction histories to ensure that a user's most recent spending patterns, locations, and merchant preferences dominate the behavioral profile, while activity from months ago exerts minimal influence on the current anomaly score. Common formulations include exponential decay, where weights decrease by a constant factor per time step, and inverse decay, where weight is inversely proportional to age.

The core rationale is that customer behavior and fraud tactics are non-stationary; a legitimate user's relocation or a fraudster's evolving methodology renders historical data less relevant. By integrating a time-decay function into feature engineering or directly into the loss function of a sequence model, the system becomes more responsive to concept drift. This prevents model stagnation, reduces false positives triggered by outdated normal baselines, and enables the rapid detection of newly emerging fraud patterns that would otherwise be diluted in a uniformly weighted historical average.

TEMPORAL WEIGHTING MECHANICS

Key Characteristics of Time-Decay Functions

Time-decay functions are mathematical formalisms that systematically reduce the influence of older observations in a sequence. By assigning higher weights to recent events, they encode the principle that current behavior is best predicted by the immediate past—a critical assumption in dynamic fraud environments where criminal tactics evolve rapidly.

01

Exponential Decay Formulation

The most common parametric form, expressed as w(t) = e^(-λt), where λ (lambda) controls the decay rate. A larger λ causes weights to diminish more aggressively, creating a shorter 'memory' horizon. This formulation ensures that the influence of a transaction halves over a consistent time period, known as the half-life. In fraud systems, the half-life is a tunable hyperparameter calibrated to match the velocity of legitimate user behavior changes versus adversarial adaptation speeds.

02

Inverse Time Weighting

A polynomial alternative defined as w(t) = 1 / (1 + k*t). Unlike exponential decay, this function exhibits a heavier tail, meaning very old observations retain non-negligible influence for longer. This is useful when modeling long-term baseline behaviors that should not be entirely forgotten, such as a user's stable annual spending patterns. The parameter k adjusts the steepness of the initial drop-off without fully extinguishing historical signal.

03

Windowing and Truncation

Practical implementations often combine a decay function with a hard temporal window to bound computational cost. Weights for events older than a cutoff threshold are explicitly set to zero. This creates a finite receptive field for sequence models. Common strategies include:

  • Sliding windows: Fixed-length lookback (e.g., 90 days)
  • Landmark windows: All data since a significant event (e.g., password reset)
  • Fading windows: Weights decay to zero at the boundary, ensuring smooth transitions
04

Application in Feature Engineering

Time-decay functions transform raw event streams into weighted aggregate features for downstream classifiers. Instead of simple counts, features become decay-weighted sums. For example, a decay-weighted transaction count gives full weight to today's transaction, half weight to yesterday's, and near-zero weight to last month's. This captures recency-sensitive velocity—a sudden burst of activity today will dominate the feature value, triggering anomaly scores even if the raw monthly total appears normal.

05

Decay in Sequence Model Attention

Modern architectures like the Temporal Fusion Transformer and Mamba incorporate learned or structural time-decay directly into their attention or state-space mechanisms. Rather than a fixed exponential function, these models learn input-dependent decay rates. A transaction from a known compromised merchant might be assigned a slower decay, retaining its relevance longer, while a routine login fades quickly. This adaptive temporal weighting allows the model to dynamically modulate its memory horizon based on event significance.

06

Calibration Against Concept Drift

The decay rate λ is a direct lever for managing temporal bias-variance tradeoff. A fast decay (high λ) creates a model highly responsive to new fraud patterns but prone to noise and false positives. A slow decay (low λ) provides stability but risks concept drift blindness, where the model fails to adapt to shifting criminal tactics. Optimal calibration often involves monitoring the half-life of predictive power—the period over which historical features remain statistically significant for predicting current fraud labels.

TIME-DECAY FUNCTION

Frequently Asked Questions

Explore the mathematical foundations and practical applications of time-decay functions in financial fraud detection, covering how they weight recent behavior more heavily to improve anomaly sensitivity.

A time-decay function is a mathematical formula that assigns exponentially or inversely decreasing weights to older observations in a temporal sequence, ensuring that recent data points exert greater influence on a model's current state or prediction. The core mechanism involves multiplying each observation by a decay factor ( \lambda ) (where ( 0 < \lambda < 1 )) raised to the power of its age. For a transaction occurring ( t ) time steps ago, its weight is ( w_t = \lambda^t ). This directly operationalizes the intuition that a user's most recent transactions are far more indicative of their current behavioral intent than those from months prior. In temporal transaction modeling, this function is applied to feature aggregation windows, exponentially weighted moving averages (EWMA), and the loss functions of recurrent neural networks to prioritize learning from recent patterns. The decay rate ( \lambda ) is a critical hyperparameter: a value close to 1 creates a slow, gradual decay suitable for stable user profiles, while a value near 0 creates a sharp decay ideal for detecting rapid behavioral shifts indicative of account takeover.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.