Lesson 8 of 13
Environmental Impact
AI data center electricity and water cooling demands have expanded exponentially. Explore the carbon footprint of training vs inference, techniques like model quantization (4-bit/8-bit), and sustainable Green AI engineering.
Carbon & Energy Footprint Calculator for LLM Workloads
Carbon & Energy Footprint Calculator for LLM Workloads
# Energy & Carbon Calculator: Tracking LLM Inference Environmental Footprint
def calculate_inference_footprint(
monthly_tokens: int,
gpu_type: str = "H100",
grid_carbon_intensity: float = 380.0 # Grams CO2 per kWh (global average)
) -> dict:
"""
Estimates kilowatt-hours and carbon emissions based on hardware TDP and token volume.
"""
# Average H100 GPU generates ~1,500 tokens/sec at 700 Watts
tokens_per_kwh = (1500 * 3600) / 0.700 # ~7.7 million tokens per kWh
total_kwh = monthly_tokens / tokens_per_kwh
total_co2_kg = (total_kwh * grid_carbon_intensity) / 1000.0
equivalent_gas_miles = total_co2_kg / 0.400 # ~400g CO2 per car mile driven
return {
"monthly_tokens": f"{monthly_tokens:,}",
"hardware": gpu_type,
"energy_consumption_kwh": round(total_kwh, 2),
"emissions_kg_co2": round(total_co2_kg, 2),
"equivalent_car_miles": round(equivalent_gas_miles, 1)
}
# Startup scenario: 50 million tokens per month
footprint = calculate_inference_footprint(50_000_000)
print(f"Workload: {footprint['monthly_tokens']} tokens")
print(f"Energy Consumed: {footprint['energy_consumption_kwh']} kWh")
print(f"Carbon Footprint: {footprint['emissions_kg_co2']} kg CO2e")
print(f"Equivalent Driving Distance: {footprint['equivalent_car_miles']} miles")Diagram
Loading diagram…
Environmental Impact Diagram
Sustainable Green AI Engineering Strategies
- Model Quantization (INT4 / FP8): Compress 70B parameter models down from 140GB to 38GB VRAM, cutting inference power consumption by over 60%
- Smart Model Routing (Cascade): Handle 80% of routine user queries with lightweight 8B models, reserving power-hungry frontier models only for complex reasoning
- Semantic Response Caching: Intercept duplicate queries with Redis vector caches to avoid re-generating identical tokens
- Geographical Green Scheduling: Schedule long-running batch training jobs in data centers powered by 100% geothermal or hydroelectric energy
Quick Q&A
Key Takeaways
- AI data center electricity and water cooling demands have expanded exponentially.
- Model Quantization (INT4 / FP8): Compress 70B parameter models down from 140GB to 38GB VRAM, cutting inference power consumption by over 60%
- Smart Model Routing (Cascade): Handle 80% of routine user queries with lightweight 8B models, reserving power-hungry frontier models only for complex reasoning
- Semantic Response Caching: Intercept duplicate queries with Redis vector caches to avoid re-generating identical tokens
Finished this lesson?
0 of 13 in Module 12