on-request-metrics.md
| source_path | references/dataset-quality/references/on-request-metrics.md |
|---|---|
| source_sha256 | f37d798a7d75cabbf99d6e7435ce60c0ee2b3afdb295288af064e97306eeca01 |
| source_url | https://github.com/aws/agent-toolkit-for-aws/blob/903433d67cc4eeab334355620373f33a0c162dd4/skills/core-skills/aws-ai-ml/references/dataset-quality/references/on-request-metrics.md |
| supporting_skill_id | 40202 |
| upstream_revision | 903433d67cc4eeab334355620373f33a0c162dd4 |
On-Request Metrics
The five metric families that are never in the default set and run only when the user asks for one, each with its section below: data filters (urls_filter, mojibake_filter, alphanumeric_filter, char_repetition_filter, character_length_filter, average_line_length_filter, word_repetition_filter), duplicate detection (exact_dedup, fuzzy_dedup), language detection (language_detection), PII detection (pii_detection) and dataset composition (taxonomy, us-east-1 only). This list is the one place the other pages point to for the families on request; they carry no copy of it. Each is one Operations entry (dataset-service-api.md), added next to default_metrics or on its own. This file is the home of each family's View Role, parameters, cost and limits; the default-set metrics are supported-metrics.md, and which default set runs on which format is format-metric-mapping.md. Role names are case-sensitive.
Data Filters (Role Text, one column)
| Metric | Output | What it measures | Params |
|---|---|---|---|
| urls_filter | both | Detects URLs in records | filter_porn_urls (bool, default true), max_url_to_text_ratio (number, default 0.2) |
| mojibake_filter | both | Detects encoding errors | max_badness (number, default 1), max_mojibake_ratio (number, default 0.05) |
| alphanumeric_filter | both | Checks alphanumeric content ratio | min_alnum_ratio (number, default 0.25), max_alnum_ratio (number, no default) |
| char_repetition_filter | both | Detects character repetition | n (int, default 10), min_char_repetition_ratio (number, default 0.0), max_char_repetition_ratio (number, default 0.5) |
| character_length_filter | both | Filters by character length | min_length (int, default 50), max_length (int or null, default null) |
| average_line_length_filter | both | Checks average line length | min_avg_line_length (number, default 10), max_avg_line_length (number or null, default null), min_lines (int, default 2) |
| word_repetition_filter | both | Detects word-level repetition | n (int, default 10), min_word_repetition_ratio (number, default 0.0), max_word_repetition_ratio (number, default 0.5) |
Duplicate Detection (Role Text, one column)
These run in the same Operations list, the same job, and the same quality_report.json as any other metric, alone or alongside a scorecard. Neither drops rows: every row comes back with a decision. The deduplication sub-reference (deduplication/overview.md) owns their interpretation (duplicate groups); read its references/result-interpretation.md whenever they ran.
| Metric | Output | What it measures | Params |
|---|---|---|---|
| exact_dedup | both | Byte-identical (optionally normalized) duplicates; per-row flagged, reason, representative_row_id |
Normalize (bool, default false) |
| fuzzy_dedup | both | MinHash near-duplicates on word 5-grams; same per-row decisions | JaccardThreshold (0–1, default 0.7), Lowercase (bool, default true) |
Language Detection (Role Text, one column)
Runs in the same Operations list and job as any other metric, at no Bedrock cost, and is not in the default set. It classifies one flat text column per row with the FastText lid.176 model and never drops rows: language_detection_flagged marks exactly the rows the dataset-transformation LanguageFilter operator would drop under the same languages, min_score, and column. Always bind it with an explicit View ({"Role": "Text", "Column": "<col>"}) on a top-level column holding plain strings. It cannot read messages / conversations or any nested value, including on recognized chat formats; materialize a flat text column first (dataset-transformation).
| Metric | Output | What it measures | Params |
|---|---|---|---|
| language_detection | both | Detected language per row (lang, lang_score, language_detection_flagged; written as dq_lang__<col>, dq_lang_score__<col>, dq_language_detection_flagged__<col>, an exception to dq_<metric>__<col>, see output-schema.md) + language mix and would-be-rejected share |
languages (list of lowercase lid.176 codes; optional allowlist), min_score (0–1, default 0 = off) |
languages: non-empty, no repeats, lowercase codes exactly as lid.176 emits them (mostly ISO 639-1 such asen,fr; also codes such asast,ceb; 176 in all). Uppercase, unsupported, andunknowncodes are rejected at submit. Omit it for no allowlist.min_score: rows scoring below it are flagged; a row scoring exactlymin_scoreis not, matchingLanguageFilter;0disables the threshold.lang_scoreis a FastText confidence, not a calibrated probability.- Undetected rows (null, empty, whitespace-only, or non-string cells) get
lang=unknown,lang_score=0, and are always flagged, even with neither parameter set. - Aggregate:
evaluated_count,sampled,language_counts(always includesunknown),language_fractions,unknown_count,low_confidence_count(detected rows belowmin_score, or below 0.5 whenmin_scoreis unset or 0; a count, not a separate flag: these rows can also be inrejected_count, always whenmin_score> 0, so never add the two),rejected_count,rejected_fraction(rows flagged / evaluated).
PII Detection (Role Messages, or Role Text on one or more columns)
This section is the home of the pii_detection contract; other files point here.
- Availability. Not in the default set: add it to the
Operationslist on request. - What it does. Scans each row's bound column or columns for PII with a Bedrock model (the service's PII entity taxonomy) and only annotates: no row is changed, redacted, or dropped. Detected values and offsets are never written, but
record_level/evaluated_data.jsonlholds the original rows, PII included: when reporting, give counts, entity types, and row ids, and never quote a row's text or a PII value; if the user asks to see such rows, warn that they hold PII first. To redact or drop, activate dataset-transformation and ask for PiiRedaction on each flagged column. - Cost and sampling. It runs in the same
Operationslist and job as any other metric, and every checked row is a Bedrock call. It checks every row unless itsConfigsetsDownSampleRecordCount, which checks a seeded random sample of that many rows instead; offer a sample only when the dataset is over a full-scan limit (Limits) or the user asks for one; the report's aggregate says what it did:evaluated_countandtotal_records,sampledtrue or false, and asamplingblock when a sample was taken. Every count and rate then describes the rows it evaluated. - Binding. Always an explicit View, on every format: one
{"Role": "Messages", "Column": "<col>"}for a chat column holding each row's turn list (ChatMLrole/contentor ShareGPTfrom/value), or one or more{"Role": "Text", "Column": "<col>"}for flat text columns. Several text columns are checked together, one request per row, and each gets its own result (its own row columns and report entry). It never default-binds. No View, or both Roles, fails the job. A job includespii_detectionat most once: bind every text column to check in its one View. - Params.
DownSampleRecordCount(optional): an integer from 1 to 300,000, the number of randomly sampled rows to check; every bound column is checked on the same rows. Leave it out to check every row. Any key besidesViewandDownSampleRecordCountin itsConfigis rejected at submit. - Limits. When the service reports a different limit, its message wins.
- Full scan. A full scan (no
DownSampleRecordCount) is limited to 0.5 GB of input and 300,000 records: a larger dataset fails before any row is checked. Over 0.5 GB, the job fails before it starts and itsFailureReasonnames the limit; over 300,000 records, it fails after the dataset loads, and the limit is named in the job's log (itsFailureReasonis the generic client error). Compare the dataset with both before submitting, without downloading it: the size is theContentLengthofaws s3api head-object, and the record count comes from § How to count oftraining-volume-requirements.md. When it is over either, offer a sample (DownSampleRecordCount), a split into smaller datasets (dataset-transformation's split,dataset-transformation/references/op_split.md), or leavingpii_detectionout. - Per row. A row whose scannable text, all bound columns together, is over 200,000 characters is not sent (
unverifiedon every bound column, counted inoversize_count). - Redaction.
PiiRedactiondoes not fully scan a text value, or a conversation's JSON, over 40,000 characters, and a redact or drop run drops such a row. That limit is lower than the per-row one, so a row the dataset quality evaluation job checked can still be dropped by a redact or drop run. - Budget and deadline. A per-job request budget and a 10-hour deadline bound the run: rows left when the budget runs out are
unverifiedandbudget_exhaustedis true; reaching the deadline fails the job.
- Full scan. A full scan (no
| Metric | Output | What it measures | Params |
|---|---|---|---|
| pii_detection | both | Per row: pii_flagged, pii_types, pii_status (written as dq_pii_flagged__<col>, dq_pii_types__<col>, dq_pii_status__<col>, see output-schema.md) + share of rows with PII and rows per entity type |
DownSampleRecordCount (optional) |
pii_status:clean(examined in full, no PII),pii_found,pii_found_incomplete(PII found, but part of the row was not examined, sopii_typesmay be incomplete),unverified(not fully checked: no usable model answer, budget spent, row over the size cap, or a value the model named that could not be located in the text),unscannable(a turn shape, key, or value the detector does not read, including tool-call identifiers),empty(nothing to examine),malformed(null or missing cell, invalid UTF-8, or not a conversation).pii_flaggedis true exactly forpii_foundandpii_found_incomplete.pii_types: comma-separated, sorted entity types found in the row (for exampleEMAIL,SSN;UNKfor a label outside the taxonomy), empty when none. The entity types are the service's PII entity types, the same set the PiiRedaction operator uses.- Aggregate:
evaluated_count,total_records,sampled,assessed_count(rows with a verdict:clean,pii_found,pii_found_incomplete),pii_row_count,pii_row_rate(pii_row_count/assessed_count; null when nothing was assessed),pii_row_rate_ci(Wilson 95% interval),pii_type_counts(rows per entity type; a row holding several types counts under each, so the counts can sum to more thanpii_row_count),unverified_count(includes thepii_found_incompleterows, so it overlapspii_row_countbypii_found_incomplete_count; never add the two),pii_found_incomplete_count,oversize_count,unscannable_count,empty_count,malformed_count,num_requests,budget_exhausted.
Dataset Composition (Role Text, one column; us-east-1 only)
Runs in the same Operations list and job as any other metric, but only in us-east-1 and at Bedrock cost: it embeds every row with a Nova model served only there and labels the tree with a foundation model through Bedrock. It is therefore not in the default set and is added only after the cost confirmation in the taxonomy sub-reference (taxonomy/overview.md), which owns the tree presentation and interpretation.
| Metric | Output | What it measures | Params |
|---|---|---|---|
| taxonomy | both | Per-framing three-level category tree with row counts; per-row l1, l2, l3, margin columns; HTML report |
framings (list of task, domain, quality; default all three) |
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.