Skip to main content
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 Workload Token and Power Cost Attribution Engine

Format
Code-aware
Lines
69
Sections
11
Linked challenge
Build a Generative Workload Token and Power Cost Attribution Engine

Prompt source

Original prompt text with formatting preserved for inspection.

69 lines
11 sections
No variables
1 code block
## Build
Correlate per-request token usage with real-time accelerator power consumption. Attribute energy and hardware depreciation costs across internal teams and model architectures.

## User
FinOps and Sustainability Lead

## Workflow
1. Ingest serving request logs alongside DCGM and Neuron power telemetry records.
2. Calculate Joules-per-token and watt-hour attribution across concurrent tenants.
3. Prompt hosted Claude to summarize cost attribution anomalies and carbon footprints.
4. Compile an auditable monthly billing and sustainability report for department heads.

## Interface
Multi-tenant dashboard displaying energy consumption charts, Joules/token heatmaps, and cost allocation breakdowns.

## Data
Create synthetic time-aligned logs combining open-weight model request traces (token counts) and sampled power draw (Watts) metrics.
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 DCGM GPU power draw metrics (DCGM_FI_DEV_POWER_USAGE) to calculate precise watt-hour consumption per inference window.

## Tools
pydantic-ai, anthropic-claude, mlflow.
Guarantees mathematical schema consistency across energy measurements, token tallies, and currency conversions.
Hosted Claude API for natural language variance reporting and sustainability insight drafting.

## 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
- Calculates energy-per-token metrics across at least two concurrent tenant workloads.
- Reconciles aggregate power draw against individual request attributions within 3% tolerance.
- Produces verified FinOps cost summaries exportable as JSON.

## Starter Examples
```json
[
  {
    "input": {
      "tenant_id": "search-team",
      "window_hours": 1,
      "tokens_processed": 5000000,
      "avg_power_watts": 420,
      "kwh_rate_usd": 0.12,
      "node_depreciation_hourly_usd": 1.5
    },
    "expected_output": {
      "energy_consumed_kwh": 0.42,
      "energy_cost_usd": 0.05,
      "total_attributed_cost_usd": 1.55,
      "joules_per_token": 0.302,
      "efficiency_rating": "optimal"
    }
  },
  {
    "input": {
      "tenant_id": "idle-team",
      "window_hours": 1,
      "tokens_processed": 0,
      "avg_power_watts": 110,
      "kwh_rate_usd": 0.12,
      "node_depreciation_hourly_usd": 1.5
    },
    "expected_output": {
      "energy_consumed_kwh": 0.11,
      "energy_cost_usd": 0.013,
      "total_attributed_cost_usd": 1.513,
      "joules_per_token": 0,
      "efficiency_rating": "idle_waste"
    }
  }
]
```

## Safety
Calculates accounting figures only; does not manipulate power caps or server governor settings.
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.