--- id: wiki-2026-0508-sustainability title: Sustainability category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Green Software, ESG, Carbon Footprint] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [sustainability, green-software, carbon-footprint, esg, ai-energy] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: python framework: codecarbon --- # Sustainability ## 매 한 줄 > **"매 software / AI 의 carbon-aware design"**. ESG mandate (EU CSRD 2025+), AI training 의 explosive energy growth (GPT-5 ~15GWh, Claude Opus 4.7 estimates), green coding practice 의 mainstream화. 매 measure → reduce → report 의 cycle. ## 매 핵심 ### 매 three pillars - **E (Environmental)**: carbon, water, e-waste. - **S (Social)**: labor, dataset bias, accessibility. - **G (Governance)**: transparency, audit, compliance (CSRD, SEC climate rule). ### 매 software-specific - **Green coding**: efficient algorithm, language choice (Rust vs Python), serverless cold-start vs warm. - **Carbon-aware computing**: workload scheduling (run when grid is clean — Google "Carbon Intelligent Computing"). - **Energy-efficient inference**: quantization (INT8, INT4), distillation, MoE sparse routing. - **Hardware**: ARM Graviton, Apple Silicon, NVIDIA Blackwell efficiency. ### 매 AI footprint (2026) - **Training**: 매 single Frontier model run ~10-50 GWh. - **Inference**: 매 GPT-5 query ~3-10 Wh (vs Google search ~0.3 Wh). - **Aggregate**: AI 의 datacenter 가 2030 의 global electricity 의 3-7% 예상. ### 매 응용 1. CI/CD 의 carbon budget enforcement. 2. Cloud region selection (Quebec hydro vs us-east-1 mixed). 3. Model serving optimization (batch, KV cache reuse). 4. CSRD reporting (EU large company mandate). ## 💻 패턴 ### codecarbon (Python tracking) ```python from codecarbon import EmissionsTracker tracker = EmissionsTracker(project_name="train_run") tracker.start() try: train_model() finally: emissions_kg = tracker.stop() print(f"Run emitted {emissions_kg:.4f} kg CO2eq") ``` ### Carbon-aware scheduler ```python import requests def grid_intensity(region: str) -> float: # WattTime / Electricity Maps API r = requests.get(f"https://api.electricitymaps.com/v3/carbon-intensity/latest?zone={region}", headers={"auth-token": KEY}) return r.json()["carbonIntensity"] # gCO2/kWh def best_region(regions: list[str]) -> str: return min(regions, key=grid_intensity) # usage target_region = best_region(["us-west-2", "ca-central-1", "eu-north-1"]) schedule_job(region=target_region) ``` ### Quantization for inference ```python from transformers import AutoModelForCausalLM, BitsAndBytesConfig import torch bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16) model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.3-70B", quantization_config=bnb) # 4-bit quantization → ~75% memory + energy reduction vs fp16 ``` ### Cloud Run min-instances=0 (cold start tradeoff) ```yaml # cloudrun.yaml — 매 idle 시 0 instance, 매 traffic 의 cold start 허용 spec: template: spec: containers: - image: gcr.io/proj/api containerConcurrency: 80 metadata: annotations: autoscaling.knative.dev/minScale: "0" ``` ### Carbon budget CI gate ```yaml # .github/workflows/carbon.yml - name: Run with codecarbon run: python train.py - name: Check budget run: | EMISSIONS=$(jq -r .emissions_kg emissions.json) if (( $(echo "$EMISSIONS > 5.0" | bc -l) )); then echo "::error::Carbon budget exceeded: ${EMISSIONS}kg > 5kg"; exit 1 fi ``` ### Green model selection ```python # 매 task 의 simplest sufficient model from anthropic import Anthropic client = Anthropic() def route_query(complexity: int, query: str): model = "claude-haiku-4-5" if complexity < 3 else "claude-opus-4-7" return client.messages.create(model=model, max_tokens=1024, messages=[{"role": "user", "content": query}]) # Haiku 의 ~10-20x energy-cheaper than Opus ``` ## 매 결정 기준 | 상황 | Action | |---|---| | 매 training large model | clean-grid region + spot + checkpoint | | 매 inference at scale | quantize + batch + KV cache | | 매 simple query | smallest sufficient model (Haiku, Sonnet) | | 매 reporting mandate | codecarbon + CSRD format | | 매 datacenter choice | Iceland, Quebec, Norway > us-east-1 | **기본값**: 매 measure first (codecarbon) + 매 model right-size + 매 carbon-aware region. ## 🔗 Graph - 부모: [[ESG]] - 변형: [[Green-Software]] - Adjacent: [[LLM_Optimization_and_Deployment_Strategies|Quantization]] · [[Mixture-of-Experts]] · [[Energy-Efficiency]] ## 🤖 LLM 활용 **언제**: 매 model selection (right-size), 매 prompt caching aggressive use (cache hit ~90% energy reduction), 매 batch API. **언제 X**: 매 user-facing latency-critical (단, model-route hybrid 가능). ## ❌ 안티패턴 - **매 항상 Opus 사용**: 매 simple task 도 frontier model — 10-20x energy waste. - **Cache 미사용**: 매 prompt caching 의 cache miss 가 every call → energy + cost. - **Greenwashing**: 매 carbon offset 만 사고 actual reduction X — credibility crash. - **Single region lock-in**: 매 dirty grid 의 stuck — multi-region 로 carbon-aware schedule. ## 🧪 검증 / 중복 - Verified (Green Software Foundation principles 2021+; Patterson et al. 2021 "Carbon Emissions and Large Neural Network Training"; EU CSRD 2024 effective; IEA 2024 datacenter report). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — ESG + AI footprint + green coding patterns |