diff --git a/ai/README.md b/ai/README.md index 5ebb25f2..c1ed426a 100644 --- a/ai/README.md +++ b/ai/README.md @@ -22,6 +22,7 @@ Directories of the form `example##` are structured as follows: |----|---------|----------|------|------|----------| | [1](./example01/) | - | - | - | 1 document | Demonstrating `dependsOn`, `testedOn`, and `trainedOn` relationships | | [2](./example02/) | 4 Python files | 1 model file | 3 data files | 1 document | Demonstrating `generates`, `hasDataFile`, and `hasDocumentation` (lifecycle-scoped) relationships | +| [6](./example06/) | - | - | - | 1 document | `/AI/energyConsumption` (training + finetuning + inference) | ## Implementing SBOM for AI systems diff --git a/ai/example06/README.md b/ai/example06/README.md new file mode 100644 index 00000000..d43a22a7 --- /dev/null +++ b/ai/example06/README.md @@ -0,0 +1,50 @@ +--- +SPDX-FileType: DOCUMENTATION +SPDX-License-Identifier: CC-BY-4.0 +--- + +# AI example 6 - Energy consumption reporting + +## Description + +This example illustrates an SBOM for a large image classification model used +to monitor land use changes from satellite imagery. + +The SBOM demonstrates the **`/AI/energyConsumption` structure** - the primary +focus of this example - covering all three lifecycle stages required by emerging +AI transparency and sustainability regulations. + +```text +ai_energyConsumption +├── ai_trainingEnergyConsumption → 4,823.5 kWh (32× A100, 14 days) +├── ai_finetuningEnergyConsumption → 187.2 kWh (domain adaptation) +└── ai_inferenceEnergyConsumption → 0.0041 kWh (per batch job) +``` + +Each stage uses an `/AI/EnergyConsumptionDescription` object with +`/AI/energyQuantity` (decimal) and `/AI/energyUnit` +(`kilowattHour` / `megajoule` / `other`). + +## Profile conformance + +`core`, `ai` + +## SPDX files + +| Version | File | +| ------- | ---- | +| SPDX 3.0 | [spdx3.0/example06.spdx3.json](./spdx3.0/example06.spdx3.json) | +| SPDX 3.1 (draft) | [spdx3.1/example06.spdx3.json-draft](./spdx3.1/example06.spdx3.json-draft) | + +[![A diagram of AI example 6 - Model with energy consumption tracking.](./example06.spdx3.png "A diagram of AI example 6 - Model with energy consumption tracking.")](./example06.spdx3.png) + +## Key properties demonstrated + +| Property | Notes | +| -------- | ----- | +| `/AI/autonomyType` | `noAssertion` - deprecated in SPDX 3.1, use `isoAutomationLevel` | +| `/AI/energyConsumption` | All 3 stages (training, finetuning, inference) | +| `/AI/finetuningEnergyConsumption` | 187.2 kWh | +| `/AI/inferenceEnergyConsumption` | 0.0041 kWh per batch | +| `/AI/standardCompliance` | ISO/IEC 42001:2023 | +| `/AI/trainingEnergyConsumption` | 4,823.5 kWh | diff --git a/ai/example06/example06.spdx3.png b/ai/example06/example06.spdx3.png new file mode 100644 index 00000000..4b9229fc Binary files /dev/null and b/ai/example06/example06.spdx3.png differ diff --git a/ai/example06/spdx3.0/example06.spdx3.json b/ai/example06/spdx3.0/example06.spdx3.json new file mode 100644 index 00000000..ab287ceb --- /dev/null +++ b/ai/example06/spdx3.0/example06.spdx3.json @@ -0,0 +1,193 @@ +{ + "@context": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld", + "@graph": [ + { + "type": "CreationInfo", + "@id": "_:creationinfo", + "specVersion": "3.0.1", + "createdBy": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#Organization1" + ], + "created": "2024-12-01T00:00:00Z" + }, + { + "type": "Organization", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#Organization1", + "creationInfo": "_:creationinfo", + "name": "Sustainable AI Initiative" + }, + { + "type": "SpdxDocument", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001", + "creationInfo": "_:creationinfo", + "profileConformance": [ + "core", + "ai" + ], + "rootElement": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#SBOM1" + ] + }, + { + "type": "software_Sbom", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#SBOM1", + "creationInfo": "_:creationinfo", + "profileConformance": [ + "core", + "ai" + ], + "rootElement": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#AIPackage1" + ], + "software_sbomType": [ + "analyzed" + ] + }, + { + "type": "ai_AIPackage", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#AIPackage1", + "creationInfo": "_:creationinfo", + "name": "EcoVision-Large", + "summary": "Large-scale satellite image classifier for land use and deforestation monitoring, with comprehensive energy consumption disclosure.", + "description": "A vision transformer model (ViT-Large/16) trained to classify land use from multispectral satellite imagery into 12 categories including forest, cropland, urban, wetland, and deforested areas. Developed with sustainability principles: energy consumption measured and disclosed at all lifecycle stages to support carbon footprint assessment as required under emerging AI transparency regulations.", + "software_packageVersion": "2.0.0", + "software_primaryPurpose": "model", + "software_downloadLocation": "https://example.com/models/ecovision-large", + "software_copyrightText": "Copyright 2024 Sustainable AI Initiative", + "ai_typeOfModel": [ + "vision transformer", + "supervised", + "multi-class classification" + ], + "ai_domain": [ + "remote sensing", + "environmental monitoring", + "land use classification", + "deforestation detection" + ], + "ai_informationAboutTraining": "Trained from scratch on BigEarthNet-MM (590,326 Sentinel-1 and Sentinel-2 patch pairs) plus a proprietary dataset of 120,000 labeled multispectral tiles. Training ran for 200 epochs on a cluster of 32x A100 80GB GPUs over 14 days. Energy measured using NVIDIA NVML power sampling at 100ms intervals and datacenter PUE factor of 1.3.", + "ai_informationAboutApplication": "Deployed as a monthly batch inference job processing new satellite imagery tiles. Inference runs on 4x A10 GPUs. Results fed into a deforestation alert dashboard used by environmental NGOs and government agencies.", + "ai_energyConsumption": { + "type": "ai_EnergyConsumption", + "ai_trainingEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "4823.5", + "ai_energyUnit": "kilowattHour" + } + ], + "ai_finetuningEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "187.2", + "ai_energyUnit": "kilowattHour" + } + ], + "ai_inferenceEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "0.0041", + "ai_energyUnit": "kilowattHour" + } + ] + }, + "ai_hyperparameter": [ + { + "type": "DictionaryEntry", + "key": "architecture", + "value": "ViT-Large/16" + }, + { + "type": "DictionaryEntry", + "key": "patchSize", + "value": "16" + }, + { + "type": "DictionaryEntry", + "key": "imageSize", + "value": "224" + }, + { + "type": "DictionaryEntry", + "key": "numClasses", + "value": "12" + }, + { + "type": "DictionaryEntry", + "key": "learningRate", + "value": "1e-3" + }, + { + "type": "DictionaryEntry", + "key": "batchSize", + "value": "512" + }, + { + "type": "DictionaryEntry", + "key": "epochs", + "value": "200" + }, + { + "type": "DictionaryEntry", + "key": "optimizer", + "value": "AdamW" + }, + { + "type": "DictionaryEntry", + "key": "lrSchedule", + "value": "cosine_annealing" + } + ], + "ai_metric": [ + { + "type": "DictionaryEntry", + "key": "overall_accuracy", + "value": "0.942" + }, + { + "type": "DictionaryEntry", + "key": "mean_IoU", + "value": "0.871" + }, + { + "type": "DictionaryEntry", + "key": "deforestation_recall", + "value": "0.963" + } + ], + "ai_standardCompliance": [ + "ISO/IEC 42001:2023" + ], + "ai_useSensitivePersonalInformation": "no", + "ai_autonomyType": "noAssertion", + "comment": "SPDX 3.0 NOTE: This example demonstrates the 'ai_energyConsumption' structure covering all three lifecycle stages: training (4,823.5 kWh), fine-tuning (187.2 kWh), and inference per batch (0.0041 kWh). Energy transparency is increasingly required under AI governance frameworks such as the EU AI Act and ISO/IEC 42001. Also: 'ai_autonomyType' is DEPRECATED in SPDX 3.1 - use 'isoAutomationLevel' instead." + }, + { + "type": "Relationship", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#Relationship1", + "creationInfo": "_:creationinfo", + "relationshipType": "hasDeclaredLicense", + "from": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#AIPackage1", + "to": [ + "https://spdx.org/licenses/Apache-2.0" + ] + }, + { + "type": "Relationship", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#Relationship2", + "creationInfo": "_:creationinfo", + "relationshipType": "hasConcludedLicense", + "from": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006001#AIPackage1", + "to": [ + "https://spdx.org/licenses/Apache-2.0" + ] + }, + { + "type": "simplelicensing_LicenseExpression", + "spdxId": "https://spdx.org/licenses/Apache-2.0", + "creationInfo": "_:creationinfo", + "simplelicensing_licenseExpression": "Apache-2.0", + "simplelicensing_licenseListVersion": "3.25.0" + } + ] +} diff --git a/ai/example06/spdx3.1/example06.spdx3.json-draft b/ai/example06/spdx3.1/example06.spdx3.json-draft new file mode 100644 index 00000000..5b9e3f1c --- /dev/null +++ b/ai/example06/spdx3.1/example06.spdx3.json-draft @@ -0,0 +1,194 @@ +{ + "@context": "https://spdx.org/rdf/3.1/spdx-context.jsonld", + "@graph": [ + { + "type": "CreationInfo", + "@id": "_:creationinfo", + "specVersion": "3.1", + "createdBy": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#Organization1" + ], + "created": "2025-01-01T00:00:00Z" + }, + { + "type": "Organization", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#Organization1", + "creationInfo": "_:creationinfo", + "name": "Sustainable AI Initiative" + }, + { + "type": "SpdxDocument", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002", + "creationInfo": "_:creationinfo", + "profileConformance": [ + "core", + "ai" + ], + "rootElement": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#SBOM1" + ] + }, + { + "type": "software_Sbom", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#SBOM1", + "creationInfo": "_:creationinfo", + "profileConformance": [ + "core", + "ai" + ], + "rootElement": [ + "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#AIPackage1" + ], + "software_sbomType": [ + "analyzed" + ] + }, + { + "type": "ai_AIPackage", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#AIPackage1", + "creationInfo": "_:creationinfo", + "name": "EcoVision-Large", + "summary": "Large-scale satellite image classifier for land use and deforestation monitoring, with comprehensive energy consumption disclosure.", + "description": "A vision transformer model (ViT-Large/16) trained to classify land use from multispectral satellite imagery into 12 categories including forest, cropland, urban, wetland, and deforested areas. Developed with sustainability principles: energy consumption measured and disclosed at all lifecycle stages to support carbon footprint assessment as required under emerging AI transparency regulations.", + "software_packageVersion": "2.0.0", + "software_primaryPurpose": "model", + "software_downloadLocation": "https://example.com/models/ecovision-large", + "software_copyrightText": "Copyright 2024 Sustainable AI Initiative", + "intendedUse": "Monthly batch inference job processing new satellite imagery tiles for deforestation alert dashboard used by environmental NGOs and government agencies.", + "ai_typeOfModel": [ + "vision transformer", + "supervised", + "multi-class classification" + ], + "ai_domain": [ + "remote sensing", + "environmental monitoring", + "land use classification", + "deforestation detection" + ], + "ai_informationAboutTraining": "Trained from scratch on BigEarthNet-MM (590,326 Sentinel-1 and Sentinel-2 patch pairs) plus a proprietary dataset of 120,000 labeled multispectral tiles. Training ran for 200 epochs on a cluster of 32x A100 80GB GPUs over 14 days. Energy measured using NVIDIA NVML power sampling at 100ms intervals and datacenter PUE factor of 1.3.", + "ai_informationAboutApplication": "Deployed as a monthly batch inference job processing new satellite imagery tiles. Inference runs on 4x A10 GPUs. Results fed into a deforestation alert dashboard used by environmental NGOs and government agencies.", + "ai_energyConsumption": { + "type": "ai_EnergyConsumption", + "ai_trainingEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "4823.5", + "ai_energyUnit": "kilowattHour" + } + ], + "ai_finetuningEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "187.2", + "ai_energyUnit": "kilowattHour" + } + ], + "ai_inferenceEnergyConsumption": [ + { + "type": "ai_EnergyConsumptionDescription", + "ai_energyQuantity": "0.0041", + "ai_energyUnit": "kilowattHour" + } + ] + }, + "ai_hyperparameter": [ + { + "type": "DictionaryEntry", + "key": "architecture", + "value": "ViT-Large/16" + }, + { + "type": "DictionaryEntry", + "key": "patchSize", + "value": "16" + }, + { + "type": "DictionaryEntry", + "key": "imageSize", + "value": "224" + }, + { + "type": "DictionaryEntry", + "key": "numClasses", + "value": "12" + }, + { + "type": "DictionaryEntry", + "key": "learningRate", + "value": "1e-3" + }, + { + "type": "DictionaryEntry", + "key": "batchSize", + "value": "512" + }, + { + "type": "DictionaryEntry", + "key": "epochs", + "value": "200" + }, + { + "type": "DictionaryEntry", + "key": "optimizer", + "value": "AdamW" + }, + { + "type": "DictionaryEntry", + "key": "lrSchedule", + "value": "cosine_annealing" + } + ], + "ai_metric": [ + { + "type": "DictionaryEntry", + "key": "overall_accuracy", + "value": "0.942" + }, + { + "type": "DictionaryEntry", + "key": "mean_IoU", + "value": "0.871" + }, + { + "type": "DictionaryEntry", + "key": "deforestation_recall", + "value": "0.963" + } + ], + "ai_standardCompliance": [ + "ISO/IEC 42001:2023" + ], + "ai_useSensitivePersonalInformation": "no", + "isoAutomationLevel": "noAssertion", + "comment": "SPDX 3.1 CHANGES: (1) 'ai_autonomyType: noAssertion' (SPDX 3.0, deprecated) replaced by 'isoAutomationLevel: noAssertion' (Core property). (2) 'ai_informationAboutApplication' content partially moved to Core 'intendedUse' - 'intendedUse' is a new Core property in SPDX 3.1 available to all artifact types. Compare with SPDX 3.0 version in spdx3.0/example06.spdx3.json." + }, + { + "type": "Relationship", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#Relationship1", + "creationInfo": "_:creationinfo", + "relationshipType": "hasDeclaredLicense", + "from": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#AIPackage1", + "to": [ + "https://spdx.org/licenses/Apache-2.0" + ] + }, + { + "type": "Relationship", + "spdxId": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#Relationship2", + "creationInfo": "_:creationinfo", + "relationshipType": "hasConcludedLicense", + "from": "https://spdx.org/spdxdocs/ai-example06-a1b2c3d4-e5f6-7890-abcd-000000006002#AIPackage1", + "to": [ + "https://spdx.org/licenses/Apache-2.0" + ] + }, + { + "type": "simplelicensing_LicenseExpression", + "spdxId": "https://spdx.org/licenses/Apache-2.0", + "creationInfo": "_:creationinfo", + "simplelicensing_licenseExpression": "Apache-2.0", + "simplelicensing_licenseListVersion": "3.25.0" + } + ] +}