My model scored 90%. On a temporal split, it scored 83.8%
In short: The first Chief-Sef model reached 90.1% accuracy on EMBER test data. When I split the same model design by time (training on the first ten months of 2018 and testing on the last two), it scored 83.8%. The gap came not from a bug, but from which weeks the sample was drawn from.
Context
Chief-Sef is an experimental security engine that inspects Windows executables (PE files) before they are run. The model of its first phase is a Random Forest over five static features: file size, zero-byte ratio, mean section entropy, total API count and suspicious API count. The training data is 5,700 malicious and 5,700 benign files from the EMBER 2018 dataset.
This was the third time a measurement misled me. The first model scored 99.9% on synthetic data; because the data came from five fixed scenarios, the model memorised those patterns rather than malicious behaviour. The second scored 97%; because the benign files came from a single computer, the model partly learned "is this file from this machine?". In the first two, the problem was where the data came from. The third was subtler, because this time both classes came from the same source, measured the same way; the problem was time.
What I noticed
I was collecting the sample pool from EMBER's files in order, and the code started from the alphabetically first file (test_features.jsonl). All 11,400 rows came from the first ~34 thousand records of that file, and every one of them was from November 2018. The 80% training / 20% test split happened inside that narrow window.
This is not leakage in the classic sense: the test files were not in the training set. But because they came from the same weeks, sibling samples of the same campaigns and malware families sat on both sides. The model was learning to recognise "this month", not "the future". In real life, a model only ever meets files that arrive after the day it was trained.
How I measured it
I tested the same model with the same five features in three different ways:
| Evaluation | Accuracy | AUC |
|---|---|---|
| Same period: 80% / 20% split within November 2018 | 90.1% | — |
| Same model, rest of the same file (188,600 records, Nov–Dec) | 87.4% | 0.947 |
| Temporal split: train on Jan–Oct, test on Nov–Dec | 83.8% | 0.920 |
- Same period80% / 20% split within November 201890.1%
- Rest of the same file188,600 records, November–December87.4%
- Temporal splittrain on January–October, test on November–December83.8%
As the window widens and the test data moves further in time from the training data, the number drops. The realistic number to report is the last one. A separate question, how many false alarms the model raises on legitimate files on a real computer (3.5% on 5,700 files never seen in training), is not affected by this finding.
Why it matters
Malware keeps changing: new families, new packers, new campaigns. An evaluation that takes training and test data from the same period never measures how well a model withstands that change. This is a known problem in machine learning for security: the TESSERACT study showed that experiments ignoring time can inflate results considerably, and datasets such as BODMAS are published with timestamps for exactly this reason.
What I changed
I added a rule to the project and corrected the README accordingly:
- The headline number comes from a temporal split: training on an earlier period, testing on a later one.
- If the sample is collected in file order, check which period it falls into.
- If a same-period number is reported, it sits next to the temporal one. The README now gives both.
Three questions for your own model
- Is the oldest sample in your test data newer than the newest sample in your training data?
- Did you draw your sample at random, or in the order of a file or table? If in order, which dates did it land on?
- If your score looks very good, what happens when you recompute it only on data from after the first weeks?
Transparency
I write the code for this project with AI, using Claude Code. The design of the measurements, the interpretation of the results and the decision about what to publish are mine. The scripts that ran these measurements and the detailed notes are in the Chief-Sef repository: CLAUDE.md (the measurement note and Critical Rule 6) and GELISIM_SURECI.md (both in Turkish).
References
- H. S. Anderson, P. Roth. EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models, 2018.
- F. Pendlebury et al. TESSERACT: Eliminating Experimental Bias in Malware Classification across Space and Time, USENIX Security 2019.
- L. Yang et al. BODMAS: An Open Dataset for Learning based Temporal Analysis of PE Malware, 2021.
Turan Tech