# LAFC-Evict: counterfactual labels for learning-augmented cache eviction

## Facts

- Provider: Soroush Vahidi
- License: Mixed per trace family (see LICENSE): wiki2018 CC0-1.0, twemcache and cloudphysics (Alibaba block) CC-BY-4.0, metacdn and metakv Apache-2.0
- Size: 176 objects, 2,979,520,992 bytes (2.77 GiB) under v1.0/, listed with aws s3 ls --recursive
- Records: 277,995,072 candidate rows (sum of parquet footer num_rows over all 168 files, equals release_manifest.json); 2,363,286 decision_view rows; 1,000,000 pairwise rows. Per family
- Format: Parquet (in sampled files)
- Stored at: Amazon S3, s3://lafc-evict-open-data/v1.0 (us-west-2)
- Access: public, readable without an account
- Category: Machine Learning & AI
- Source: https://registry.opendata.aws/lafc-evict/
- Page: https://scigantic.com/archive/55e2dc8b-c026-5a13-8600-a556756412ed
- Keywords: Machine Learning & AI, AWS Open Data

## About

A derived tabular dataset of counterfactual supervision labels for cache-eviction research. Each row is one candidate object at one full-cache-miss decision point, with engineered state and candidate features and labels for how the miss rate would change over a short horizon if that candidate were evicted. Release v1.0 (under v1.0/ in the lafc-evict-open-data bucket, us-west-2) covers five trace families (cloudphysics, metacdn, metakv, twemcache, wiki2018) with 277,995,072 candidate rows, 2,363,286 decision-view rows and a 1,000,000-row pairwise sample, as Parquet. Historical v0.3 objects remain at the bucket root. Note: v1.0 is multi-licensed by trace family, not CC0 as a whole. Splits: train/val/test (metacdn has no test partition). Capacities 32, 64, 128, 256; horizons 4, 8, 16. The bucket-root v0.3 objects are outside the v1.0/ mount. wiki2018 labels are constant within every decision, so it carries no supervision signal.

## Load the data

```python
# Task: per-decision regret of the LRU victim vs the best candidate, one family, one config
import os
import pyarrow.parquet as pq
ROOT = os.path.expanduser("~/archive")   # mount root is the bucket prefix v1.0/
pat = os.path.join(ROOT, "data/candidate_rows/split=val/trace_family=twemcache/capacity=64/horizon=8/candidate_rows.parquet")
cols = ["decision_id", "y_loss", "candidate_is_lru_victim", "candidate_recency_rank"]
t = pq.read_table(pat, columns=cols).to_pandas()          # ~0.2M rows here, ok; check num_rows first for big files
print(len(t), "rows,", t.decision_id.nunique(), "decisions")
g = t.groupby("decision_id")
lru = t[t.candidate_is_lru_victim == 1].set_index("decision_id").y_loss
mn = g.y_loss.min()
mean = g.y_loss.mean()
print("mean y_loss: lru victim %.3f, uniform random %.3f, oracle %.3f" % (lru.mean(), mean.mean(), mn.mean()))
print("decisions where candidates differ:", round(float((g.y_loss.max() > mn).mean()), 3))
```

Written for a Scigantic notebook, where /mnt/archive (SCIGANTIC_MOUNT_PATH) is the mounted dataset.

## Data structure

File types in sampled files: Parquet

