Choosing Data Formats for ML Workloads
This lesson explains how a dataset's file format affects how fast it can be read, how much querying costs and which algorithms and services accept it, and how to match the format to the access pattern.
Learning outcomes
After completing this lesson, you will be able to:
- Use CSV, JSON and JSON Lines correctly, including label column placement.
- Explain when columnar formats such as Parquet and ORC are faster and cheaper.
- Identify ML-specific formats such as RecordIO-protobuf.
Row formats: CSV, JSON and JSON Lines
CSV is the simplest tabular format and is accepted by most SageMaker AI built-in algorithms. For supervised training with built-in algorithms, the target is usually the first column and the file has no header row. CSV has no schema or types, so data types must be inferred and commas inside values must be quoted.
JSON represents nested records, such as an order with line items. JSON Lines (JSONL) places one JSON object on each line, which makes the file easy to split and stream. JSONL is the required format for Amazon Bedrock model customisation datasets and Bedrock batch inference input, and it is common for SageMaker AI batch transform and Ground Truth manifests.
Columnar formats: Parquet and ORC
Apache Parquet and Apache ORC store values column by column with compression and embedded statistics. A query or feature extraction job that needs five columns out of two hundred reads only those five, and readers can skip blocks whose statistics exclude a filter. This makes columnar formats far cheaper and faster for analytics with Athena, Glue and EMR. Parquet is the most widely supported and is accepted by several built-in algorithms and by SageMaker Feature Store offline queries.
The following diagram compares what a feature query reads from clickstream data stored as gzip JSON and as partitioned Parquet.

Row or columnar?
ML-specific formats
RecordIO-protobuf is the optimised format for many SageMaker AI built-in algorithms such as Linear Learner, Factorization Machines and K-Means, and works well with Pipe mode, which streams data to the algorithm. Deep learning frameworks have their own sharded formats, such as TFRecord for TensorFlow. Images are stored as JPEG or PNG files with a manifest that lists each file and its label, and audio as WAV or FLAC.
The following table summarises when each format fits.
| Format | Strength | Typical use |
|---|---|---|
| CSV | Simple, universal | Built-in algorithm input, small exports |
| JSON / JSONL | Nested records, line-splittable | Bedrock fine-tuning and batch inference, manifests |
| Parquet / ORC | Columnar, compressed, statistics | Large analytic datasets, feature extraction |
| RecordIO-protobuf | Optimised for built-in algorithms | Pipe mode training |
| TFRecord | Sharded binary records | TensorFlow training at scale |
| JPEG/PNG + manifest | Images with labels | Computer vision training |
Formats for ML tools
Converting clickstream data
Raw clickstream events arrive as gzip JSON files totalling 2 TB per month. Data scientists extract six fields out of eighty to build features, and their Athena queries scan the full dataset each time.
-- Athena CTAS: rewrite raw JSON as partitioned Parquet once
CREATE TABLE clicks_parquet
WITH (format = 'PARQUET', parquet_compression = 'SNAPPY',
partitioned_by = ARRAY['event_date'])
AS SELECT user_id, session_id, page, action, device, event_ts, event_date
FROM clicks_raw_json;Each query now reads only the selected columns and partitions. Scanning six of eighty columns in compressed Parquet typically cuts the bytes read by more than 90%, which lowers Athena cost and speeds up feature jobs. JSON remains suitable for the raw landing zone, where records are written once and kept for replay.
Which format do Bedrock fine-tuning and batch inference use?
Show answer
JSONL, with one JSON record per line.
Exam Tips
Remember for the exam
- Reading a few columns of large tables: Parquet or ORC.
- Bedrock fine-tuning and batch inference: JSONL.
- Built-in algorithms in Pipe mode: RecordIO-protobuf.
- Built-in algorithm CSV input: target first, no header.
- Convert raw JSON to partitioned Parquet once to cut query cost.