Skip to content

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

LevelGeneratedContentsSize
L0Every requestMetadata only~200 bytes
L2SampledFull 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

  1. Epoch starts (e.g., 12:00:00)
  2. Bearer tokens issued for this epoch
  3. Attestations collected
  4. Epoch ends (e.g., 13:00:00)
  5. Merkle tree finalized
  6. New epoch starts

Next Steps