Download docs/architecture.md from Heisenger/sft-benchmark-trajectories: direct link, hf CLI and curl.
- Browser
- Download file 2.99 kB
-
https://huggingface.co/datasets/Heisenger/sft-benchmark-trajectories/resolve/main/docs/architecture.md
- Command line
-
hf download hf://datasets/Heisenger/sft-benchmark-trajectories/docs/architecture.md
-
curl -L -o architecture.md https://huggingface.co/datasets/Heisenger/sft-benchmark-trajectories/resolve/main/docs/architecture.md
Architecture
The library is deliberately small and dependency-light. Canonical records use validated Python dataclasses and JSON-compatible values; source-specific logic is isolated behind adapters.
There are two adapter boundaries. Source adapters under
agent_trajectories.adapters are ingestion-time parsers for upstream benchmark
formats. CanonicalDatasetAdapter is the consumer boundary: it reads persisted
canonical shards and the SQLite metadata index, and never invokes source
adapters or downloads upstream data. Its public contract is documented in
dataset_adapter.md.
upstream record -> source adapter -> canonical Trajectory -> validation
|-> persisted shards/index
|-> consumer adapter
|-> full SFT view
|-> turn SFT view
|-> evaluation records
Boundaries
This repository owns data provenance, conversion, validation, filtering, splitting, inspection, sampling and bounded Python batching. It does not own tokenisation, chat templates, packing, truncation, environment replay, tensor collation, optimisation, or model training.
Stable identity
Adapters derive identifiers with SHA-256 from source ID, pinned revision and
upstream stable IDs. task_key identifies the underlying task across attempts;
for known overlapping suites it uses the native benchmark instance ID with a
shared family prefix.
Validation
Validation checks identifier/revision presence, event ordering, assistant-only supervision, unique event/call IDs, causal tool-result pairing, missing-field declarations, and the presence of raw provenance. Incomplete trajectories may have unresolved calls only when incompleteness is explicit.
Storage and streaming
Canonical JSONL is the interchange format. Streaming readers parse one record
at a time. The manifest-backed CanonicalDatasetAdapter uses the SQLite index
for selection and streams canonical event payloads; the smaller in-memory
TrajectoryDataset remains useful for fixtures and ad hoc collections. Large
upstream downloads belong under an external cache, never in Git.
Offline evaluation
The evaluate-actions command compares predicted assistant text and structured
tool actions with held-out assistant-turn targets. It reports exact match,
component matches, missing predictions and unexpected predictions. This is an
imitation proxy only; it is deliberately separate from online environment
success and benchmark runners.
Security
The HTML viewer is static and escapes every upstream value. It embeds no scripts, makes no network calls, and labels raw versus canonical data. Training queries and exports enforce the persisted eligibility gate and exclude evaluation-only sources.