Skip to main content
Loading navigation
Back to prompt library

Build a Generative Inference Energy and Carbon Footprint Allocator — implementation

Linked challenge: Build a Generative Inference Energy and Carbon Footprint Allocator

Prompt source

implementation67 lines11 sectionsNo variables1 code block
## Build
Correlate per-request token usage with real-time accelerator power consumption across open-weight serving clusters. Attribute energy and hardware depreciation costs across internal teams and model architectures.

## User
Enterprise ESG and Infrastructure Auditor

## Workflow
1. Ingest Prometheus DCGM power draw time-series feeds alongside open-model inference server request audit logs.
2. Calculate token-weighted energy consumption (kWh) and regional carbon equivalent emissions per completed request batch.
3. Call hosted Claude via Anthropic API to interpret carbon intensity trends and draft departmental sustainability disclosure notes.
4. Generate verifiable ESG compliance audit statements breaking down electricity spend and carbon impacts across organizational teams.

## Interface
ESG executive reporting portal with carbon intensity heatmaps, per-department kilowatt-hour allocations, and exportable CSV ledgers.

## Data
Construct 50 synthetic serving session logs containing prompt/completion tokens, GPU average watts from DCGM, and regional grid carbon factor.
Starter examples below are synthetic. They are not downloaded records.

## Source
[NVIDIA DCGM exporter](https://raw.githubusercontent.com/NVIDIA/dcgm-exporter/main/README.md)
Extracts real-time GPU power draw counters (DCGM power violation, board power limit) to calculate energy usage during open inference bursts.

## Tools
evidently-ai, pandas.
Evidently AI monitors data drift and metric deviations across time-series telemetry to detect energy consumption anomalies.
Hosted Claude API for sustainability synthesis and reporting. Local cluster metrics originate from open DCGM exporter.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Computes energy per token (micro-joules/token) across discrete model serving workloads.
- Applies regional grid carbon intensity factors accurately to derive grams CO2e per query.
- Outputs compliant carbon attribution ledgers broken down by team billing code.

## Starter Examples
```json
[
  {
    "input": {
      "team_code": "data-platform",
      "model_id": "open-moe-8x7b",
      "total_tokens_served": 4500000,
      "average_gpu_watts": 340,
      "active_serving_hours": 12.5,
      "grid_carbon_intensity_g_per_kwh": 380
    },
    "expected_output": {
      "total_energy_kwh": 4.25,
      "total_carbon_g_co2e": 1615,
      "energy_efficiency_micro_joules_per_token": 3.4,
      "reporting_compliance": "VERIFIED_ESG_AUDIT_PASS"
    }
  },
  {
    "input": {
      "team_code": "sandbox-testing",
      "model_id": "open-moe-8x7b",
      "total_tokens_served": 0,
      "average_gpu_watts": 65,
      "active_serving_hours": 2,
      "grid_carbon_intensity_g_per_kwh": 380
    },
    "expected_output": {
      "total_energy_kwh": 0.13,
      "total_carbon_g_co2e": 49.4,
      "energy_efficiency_micro_joules_per_token": 0,
      "reporting_compliance": "IDLE_DRAIN_RECORDED"
    }
  }
]
```

## Safety
Reports carbon metrics for internal ESG disclosure. Does not execute autonomous equipment power throttling or shutoffs.
Use mock external writes. Require human review before any real deployment.