AI-Assisted Multi-Reference Timekeeping for Commodity Networks
This repository contains the reference implementation and reproducibility artifacts for the paper:
An AI-Assisted Multi-Reference Timekeeping Architecture for Commodity Networks
π€ Riaan de Beer
π Zenodo DOI: https://zenodo.org/records/18366050
This project explores a low-cost, AI-assisted approach to time synchronization that synthesizes a virtual master clock from multiple imperfect timing references (e.g., GNSS π, PTP π, NTP π) using classical estimation techniques augmented with lightweight machine learning π€.
The goal is to improve practical packet-level synchronization on commodity hardware β without requiring atomic clocks βοΈ or specialized time cards.
This project is grounded in Relativistic Temporal Logic and Distributed Systems Theory. We move beyond standard linear timekeeping to provide a multi-reference framework designed for the next generation of AI agents.
-
Theory & Proofs: For a deep dive into the mathematical transforms, dilation matrices, and causal manifolds, please see: π RESEARCH.md π
-
Academic Citation: If you are using this framework for peer-reviewed research, please refer to the Citation section below.
We have formalized the mechanics of Computational Dilation and Temporal Anchoring. To explore the underlying physics and math of this implementation, check out our Research Paper Summary.
This project formalizes timekeeping by treating temporal progression as a relativistic coordinate system. Instead of a single linear clock, we define a Temporal State Vector where time is mapped across multiple reference frames.
Each reference frame
Where:
-
$t_{0,i}$ : The Temporal Anchor (epoch offset). -
$\phi_i$ : The Dilation Factor (relative clock speed). -
$\chi_i(t)$ : The Drift Function (stochastic or systemic error).
To map Master Time (
To translate directly between two non-master frames (Frame
This allows the system to determine the Relative Temporal Velocity (
In scenarios where processing speed varies (e.g., high-inference loads or hardware throttling),
High-precision time synchronization is increasingly important for distributed systems, including:
- β±οΈ Time-sensitive networking (TSN)
- πΎ Coordinated I/O and storage pipelines
- π¦ Packet scheduling and timestamping
- π§ͺ Experimental distributed systems research
Commercial solutions typically rely on atomic oscillators and dedicated PCIe time cards, which remain costly and inaccessible to many researchers and open-source projects.
This work investigates whether intelligent multi-reference fusion, combined with lightweight local learning, can narrow the gap for practical synchronization tasks using commodity hardware.
- π Fuses multiple heterogeneous timing references into a single virtual clock
- π Combines a state-space clock model with a lightweight neural network
- π Adapts reference weighting based on observed jitter, stability, and context
- π Exposes time via standard mechanisms (PTP, PHC, NTP)
- β»οΈ Targets reproducibility using open-source tools and Google Colab notebooks
The repository now includes a time server scaffold in src/ai_multi_reference_timekeeping/time_server.py
that lets you:
- π§© Plug in sensor inputs (temperature, humidity, pressure, AC hum, SDR SNR, Geiger CPM, audio activity)
- π‘ Collect references over NTP, GPS NMEA, or the hardware RTC (via
hwclock) - π Listen from GPIO/USB/serial by wiring sensors with
GpioPulseSensor,SerialLineSensor, oropen_line_source - π§ Adjust reference variance using a lightweight inference model
- π Estimate drift and slew from recent offsets
Example usage:
from ai_multi_reference_timekeeping.fusion import ReferenceFusion, VirtualClock
from ai_multi_reference_timekeeping.kalman import ClockCovariance, ClockKalmanFilter, ClockState
from ai_multi_reference_timekeeping.time_server import (
LightweightInferenceModel,
NtpReference,
SensorAggregator,
TimeServer,
)
kalman = ClockKalmanFilter(
state=ClockState(offset=0.0, drift=0.0),
covariance=ClockCovariance(p00=1.0, p01=0.0, p10=0.0, p11=1.0),
process_noise_offset=1e-4,
process_noise_drift=1e-6,
)
clock = VirtualClock(kalman_filter=kalman, fusion=ReferenceFusion())
class EnvSensor:
def sample(self) -> dict[str, float]:
return {"temperature_c": 27.0, "humidity_pct": 40.0}
server = TimeServer(
clock=clock,
references=[NtpReference(name="nist")],
sensors=SensorAggregator(EnvSensor()),
inference=LightweightInferenceModel(),
)
update, frame, drift_estimate, drift_hint = server.step(dt=1.0)
print(update.fused_offset, drift_estimate.drift, drift_hint)This project explicitly does not aim to:
- β Replace atomic clocks or high-stability oscillators
- β Provide nanosecond-level absolute UTC accuracy under all conditions
- β Serve as a primary time standard
- β Offer cryptographic guarantees against fully adversarial time manipulation
The system prioritizes robustness, accessibility, and cost-effectiveness for packet-level synchronization in experimental and operational environments.
ai-multi-reference-timekeeping/
βββ paper/ # π LaTeX source and figures for the paper
βββ notebooks/ # π Google Colabβfriendly notebooks
βββ src/ # π§© Fusion, ML, and evaluation code
βββ data/ # ποΈ Example and processed datasets
βββ models/ # π§ Trained and baseline models
βββ configs/ # βοΈ Configuration files
βββ scripts/ # π οΈ CLI utilities
βββ reproducibility/ # π Experimental protocols and hardware notes
βββ environment/ # π¦ Dependency specifications
βββ LICENSE
βββ README.md
The notebooks in notebooks/ are designed to run directly in Google Colab β no specialized hardware required.
π° Recommended entry point:
β Notebook test runs:
notebooks/10_test_fusion.ipynbβ validates fusion and quality weighting
notebooks/11_test_time_server.ipynbβ validates time server + ML variance model
Each notebook includes an Open in Colab link and installs dependencies automatically.
The evaluation framework focuses on standard timing metrics, including:
- β²οΈ Time Deviation (TDEV)
- π Maximum Time Interval Error (MTIE)
- π PTP offset stability
- π°οΈ Holdover behavior during reference loss
Absolute UTC ground truth is not required for most experiments.
The system is designed to tolerate noisy, intermittent, and partially unreliable timing sources.
It does not assume a fully adversarial environment.
Considered threats include:
- π‘ GNSS degradation, multipath, and interference
- π Network-induced delay asymmetry
β οΈ Transient reference instability
Coordinated compromise of all timing references is considered out of scope.
This project is licensed under the Apache License 2.0.
See the LICENSE file for details.
If you use this work, please cite:
@misc{debeer2026aimrt,
title = {An AI-Assisted Multi-Reference Timekeeping Architecture for Commodity Networks},
author = {de Beer, Riaan},
year = {2026},
doi = {10.5281/zenodo.XXXXXXX}
}
This repository accompanies a research paper and is intended to evolve.
Contributions, discussion, and replication studies are welcome π€.
This work builds on established research in time metrology, clock ensembles, and IEEE 1588 Precision Time Protocol, and aims to make these ideas more accessible to open-source and experimental systems communities.