Back to Prompt Library
implementation
Build the application
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Build a Generative Inference Energy and Carbon Footprint Allocator
Format
Code-aware
Lines
67
Sections
11
Linked challenge
Build a Generative Inference Energy and Carbon Footprint Allocator
Prompt source
Original prompt text with formatting preserved for inspection.
67 lines
11 sections
No variables
1 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.Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.