Skip to content

Commit 8edf4e6

Browse files
authored
Add Responsible AI section with Provenance guidance (#957)
Draft provenance description for the 1.1 spec.
1 parent ca49dd6 commit 8edf4e6

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

docs/croissant-spec-draft.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,177 @@ Segmentation mask as an image:
18701870
- `sc:GeoShape` describes segmentation masks as a sequence of coordinates (polygon).
18711871
- `sc:ImageObject` describes segmentation masks as image overlays (with pixel = 0 outside of the mask and pixel = 1 inside the mask).
18721872

1873+
## Responsible AI and Governance
1874+
1875+
This section provides guidance on how to integrate external vocabularies with Croissant to address important Responsible AI use cases, such as provenance and data use restrictions.
1876+
1877+
### Provenance Representation
1878+
1879+
Tracking the provenance of a dataset is crucial for transparency, reproducibility, and responsible AI. It helps users understand where the data came from, how it was created, and how it has been modified over time. This is particularly important for datasets derived from other datasets, or those that have undergone significant transformations, such as filtering, augmentation, or annotation.
1880+
1881+
Croissant recommends using the [W3C PROV Ontology (PROV-O)](https://www.w3.org/TR/prov-o/) to describe provenance. PROV-O provides a rich and standard vocabulary for describing the entities, activities, and agents involved in the lifecycle of data.
1882+
1883+
To use PROV-O or other external vocabularies (like FOAF) in a Croissant dataset, you should first declare their namespace in the `@context`. Then, you can use properties from these vocabularies on any Croissant object, such as the Dataset itself, a `FileObject`, a `RecordSet`, or a `Field`.
1884+
1885+
Key PROV-O relationships include:
1886+
1887+
* `prov:wasDerivedFrom`: Indicates that an entity (e.g., the dataset or a part of it) was derived from another entity.
1888+
* `prov:wasGeneratedBy`: Links an entity to the activity that generated it (e.g., a data cleaning process, a web crawl).
1889+
* `prov:wasAttributedTo`: Links an entity to the agent responsible for it (e.g., a person, organization, or software).
1890+
1891+
Provenance can be specified at multiple levels of granularity:
1892+
1893+
**Dataset and Resource-level Provenance**
1894+
1895+
You can describe the origin of the entire dataset. For example, if a dataset is a corrupted version of ImageNet:
1896+
1897+
```json
1898+
{
1899+
"@context": {
1900+
"@vocab": "http://schema.org/",
1901+
"cr": "http://mlcommons.org/croissant/",
1902+
"prov": "http://www.w3.org/ns/prov#",
1903+
"foaf": "http://xmlns.com/foaf/0.1/"
1904+
},
1905+
"@type": "sc:Dataset",
1906+
"name": "ImageNet-C",
1907+
"description": "A variant of ImageNet with applied corruptions.",
1908+
"prov:wasDerivedFrom": { "@id": "urn:dataset:ImageNet" },
1909+
"prov:wasGeneratedBy": {
1910+
"@type": "prov:Activity",
1911+
"prov:label": "Corruption Transformation"
1912+
}
1913+
// ... other dataset properties
1914+
}
1915+
```
1916+
1917+
Similarly, you can describe the provenance of individual resources (`FileObject` or `FileSet`). For example, to indicate that a file was downloaded from a specific URL by a crawling process:
1918+
1919+
```json
1920+
{
1921+
"@type": "cr:FileObject",
1922+
"@id": "raw_data.csv",
1923+
"contentUrl": "https://example.com/data.csv",
1924+
"prov:wasGeneratedBy": {
1925+
"@type": "prov:Activity",
1926+
"prov:label": "Web Crawl 2023-10",
1927+
"prov:endedAtTime": "2023-10-01T12:00:00Z"
1928+
},
1929+
"prov:wasAttributedTo": {
1930+
"@type": "prov:Agent",
1931+
"prov:label": "Common Crawl Foundation"
1932+
}
1933+
}
1934+
```
1935+
1936+
**RecordSet and Field-level Provenance**
1937+
1938+
Provenance can also be attached to specific `RecordSet`s or `Field`s. This is useful when different parts of the dataset have different origins, or when you want to document the creation of specific annotations.
1939+
1940+
For example, you can indicate that a set of labels was generated by a specific software agent:
1941+
1942+
```json
1943+
{
1944+
"@type": "cr:RecordSet",
1945+
"@id": "images_with_labels",
1946+
"field": [
1947+
{
1948+
"@type": "cr:Field",
1949+
"@id": "images_with_labels/image"
1950+
},
1951+
{
1952+
"@type": "cr:Field",
1953+
"@id": "images_with_labels/label",
1954+
"dataType": "sc:Text",
1955+
"prov:wasAttributedTo": {
1956+
"@type": "prov:Agent",
1957+
"prov:label": "SyntheticDataGenerator-v1.2"
1958+
},
1959+
"prov:wasGeneratedBy": {
1960+
"@type": "prov:Activity",
1961+
"prov:label": "Automated Labeling Process"
1962+
}
1963+
}
1964+
]
1965+
}
1966+
```
1967+
1968+
**Data-level Provenance**
1969+
1970+
For the finest level of granularity, you can attach provenance information to individual data values. This is achieved using Croissant's annotation mechanism, where an annotation field is used to hold the provenance information for another field. By setting the `equivalentProperty` of the annotation field to a PROV-O property, you can define the relationship between the data and its provenance.
1971+
1972+
For example, consider a dataset where each image is labeled by a different human annotator, and we want to capture the information about the annotator for each label. We can combine PROV-O and FOAF (Friend of a Friend) vocabularies to describe this. We can define an annotation field that represents the `prov:Person` (the annotator) and link it to the label field using `prov:wasAttributedTo`. We can then use FOAF properties to describe the person's attributes.
1973+
1974+
```json
1975+
{
1976+
"@type": "cr:RecordSet",
1977+
"@id": "labeled_images",
1978+
"field": [
1979+
{
1980+
"@type": "cr:Field",
1981+
"@id": "labeled_images/image_id"
1982+
// ... source definition
1983+
},
1984+
{
1985+
"@type": "cr:Field",
1986+
"@id": "labeled_images/label",
1987+
"dataType": ["sc:Text", "cr:Label"],
1988+
"source": {
1989+
"fileObject": { "@id": "annotations.csv" },
1990+
"extract": { "column": "label" }
1991+
},
1992+
"annotation": {
1993+
"@type": "cr:Field",
1994+
"@id": "labeled_images/label/annotator",
1995+
"description": "The annotator who created the label.",
1996+
"dataType": ["prov:Person", "foaf:Person"],
1997+
"equivalentProperty": "prov:wasAttributedTo",
1998+
"subField": [
1999+
{
2000+
"@type": "cr:Field",
2001+
"@id": "labeled_images/label/annotator/id",
2002+
"source": {
2003+
"fileObject": { "@id": "annotations.csv" },
2004+
"extract": { "column": "annotator_id" }
2005+
}
2006+
},
2007+
{
2008+
"@type": "cr:Field",
2009+
"@id": "labeled_images/label/annotator/gender",
2010+
"description": "Gender of the annotator.",
2011+
"dataType": "sc:Text",
2012+
"equivalentProperty": "foaf:gender",
2013+
"source": {
2014+
"fileObject": { "@id": "annotations.csv" },
2015+
"extract": { "column": "annotator_gender" }
2016+
}
2017+
},
2018+
{
2019+
"@type": "cr:Field",
2020+
"@id": "labeled_images/label/annotator/age",
2021+
"description": "Age of the annotator.",
2022+
"dataType": "sc:Integer",
2023+
"equivalentProperty": "foaf:age",
2024+
"source": {
2025+
"fileObject": { "@id": "annotations.csv" },
2026+
"extract": { "column": "annotator_age" }
2027+
}
2028+
}
2029+
]
2030+
}
2031+
}
2032+
]
2033+
}
2034+
```
2035+
2036+
In this example, the `labeled_images/label` field has an annotation `labeled_images/label/annotator`. The `equivalentProperty` "prov:wasAttributedTo" on the annotation field indicates that each label is attributed to the corresponding person. The person's details (id, gender, age) are pulled from the same source file (`annotations.csv`) on a row-by-row basis. The `gender` and `age` fields are mapped to their corresponding FOAF properties, `foaf:gender` and `foaf:age`, via `equivalentProperty`.
2037+
2038+
By leveraging external vocabularies like PROV-O and FOAF, Croissant enables a standardized and machine-readable way to capture the rich history and context of ML datasets, supporting better trust and understanding.
2039+
2040+
### Data Use Restrictions
2041+
2042+
TODO: Add guidance on representing data use restrictions.
2043+
18732044
## Appendix 1: JSON-LD context
18742045

18752046
```json

0 commit comments

Comments
 (0)