Epochs & Sampling
GLACIS organizes attestations into discrete time periods called epochs and uses sampling to balance coverage with storage.
Epochs
An epoch is a bounded time period (default: 1 hour):
interface Epoch { id: string; // e.g., 'epoch_2024010112' startTime: number; // Unix timestamp (ms) endTime: number; // Unix timestamp (ms) duration: number; // 3600000 (1 hour) attestationCount: number; merkleRoot?: string; // Set when epoch closes}Why Epochs?
- Ordering: Attestations are ordered within epochs
- Freshness: Bearer tokens expire with epochs
- Batching: Auditors can verify entire epochs
- Control: Sampling rates can vary per epoch
Sampling
L0 vs L2
| Level | Generated | Contents | Size |
|---|---|---|---|
| L0 | Every request | Metadata only | ~200 bytes |
| L2 | Sampled | Full evidence | ~2-10 KB |
Sampling Rate
sampling: { rate: 100, // 1 in 100 requests get L2}Adaptive Sampling
rules: [ // Always sample GPT-4 { condition: { field: 'model', operator: 'eq', value: 'gpt-4' }, rate: 1 }, // Higher rate for long prompts { condition: { field: 'content_length', operator: 'gt', value: 2000 }, rate: 10 },]Epoch Lifecycle
- Epoch starts (e.g., 12:00:00)
- Bearer tokens issued for this epoch
- Attestations collected
- Epoch ends (e.g., 13:00:00)
- Merkle tree finalized
- New epoch starts