  Earthquakes are major hazards to humans, buildings and infrastructure. Early
warning methods aim to provide advance notice of incoming strong shaking to
enable preventive action and mitigate seismic risk. Their usefulness depends on
accuracy, the relation between true, missed and false alerts, and timeliness,
the time between a warning and the arrival of strong shaking. Current
approaches suffer from apparent aleatoric uncertainties due to simplified
modelling or short warning times. Here we propose a novel early warning method,
the deep-learning based transformer earthquake alerting model (TEAM), to
mitigate these limitations. TEAM analyzes raw, strong motion waveforms of an
arbitrary number of stations at arbitrary locations in real-time, making it
easily adaptable to changing seismic networks and warning targets. We evaluate
TEAM on two regions with high seismic hazard, Japan and Italy, that are
complementary in their seismicity. On both datasets TEAM outperforms existing
early warning methods considerably, offering accurate and timely warnings.
Using domain adaptation, TEAM even provides reliable alerts for events larger
than any in the training data, a property of highest importance as records from
very large events are rare in many regions.
