> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracebloc.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Sentence-pair classification

> Dataset template for sentence-pair classification: one tab-separated sentence pair per .txt plus a labels CSV, ingest.yaml and the checks the data ingestor runs.

Label how two texts relate — entailment, paraphrase, duplicate question. Each sample is one `.txt` file holding **two sentences separated by a single tab**, plus one CSV row with the class label.

## Folder layout

```text theme={null}
/data/shared/mnli-pairs/
├── labels.csv
└── texts/
    ├── pair1.txt
    ├── pair2.txt
    └── ...
```

Each file is exactly one line of the form `text_a<TAB>text_b`, for example:

```text theme={null}
A man is playing a guitar.	A person is making music.
```

* The folder must be named `texts` and sit next to the labels CSV.
* Exactly two non-empty fields separated by one tab, on one line. Plain prose without a tab, an empty side, or several pairs in one file are rejected. The CLI checks this before it ingests anything, and the ingestor checks it again.
* UTF-8 encoded. Every file must end in `.txt`. The ingestor also accepts `.text`, but training opens only `<filename>.txt`, so a `.text` dataset ingests and then fails to train.

## Labels CSV

```csv theme={null}
filename,label
pair1,entailment
pair2,contradiction
pair3,neutral
```

| Column | Required | Meaning |
| - | - | - |
| `filename` | yes, exactly this name | The text file, with or without extension. |
| `label` | yes | The class of the pair. Any column name works — set it with `label:`. At least two distinct classes are required. |
| `extension` | no | Present in the shipped sample; not read by the ingestor. |

Do not declare the label column or a [reserved column name](https://docs.tracebloc.io/create-use-case/templates.md#rules-that-apply-to-every-csv) (such as `filename` or `extension`) in `schema`.

## Ingest with the CLI

Each split is one folder laid out as above. Ingest the training and the test split separately:

```bash theme={null}
tracebloc data ingest ./mnli-pairs-train --task sentence_pair_classification --name mnli_pairs_train --intent train --label-column label --holds open_data
tracebloc data ingest ./mnli-pairs-test  --task sentence_pair_classification --name mnli_pairs_test  --intent test  --label-column label --holds open_data
```

`--holds open_data` marks the dataset as open data. If your data is about patients, pass `--holds patient_data`; if it was generated, pass `--holds synthetic_data`. Leave `--holds` out on a terminal and the CLI asks; in a script, the dataset is marked as patient data. The mark decides which [use case types](https://docs.tracebloc.io/create-use-case/define.md#step-2-data-&-evaluation) you can create on the dataset.

`--label-column` is required for this task. Set it to the name of the label column in `labels.csv`. On a terminal, `tracebloc data ingest <path>` works the task out from the folder; see [Guided ingest](https://docs.tracebloc.io/environment-setup/cli.md#guided-ingest). In a script (`--no-input`, `--output-json` or no terminal), leaving it out sends an empty label, and the spec fails validation before anything is ingested.

## ingest.yaml

```yaml theme={null}
apiVersion: tracebloc.io/v1
kind: IngestConfig
category: sentence_pair_classification
table: mnli_sentence_pairs_train
intent: train
csv: /data/shared/mnli-pairs/labels.csv
texts: /data/shared/mnli-pairs/texts/
label: label
```

| Field | Required | Meaning |
| - | - | - |
| `csv` | yes | Path to the labels CSV. |
| `texts` | yes | The `texts/` folder. |
| `label` | yes | Name of the class column. |
| `schema` | no | Extra typed columns only. |
| `spec.file_options.extension` | no | Leave it unset. The default `.txt` is the only extension training reads. |
| `language`, `normalization` | no | Dataset language and applied normalization. |

## What the ingestor checks

| Check | Rejects |
| - | - |
| File type | Files under `texts/` with a different extension than configured, or mixed extensions. |
| Text content | NUL bytes or invalid UTF-8; empty files produce a warning. |
| Sentence pair | A referenced file that is missing, spans several lines, has a field count other than 2, or has an empty field. |
| Label column | A CSV whose header has no column matching `label:`. |
| Data types | With a `schema`: values that do not match their declared type. |
| Label diversity | Fewer than two distinct label values. |

Plus the [checks every ingest runs](https://docs.tracebloc.io/create-use-case/templates.md#checks-every-ingest-runs).

## Sample dataset

The template ships five sentence pairs labelled `entailment`, `contradiction` and `neutral`. The manifest ships as `labels_file_sample.csv`: rename it to `labels.csv` before you ingest the folder, because the CLI reads only that name. For the Helm chart, stage the renamed folder so that it matches the paths in the `ingest.yaml` above.

## Score formulas

When you [define a use case](https://docs.tracebloc.io/create-use-case/define.md#supported-metrics-per-data-type-and-task) on this data, the platform currently accepts **Accuracy** only.

## Next steps

* Ingest the data: [Prepare Data](https://docs.tracebloc.io/create-use-case/prepare-dataset.md)
* Shared rules for every template: [Dataset templates](https://docs.tracebloc.io/create-use-case/templates.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.