| Field | Type |
| --- | --- |
| `decision_id` | string (large_string in wiki2018 files). Format '<trace_name>\|cap=<capacity>\|t=<decision_t>'. NOT unique across… |
| `trace_name / trace_family / dataset_source` | string, constant per file. One trace per family: wiki2018_pageviews_en_50k, cloudphysics_alibaba_block_head_50k… |
| `capacity, horizon` | int64, capacity in {32,64,128,256}, horizon in {4,8,16}. Equal to the folder names; each decision has exactly capacity… |
| `decision_t, decision_chunk_id` | int64. decision_t is the request index in a 50k-request trace (range 32..49999); decision_chunk_id = decision_t // 4096… |
| `candidate_page_id` | string object key of the resident object. wiki2018: 'obj_' + 24 hex (pseudonymized). cloudphysics and metakv: numeric… |
| `split` | string in {train,val,test}; identical to the split= folder. |
| `y_loss` | double, integer-valued 0..horizon. Number of cache misses in the next `horizon` requests if this candidate is evicted… |
| `y_value` | double, exactly -y_loss (checked on all rows of sampled files and asserted by the release validator). |
| `candidate_recency_rank, candidate_age_norm, candidate_lru_score` | double. recency_rank 0 is the LRU victim (oldest), capacity-1 the most recent; age_norm = rank/(capacity-1) in [0,1]… |
| `candidate_is_lru_victim, candidate_is_predictor_victim, predictor_lru_disagree` | double 0/1 flags (not bool). Exactly one candidate per decision has candidate_is_lru_victim=1 (checked per decision in… |
| `recent_candidate_request_rate, recent_candidate_hit_rate` | double in [0,1] (observed max 0.984375 = 63/64 for metacdn). The only per-candidate features that vary beyond recency.… |
| `request_bucket, request_confidence, candidate_bucket, candidate_confidence, cand` | double. In the cap=64/horizon=8 train file of every family, 18 to 20 of these are CONSTANT (buckets 0, confidences 0.5… |
| `decision_view: candidate_count, min_y_loss, max_y_value, optimal_candidate_page_` | decision_view.parquet has 19 columns: trace_name, trace_family, dataset_source, capacity, horizon, decision_id… |
| `pairwise_sample columns` | 17 columns: trace_name, trace_family, dataset_source, capacity, horizon, decision_id, decision_t, decision_chunk_id… |

Files:

```text
The mount root is the bucket prefix v1.0/ of s3://lafc-evict-open-data (us-west-2), so everything below is relative to ~/archive. The bucket root holds a separate, older v0.3 release (data/cross_family_evict_value_v1.parquet, data/objective_ablation_scalar.parquet, checksums/, docs/, examples/get-to-know-a-dataset.ipynb, manifests/release_manifest.json, metadata/schema.json, statistics.json, CITATION.cff, a different README.md and LICENSE); those objects are OUTSIDE the mount and cannot be opened from ~/archive. Inside the mount:
~/archive/
  LICENSE                      multi-license table by trace family (no single SPDX)
  README.md                    3.3 KiB release note
  metadata/{release_manifest.json, checksums.sha256, validation_report.md, CITATION.cff}
  data/candidate_rows/split={train,val,test}/trace_family={cloudphysics,metacdn,metakv,twemcache,wiki2018}/capacity={32,64,128,256}/horizon={4,8,16}/candidate_rows.parquet   (168 files, 1.16 GB)
  data/decision_view/decision_view.parquet      (1 file, 1.80 GB, 2,363,286 rows)
  data/pairwise_sample/pairwise_sample.parquet  (1 file, 17.5 MB, 1,000,000 rows)
There is no docs/, examples/ or manifests/ directory inside the mount. Hive-style partition folders, but split, trace_family, capacity and horizon are ALSO stored as ordinary columns inside every file. 14 of 15 (split, family) combinations exist: metacdn has no test partition, so test has 48 files and train and val have 60 each.
```

Example file: `data/candidate_rows/split=val/trace_family=metacdn/capacity=64/horizon=8/candidate_rows.parquet: 733,504 rows, 6 row groups, 34 columns; one row per resident cache object at one full-cache-miss decision, labelled with the number of misses over the next 8 requests if that object were evicted.`

## Open it

- In a hosted notebook with the data mounted: https://scigantic.com/archive/55e2dc8b-c026-5a13-8600-a556756412ed
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/55e2dc8b-c026-5a13-8600-a556756412ed
- Over MCP: `get_schema_card` with id `55e2dc8b-c026-5a13-8600-a556756412ed` at https://api.scigantic.com/mcp

## Related topics

- [Machine Learning & AI datasets](https://scigantic.com/topics/machine-learning-and-ai)
