samuelrince commited on
Commit
66e8595
·
1 Parent(s): f1d9ee8

fix: visual improvements

Browse files
Files changed (3) hide show
  1. app.py +2 -2
  2. src/calculator.py +3 -3
  3. src/content.py +114 -115
app.py CHANGED
@@ -22,7 +22,7 @@ with open("src/style.css") as css:
22
 
23
  st.html(HERO_TEXT)
24
 
25
- st.markdown(INTRO_TEXT, unsafe_allow_html=True)
26
 
27
  tab_calculator, tab_expert, tab_token, tab_method, tab_about, tab_support = st.tabs(
28
  [
@@ -56,6 +56,6 @@ with tab_support:
56
 
57
  with st.expander("📚 Citation"):
58
  st.html(CITATION_LABEL)
59
- st.html(CITATION_TEXT)
60
 
61
  st.html(LICENCE_TEXT)
 
22
 
23
  st.html(HERO_TEXT)
24
 
25
+ st.success(INTRO_TEXT, icon="🌱")
26
 
27
  tab_calculator, tab_expert, tab_token, tab_method, tab_about, tab_support = st.tabs(
28
  [
 
56
 
57
  with st.expander("📚 Citation"):
58
  st.html(CITATION_LABEL)
59
+ st.code(CITATION_TEXT, language="bibtex")
60
 
61
  st.html(LICENCE_TEXT)
src/calculator.py CHANGED
@@ -55,17 +55,17 @@ def calculator_mode():
55
  df_filtered["warning_arch"].values[0]
56
  and not df_filtered["warning_multi_modal"].values[0]
57
  ):
58
- st.warning(WARNING_CLOSED_SOURCE)
59
  if (
60
  df_filtered["warning_multi_modal"].values[0]
61
  and not df_filtered["warning_arch"].values[0]
62
  ):
63
- st.warning(WARNING_MULTI_MODAL)
64
  if (
65
  df_filtered["warning_arch"].values[0]
66
  and df_filtered["warning_multi_modal"].values[0]
67
  ):
68
- st.warning(WARNING_BOTH)
69
 
70
  try:
71
  impacts = llm_impacts(
 
55
  df_filtered["warning_arch"].values[0]
56
  and not df_filtered["warning_multi_modal"].values[0]
57
  ):
58
+ st.warning(WARNING_CLOSED_SOURCE, icon="⚠️")
59
  if (
60
  df_filtered["warning_multi_modal"].values[0]
61
  and not df_filtered["warning_arch"].values[0]
62
  ):
63
+ st.warning(WARNING_MULTI_MODAL, icon="⚠️")
64
  if (
65
  df_filtered["warning_arch"].values[0]
66
  and df_filtered["warning_multi_modal"].values[0]
67
  ):
68
+ st.warning(WARNING_BOTH, icon="⚠️")
69
 
70
  try:
71
  impacts = llm_impacts(
src/content.py CHANGED
@@ -5,7 +5,7 @@ HERO_TEXT = """
5
  </a>
6
  </div>
7
  <div align="center">
8
- <p style="max-width: 850px; text-align: center">
9
  <b>EcoLogits</b> is a python library that tracks the <b>energy consumption</b> and <b>environmental
10
  footprint</b> of using <b>generative AI</b> models through APIs.
11
  <br>
@@ -18,16 +18,7 @@ HERO_TEXT = """
18
  """
19
 
20
  INTRO_TEXT = """
21
- <div align = "center"; style="background-color:#d4edda; padding:10px; border-radius:10px; color:#155724;">
22
- <p>
23
- EcoLogits Calculator is developed and maintained by
24
- <a href = "https://genai-impact.org/" > GenAI Impact </a> non-profit.
25
- To learn more about EcoLogits documentation visit
26
- <a href="https://ecologits.ai" > ecologits.ai </a>
27
- </p>
28
-
29
- </div>
30
- <br>
31
  """
32
 
33
  HOW_TO_TEXT = """
@@ -43,15 +34,15 @@ Chose a provider, a model and an example of usage (prompts).
43
  """
44
 
45
  WARNING_CLOSED_SOURCE = """
46
- ⚠️ The model architecture has not been publicly released, expect lower precision of estimations.
47
  """
48
 
49
  WARNING_MULTI_MODAL = """
50
- ⚠️ The model architecture is multimodal, expect lower precision of estimations.
51
  """
52
 
53
  WARNING_BOTH = """
54
- ⚠️ The model architecture has not been publicly released and is multimodal, expect lower precision of estimations.
55
  """
56
 
57
  TOKEN_ESTIMATOR_TEXT = """
@@ -84,63 +75,55 @@ When you're writing or interacting with an LLM, being aware of token count can h
84
 
85
  ABOUT_TEXT = r"""
86
  ## 🎯 Our goal
 
87
  **The main goal of the EcoLogits Calculator is to raise awareness on the environmental impacts of LLM inference.**
88
- The rapid evolution of generative AI is reshaping numerous industries and aspects of our daily lives. While these
89
- advancements offer some benefits, they also **pose substantial environmental challenges that cannot be overlooked**.
90
- Plus the issue of AI's environmental footprint has been mainly discussed at training stage but rarely at the inference
91
- stage. That is an issue because **inference impacts for large langauge models (LLMs) can largely overcome the training impacts when deployed
92
- at large scales**.
93
- At **[GenAI Impact](https://genai-impact.org/) we are dedicated to understanding and mitigating the environmental
94
- impacts of generative AI** through rigorous research, innovative tools, and community engagement. Especially, in early
95
- 2024 we have launched an new open-source tool called [EcoLogits](https://github.com/genai-impact/ecologits) that tracks
96
- the energy consumption and environmental footprint of using generative AI models through APIs.
97
  ## 🙋 FAQ
 
98
  **How we assess the impacts of closed-source models?**
99
- Environmental impacts are calculated based on model architecture and parameter count. For closed-source models, we
100
- lack transparency from providers, so we estimate parameter counts using available information. For GPT models, we
101
- based our estimates on leaked GPT-4 architecture and scaled parameters count for GPT-4-Turbo and GPT-4o based on
102
- pricing differences. For other proprietary models like Anthropic's Claude, we assume similar impacts for models
103
- released around the same time with similar performance on public benchmarks. Please note that these estimates are
104
- based on assumptions and may not be exact. Our methods are open-source and transparent so you can always see the
105
- hypotheses we use.
106
  **Which generative AI models or providers are supported?**
107
- To see the full list of **generative AI providers** currently supported by EcoLogits, see the following
108
- [documentation page](https://ecologits.ai/providers/). As of today we only support LLMs but we plan to add support for
109
- embeddings, image generation, multi-modal models and more. If you are interested don't hesitate to
110
- [join us](https://genai-impact.org/contact/) and accelerate our work!
111
  **How to reduce AI environmental impacts?**
112
- * Look at **indirect impacts** of your project. Does the finality of your project is impacting negatively the
113
- environment?
114
  * **Be frugal** and question your usage or need of AI
115
  * Do you really need AI to solve your problem?
116
  * Do you really need GenAI to solve your problem? (you can read this [paper](https://aclanthology.org/2023.emnlp-industry.39.pdf))
117
  * Use small and specialized models to solve your problem.
118
- * Evaluate before, during and after the development of your project the environmental impacts with tools like
119
- 🌱 [EcoLogits](https://github.com/genai-impact/ecologits) or [CodeCarbon](https://github.com/mlco2/codecarbon)
120
- (see [more tools](https://github.com/samuelrince/awesome-green-ai))
121
  * Restrict the use case and limit the usage of your tool or feature to the desired purpose.
122
  * Do NOT buy new GPUs / hardware
123
  * Hardware manufacturing for data centers is around 50% of the impact.
124
- * Use cloud instances that are located in low emissions / high energy efficiency data centers
125
- (see [electricitymaps.com](https://app.electricitymaps.com/map))
126
  * Optimize your models for production
127
  * Quantize your models.
128
  * Use inference optimization tricks.
129
  * Prefer fine-tuning of small and existing models over generalist models.
 
130
  **What is the difference between **EcoLogits** and [CodeCarbon](https://github.com/mlco2/codecarbon)?**
131
- EcoLogits is focused on estimating the environmental impacts of generative AI (only LLMs for now) used **through API
132
- providers (such as OpenAI, Anthropic, Cloud APIs...)** whereas CodeCarbon is more general tool to measure energy
133
- consumption and estimate GHG emissions measurement. If you deploy LLMs locally we encourage you to use CodeCarbon to
134
- get real numbers of your energy consumption.
135
 
136
  ## 🤗 Contributing
137
- We are eager to get feedback from the community, don't hesitate to engage the discussion with us on this
138
- [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45) or message us on
139
- [LinkedIn](https://www.linkedin.com/company/genai-impact/).
140
- We also welcome any open-source contributions on 🌱 **[EcoLogits](https://github.com/genai-impact/ecologits)** or on
141
- 🧮 **EcoLogits Calculator**.
142
 
143
  ## ⚖️ License
 
144
  <p xmlns:cc="http://creativecommons.org/ns#" >
145
  This work is licensed under
146
  <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">
@@ -148,25 +131,27 @@ We also welcome any open-source contributions on 🌱 **[EcoLogits](https://gith
148
  </a>
149
  <br>
150
  <br>
151
- <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt="">
152
- <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt="">
153
- <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1" alt="">
154
  </p>
155
 
156
  ## 🙌 Acknowledgement
157
- We thank [Data For Good](https://dataforgood.fr/) and [Boavizta](https://boavizta.org/en) for supporting the
158
- development of this project. Their contributions of tools, best practices, and expertise in environmental impact
159
- assessment have been invaluable.
160
- We also extend our gratitude to the open-source contributions of 🤗 [Hugging Face](huggingface.com) on the LLM-Perf
161
- Leaderboard.
162
 
163
  ## 🤝 Contact
 
164
  For general question on the project, please use the [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45).
165
  Otherwise use our contact form on [genai-impact.org/contact](https://genai-impact.org/contact/).
166
  """
167
 
168
  SUPPORT_TEXT = r"""
169
  ## How to support
 
170
  At GenAI Impact, our projects are powered by the passion and dedication of our team.
171
  Since its first release in June 2024, this calculator has been **developped and maintained entirely on a volunteer basis by our members**.
172
  We aim to keep this tool available as a free and open-source ressource for the common good. We need your support to reach this goal, this is how you can help.
@@ -206,112 +191,126 @@ Contact us on [GenAI Impact ](https://genai-impact.org/contact/)
206
 
207
  METHODOLOGY_TEXT = r"""
208
  ## 📖 Methodology
209
- We have developed a methodology to **estimate the energy consumption and environmental impacts for an LLM inference**
210
- based on request parameters and hypotheses on the data center location, the hardware used, the model architecture and
211
- more.
212
- In this section we will only cover the principles of the methodology related to the 🧮 **EcoLogits Calculator**. If
213
- you wish to learn more on the environmental impacts modeling of an LLM request checkout the
214
- 🌱 [EcoLogits documentation page](https://ecologits.ai/methodology/).
215
  ### Modeling impacts of an LLM request
216
- The environmental impacts of an LLM inference are split into the **usage impacts** $I_{request}^u$ to account for
217
- electricity consumption and the **embodied impacts** $I_{request}^e$ that relates to resource extraction, hardware
218
- manufacturing and transportation. In general terms it can be expressed as follow:
219
  $$ I_{request} = I_{request}^u + I_{request}^e $$
 
220
  $$ I_{request} = E_{request}*F_{em}+\frac{\Delta T}{\Delta L}*I_{server}^e $$
 
221
  With,
 
222
  * $E_{request}$ the estimated energy consumption of the server and its cooling system.
223
  * $F_{em}$ the electricity mix that depends on the country and time.
224
  * $\frac{\Delta T}{\Delta L}$ the hardware usage ratio i.e. the computation time over the lifetime of the hardware.
225
  * $I_{server}^e$ the embodied impacts of the server.
226
- Additionally, to ⚡️ **direct energy consumption** the environmental impacts are expressed in **three dimensions
227
- (multi-criteria impacts)** that are:
228
- * 🌍 **Global Warming Potential** (GWP): Potential impact on global warming in kgCO2eq (commonly known as GHG/carbon
229
- emissions).
230
- * 🪨 **Abiotic Depletion Potential for Elements** (ADPe): Impact on the depletion of non-living resources such as
231
- minerals or metals in kgSbeq.
232
  * ⛽️ **Primary Energy** (PE): Total energy consumed from primary sources in MJ.
 
233
  ### Principles, Data and Hypotheses
234
- We use a **bottom-up methodology** to model impacts, meaning that we will estimate the impacts of low-level physical
235
- components to then estimate the impacts at software level (in that case an LLM inference). We also rely on **Life
236
- Cycle Approach (LCA) proxies and approach** to model both usage and embodied phases with multi-criteria impacts.
237
- If you are interested in this approach we recommend you to read the following [Boavizta](https://boavizta.org/)
238
- resources.
239
  * [Digital & environment: How to evaluate server manufacturing footprint, beyond greenhouse gas emissions?](https://boavizta.org/en/blog/empreinte-de-la-fabrication-d-un-serveur)
240
  * [Boavizta API automated evaluation of environmental impacts of ICT services and equipments](https://boavizta.org/en/blog/boavizta-api-automated-evaluation-of-ict-impacts-on-the-environment)
241
  * [Boavizta API documentation](https://doc.api.boavizta.org/)
 
242
  We leverage **open data to estimate the environmental impacts**, here is an exhaustive list of our data providers.
243
- * [LLM-Perf Leaderboard](https://huggingface.co/spaces/optimum/llm-perf-leaderboard) to estimate GPU energy consumption
244
- and latency based on the model architecture and number of output tokens.
245
- * [Boavizta API](https://github.com/Boavizta/boaviztapi) to estimate server embodied impacts and base energy
246
- consumption.
247
  * [ADEME Base Empreinte®](https://base-empreinte.ademe.fr/) for electricity mix impacts per country.
 
248
  Finally here are the **main hypotheses** we have made to compute the impacts.
 
249
  * ⚠️ **We *"guesstimate"* the model architecture of proprietary LLMs when not disclosed by the provider.**
250
  * Production setup: quantized models running on data center grade servers and GPUs such as A100.
251
  * Electricity mix does not depend on time (help us enhance EcoLogits and work on this [issue](https://github.com/genai-impact/ecologits/issues/42))
252
  * Ignore the following impacts: unused cloud resources, data center building, network and end-user devices... (for now)
 
253
  ## Equivalents
254
- We have integrated impact equivalents to help people better understand the impacts and have reference points for
255
- standard use cases and everyday activities.
 
256
  ### Request impacts
 
257
  These equivalents are computed based on the request impacts only.
 
258
  #### 🚶‍♂️‍➡️ Walking or 🏃‍♂️‍➡️ running distance
259
- We compare the ⚡️ direct energy consumption with the energy consumption of someone 🚶‍♂️‍➡️ walking or 🏃‍♂️‍➡️ running.
260
- From [runningtools.com](https://www.runningtools.com/energyusage.htm) we consider the following energy values per
261
- physical activity (for someone weighing 70kg):
262
  * 🚶‍♂️‍➡️ walking: $ 196\ kJ/km $ (speed of $ 3\ km/h $)
263
  * 🏃‍♂️‍➡️ running: $ 294\ kJ/km $ (speed of $ 10\ km/h $)
 
264
  We divide the request energy consumption by these values to compute the distance traveled.
 
265
  #### 🔋 Electric Vehicle distance
266
- We compare the ⚡️ direct energy consumption with the energy consumer by a EV car. From
267
- [selectra.info](https://selectra.info/energie/actualites/insolite/consommation-vehicules-electriques-france-2040) or
268
- [tesla.com](https://www.tesla.com/fr_fr/support/power-consumption) we consider an average value of energy consumed per
269
- kilometer of: $ 0.17\ kWh/km $.
270
  We divide the request energy consumption by this value to compute the distance driven by an EV.
 
271
  #### ⏯️ Streaming time
272
- We compare the 🌍 GHG emissions of the request and of streaming a video. From
273
- [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo), we consider that
274
- $ 1\ kgCO2eq $ is equivalent to $ 15.6\ h $ of streaming.
275
  We multiply that value by the GHG emissions of the request to get an equivalent in hours of video streaming.
 
276
  ### Scaled impacts
277
- These equivalents are computed based on the request impacts scaled to a worldwide adoption use case. We imply that the
278
- same request is done 1% of the planet everyday for 1 year, and then compute impact equivalents.
 
279
  $$
280
  I_{scaled} = I_{request} * [1 \% \ \text{of}\ 8B\ \text{people on earth}] * 365\ \text{days}
281
  $$
 
282
  #### Number of 💨 wind turbines or ☢️ nuclear plants
283
- We compare the ⚡️ direct energy consumption (scaled) by the energy production of wind turbines and nuclear power
284
- plants. From [ecologie.gouv.fr](https://www.ecologie.gouv.fr/eolien-terrestre) we consider that a $ 2\ MW $ wind
285
- turbine produces $ 4.2\ GWh $ a year. And from [edf.fr](https://www.edf.fr/groupe-edf/espaces-dedies/jeunes-enseignants/pour-les-jeunes/lenergie-de-a-a-z/produire-de-lelectricite/le-nucleaire-en-chiffres)
286
- we learn that a $ 900\ MW $ nuclear power plant produces $ 6\ TWh $ a year.
287
- We divide the scaled energy consumption by these values to get the number of wind turbines or nuclear power plants
288
- needed.
289
  #### Multiplier of 🇮🇪 Ireland electricity consumption
290
- We compare the ⚡️ direct energy consumption (scaled) by the electricity consumption of Ireland per year. From
291
- [wikipedia.org](https://en.wikipedia.org/wiki/List_of_countries_by_electricity_consumption) we consider the Ireland
292
- electricity consumption to be $ 33\ TWh $ a year for a population of 5M.
293
  We divide the scaled energy consumption by this value to get the equivalent number of "Ireland countries".
 
294
  #### Number of ✈️ Paris ↔ New York City flights
295
- We compare the 🌍 GHG emissions (scaled) of the request and of a return flight Paris ↔ New York City. From
296
- [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny) we consider that a
297
- return flight Paris → New York City → Paris for one passenger emits $ 1,770\ kgCO2eq $ and we consider an overall
298
- average load of 100 passengers per flight.
299
  We divide the scaled GHG emissions by this value to get the equivalent number of return flights.
300
 
301
  #### If you are motivated to help us test and enhance this methodology [contact us](https://genai-impact.org/contact/)! 💪
302
  """
303
 
304
  CITATION_LABEL = "BibTeX citation for EcoLogits Calculator and the EcoLogits library:"
305
- CITATION_TEXT = r"""@misc{ecologits-calculator,
306
  author={Samuel Rincé, Adrien Banse, Valentin Defour, Caroline Jean-Pierre},
307
  title={EcoLogits Calculator},
308
  year={2025},
309
- howpublished= {\url{https://huggingface.co/spaces/genai-impact/ecologits-calculator}},
310
  }
311
- @software{ecologits,
312
- author = {Samuel Rincé, Adrien Banse, Vinh Nguyen and Luc Berton},
313
- publisher = {GenAI Impact},
314
- title = {EcoLogits: track the energy consumption and environmental footprint of using generative AI models through APIs.},
 
 
 
 
 
 
 
315
  }"""
316
 
317
  LICENCE_TEXT = """<p xmlns:cc="http://creativecommons.org/ns#" >
 
5
  </a>
6
  </div>
7
  <div align="center">
8
+ <p style="max-width: 850px; text-align: left">
9
  <b>EcoLogits</b> is a python library that tracks the <b>energy consumption</b> and <b>environmental
10
  footprint</b> of using <b>generative AI</b> models through APIs.
11
  <br>
 
18
  """
19
 
20
  INTRO_TEXT = """
21
+ EcoLogits Calculator is developed and maintained by [GenAI Impact](https://genai-impact.org/) non-profit. To learn more about EcoLogits documentation visit [ecologits.ai](https://ecologits.ai).
 
 
 
 
 
 
 
 
 
22
  """
23
 
24
  HOW_TO_TEXT = """
 
34
  """
35
 
36
  WARNING_CLOSED_SOURCE = """
37
+ The model architecture has not been publicly released, expect lower precision of estimations.
38
  """
39
 
40
  WARNING_MULTI_MODAL = """
41
+ The model architecture is multimodal, expect lower precision of estimations.
42
  """
43
 
44
  WARNING_BOTH = """
45
+ The model architecture has not been publicly released and is multimodal, expect lower precision of estimations.
46
  """
47
 
48
  TOKEN_ESTIMATOR_TEXT = """
 
75
 
76
  ABOUT_TEXT = r"""
77
  ## 🎯 Our goal
78
+
79
  **The main goal of the EcoLogits Calculator is to raise awareness on the environmental impacts of LLM inference.**
80
+
81
+ The rapid evolution of generative AI is reshaping numerous industries and aspects of our daily lives. While these advancements offer some benefits, they also **pose substantial environmental challenges that cannot be overlooked**. Plus the issue of AI's environmental footprint has been mainly discussed at training stage but rarely at the inference stage. That is an issue because **inference impacts for large langauge models (LLMs) can largely overcome the training impacts when deployed at large scales**.
82
+
83
+ At **[GenAI Impact](https://genai-impact.org/) we are dedicated to understanding and mitigating the environmental impacts of generative AI** through rigorous research, innovative tools, and community engagement. Especially, in early 2024 we have launched an new open-source tool called [EcoLogits](https://github.com/genai-impact/ecologits) that tracks the energy consumption and environmental footprint of using generative AI models through APIs.
84
+
85
+
 
 
 
86
  ## 🙋 FAQ
87
+
88
  **How we assess the impacts of closed-source models?**
89
+
90
+ Environmental impacts are calculated based on model architecture and parameter count. For closed-source models, we lack transparency from providers, so we estimate parameter counts using available information. For GPT models, we based our estimates on leaked GPT-4 architecture and scaled parameters count for GPT-4-Turbo and GPT-4o based on pricing differences. For other proprietary models like Anthropic's Claude, we assume similar impacts for models released around the same time with similar performance on public benchmarks. Please note that these estimates are based on assumptions and may not be exact. Our methods are open-source and transparent so you can always see the hypotheses we use.
91
+
 
 
 
 
92
  **Which generative AI models or providers are supported?**
93
+
94
+ To see the full list of **generative AI providers** currently supported by EcoLogits, see the following [documentation page](https://ecologits.ai/providers/). As of today we only support LLMs but we plan to add support for embeddings, image generation, multi-modal models and more. If you are interested don't hesitate to [join us](https://genai-impact.org/contact/) and accelerate our work!
95
+
 
96
  **How to reduce AI environmental impacts?**
97
+
98
+ * Look at **indirect impacts** of your project. Does the finality of your project is impacting negatively the environment?
99
  * **Be frugal** and question your usage or need of AI
100
  * Do you really need AI to solve your problem?
101
  * Do you really need GenAI to solve your problem? (you can read this [paper](https://aclanthology.org/2023.emnlp-industry.39.pdf))
102
  * Use small and specialized models to solve your problem.
103
+ * Evaluate before, during and after the development of your project the environmental impacts with tools like 🌱 [EcoLogits](https://github.com/genai-impact/ecologits) or [CodeCarbon](https://github.com/mlco2/codecarbon) (see [more tools](https://github.com/samuelrince/awesome-green-ai))
 
 
104
  * Restrict the use case and limit the usage of your tool or feature to the desired purpose.
105
  * Do NOT buy new GPUs / hardware
106
  * Hardware manufacturing for data centers is around 50% of the impact.
107
+ * Use cloud instances that are located in low emissions / high energy efficiency data centers (see [electricitymaps.com](https://app.electricitymaps.com/map))
 
108
  * Optimize your models for production
109
  * Quantize your models.
110
  * Use inference optimization tricks.
111
  * Prefer fine-tuning of small and existing models over generalist models.
112
+
113
  **What is the difference between **EcoLogits** and [CodeCarbon](https://github.com/mlco2/codecarbon)?**
114
+
115
+ EcoLogits is focused on estimating the environmental impacts of generative AI (only LLMs for now) used **through API providers (such as OpenAI, Anthropic, Cloud APIs...)** whereas CodeCarbon is more general tool to measure energy consumption and estimate GHG emissions measurement. If you deploy LLMs locally we encourage you to use CodeCarbon to get real numbers of your energy consumption.
116
+
 
117
 
118
  ## 🤗 Contributing
119
+
120
+ We are eager to get feedback from the community, don't hesitate to engage the discussion with us on this [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45) or message us on [LinkedIn](https://www.linkedin.com/company/genai-impact/).
121
+
122
+ We also welcome any open-source contributions on 🌱 **[EcoLogits](https://github.com/genai-impact/ecologits)** or on 🧮 **EcoLogits Calculator**.
123
+
124
 
125
  ## ⚖️ License
126
+
127
  <p xmlns:cc="http://creativecommons.org/ns#" >
128
  This work is licensed under
129
  <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">
 
131
  </a>
132
  <br>
133
  <br>
134
+ <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" height="30" width="30" alt="">
135
+ <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" height="30" width="30" alt="">
136
+ <img style="display:inline-block;height:5px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1" height="30" width="30" alt="">
137
  </p>
138
 
139
  ## 🙌 Acknowledgement
140
+
141
+ We thank [Data For Good](https://dataforgood.fr/) and [Boavizta](https://boavizta.org/en) for supporting the development of this project. Their contributions of tools, best practices, and expertise in environmental impact assessment have been invaluable.
142
+
143
+ We also extend our gratitude to the open-source contributions of 🤗 [Hugging Face](huggingface.com) on the LLM-Perf Leaderboard.
144
+
145
 
146
  ## 🤝 Contact
147
+
148
  For general question on the project, please use the [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45).
149
  Otherwise use our contact form on [genai-impact.org/contact](https://genai-impact.org/contact/).
150
  """
151
 
152
  SUPPORT_TEXT = r"""
153
  ## How to support
154
+
155
  At GenAI Impact, our projects are powered by the passion and dedication of our team.
156
  Since its first release in June 2024, this calculator has been **developped and maintained entirely on a volunteer basis by our members**.
157
  We aim to keep this tool available as a free and open-source ressource for the common good. We need your support to reach this goal, this is how you can help.
 
191
 
192
  METHODOLOGY_TEXT = r"""
193
  ## 📖 Methodology
194
+
195
+ We have developed a methodology to **estimate the energy consumption and environmental impacts for an LLM inference** based on request parameters and hypotheses on the data center location, the hardware used, the model architecture and more.
196
+
197
+ In this section we will only cover the principles of the methodology related to the 🧮 **EcoLogits Calculator**. If you wish to learn more on the environmental impacts modeling of an LLM request checkout the 🌱 [EcoLogits documentation page](https://ecologits.ai/methodology/).
198
+
 
199
  ### Modeling impacts of an LLM request
200
+
201
+ The environmental impacts of an LLM inference are split into the **usage impacts** $I_{request}^u$ to account for electricity consumption and the **embodied impacts** $I_{request}^e$ that relates to resource extraction, hardware manufacturing and transportation. In general terms it can be expressed as follow:
202
+
203
  $$ I_{request} = I_{request}^u + I_{request}^e $$
204
+
205
  $$ I_{request} = E_{request}*F_{em}+\frac{\Delta T}{\Delta L}*I_{server}^e $$
206
+
207
  With,
208
+
209
  * $E_{request}$ the estimated energy consumption of the server and its cooling system.
210
  * $F_{em}$ the electricity mix that depends on the country and time.
211
  * $\frac{\Delta T}{\Delta L}$ the hardware usage ratio i.e. the computation time over the lifetime of the hardware.
212
  * $I_{server}^e$ the embodied impacts of the server.
213
+
214
+ Additionally, to ⚡️ **direct energy consumption** the environmental impacts are expressed in **three dimensions (multi-criteria impacts)** that are:
215
+
216
+ * 🌍 **Global Warming Potential** (GWP): Potential impact on global warming in kgCO2eq (commonly known as GHG/carbon emissions).
217
+ * 🪨 **Abiotic Depletion Potential for Elements** (ADPe): Impact on the depletion of non-living resources such as minerals or metals in kgSbeq.
 
218
  * ⛽️ **Primary Energy** (PE): Total energy consumed from primary sources in MJ.
219
+
220
  ### Principles, Data and Hypotheses
221
+ We use a **bottom-up methodology** to model impacts, meaning that we will estimate the impacts of low-level physical components to then estimate the impacts at software level (in that case an LLM inference). We also rely on **Life Cycle Approach (LCA) proxies and approach** to model both usage and embodied phases with multi-criteria impacts. If you are interested in this approach we recommend you to read the following [Boavizta](https://boavizta.org/) resources.
222
+
 
 
 
223
  * [Digital & environment: How to evaluate server manufacturing footprint, beyond greenhouse gas emissions?](https://boavizta.org/en/blog/empreinte-de-la-fabrication-d-un-serveur)
224
  * [Boavizta API automated evaluation of environmental impacts of ICT services and equipments](https://boavizta.org/en/blog/boavizta-api-automated-evaluation-of-ict-impacts-on-the-environment)
225
  * [Boavizta API documentation](https://doc.api.boavizta.org/)
226
+
227
  We leverage **open data to estimate the environmental impacts**, here is an exhaustive list of our data providers.
228
+ * [LLM-Perf Leaderboard](https://huggingface.co/spaces/optimum/llm-perf-leaderboard) to estimate GPU energy consumption and latency based on the model architecture and number of output tokens.
229
+ * [Boavizta API](https://github.com/Boavizta/boaviztapi) to estimate server embodied impacts and base energy consumption.
 
 
230
  * [ADEME Base Empreinte®](https://base-empreinte.ademe.fr/) for electricity mix impacts per country.
231
+
232
  Finally here are the **main hypotheses** we have made to compute the impacts.
233
+
234
  * ⚠️ **We *"guesstimate"* the model architecture of proprietary LLMs when not disclosed by the provider.**
235
  * Production setup: quantized models running on data center grade servers and GPUs such as A100.
236
  * Electricity mix does not depend on time (help us enhance EcoLogits and work on this [issue](https://github.com/genai-impact/ecologits/issues/42))
237
  * Ignore the following impacts: unused cloud resources, data center building, network and end-user devices... (for now)
238
+
239
  ## Equivalents
240
+
241
+ We have integrated impact equivalents to help people better understand the impacts and have reference points for standard use cases and everyday activities.
242
+
243
  ### Request impacts
244
+
245
  These equivalents are computed based on the request impacts only.
246
+
247
  #### 🚶‍♂️‍➡️ Walking or 🏃‍♂️‍➡️ running distance
248
+
249
+ We compare the ⚡️ direct energy consumption with the energy consumption of someone 🚶���♂️‍➡️ walking or 🏃‍♂️‍➡️ running. From [runningtools.com](https://www.runningtools.com/energyusage.htm) we consider the following energy values per physical activity (for someone weighing 70kg):
250
+
251
  * 🚶‍♂️‍➡️ walking: $ 196\ kJ/km $ (speed of $ 3\ km/h $)
252
  * 🏃‍♂️‍➡️ running: $ 294\ kJ/km $ (speed of $ 10\ km/h $)
253
+
254
  We divide the request energy consumption by these values to compute the distance traveled.
255
+
256
  #### 🔋 Electric Vehicle distance
257
+ We compare the ⚡️ direct energy consumption with the energy consumer by a EV car. From [selectra.info](https://selectra.info/energie/actualites/insolite/consommation-vehicules-electriques-france-2040) or [tesla.com](https://www.tesla.com/fr_fr/support/power-consumption) we consider an average value of energy consumed per kilometer of: $ 0.17\ kWh/km $.
258
+
 
 
259
  We divide the request energy consumption by this value to compute the distance driven by an EV.
260
+
261
  #### ⏯️ Streaming time
262
+
263
+ We compare the 🌍 GHG emissions of the request and of streaming a video. From [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo), we consider that $ 1\ kgCO2eq $ is equivalent to $ 15.6\ h $ of streaming.
264
+
265
  We multiply that value by the GHG emissions of the request to get an equivalent in hours of video streaming.
266
+
267
  ### Scaled impacts
268
+
269
+ These equivalents are computed based on the request impacts scaled to a worldwide adoption use case. We imply that the same request is done 1% of the planet everyday for 1 year, and then compute impact equivalents.
270
+
271
  $$
272
  I_{scaled} = I_{request} * [1 \% \ \text{of}\ 8B\ \text{people on earth}] * 365\ \text{days}
273
  $$
274
+
275
  #### Number of 💨 wind turbines or ☢️ nuclear plants
276
+
277
+ We compare the ⚡️ direct energy consumption (scaled) by the energy production of wind turbines and nuclear power plants. From [ecologie.gouv.fr](https://www.ecologie.gouv.fr/eolien-terrestre) we consider that a $ 2\ MW $ wind turbine produces $ 4.2\ GWh $ a year. And from [edf.fr](https://www.edf.fr/groupe-edf/espaces-dedies/jeunes-enseignants/pour-les-jeunes/lenergie-de-a-a-z/produire-de-lelectricite/le-nucleaire-en-chiffres) we learn that a $ 900\ MW $ nuclear power plant produces $ 6\ TWh $ a year.
278
+
279
+ We divide the scaled energy consumption by these values to get the number of wind turbines or nuclear power plants needed.
280
+
 
281
  #### Multiplier of 🇮🇪 Ireland electricity consumption
282
+
283
+ We compare the ⚡️ direct energy consumption (scaled) by the electricity consumption of Ireland per year. From [wikipedia.org](https://en.wikipedia.org/wiki/List_of_countries_by_electricity_consumption) we consider the Ireland electricity consumption to be $ 33\ TWh $ a year for a population of 5M.
284
+
285
  We divide the scaled energy consumption by this value to get the equivalent number of "Ireland countries".
286
+
287
  #### Number of ✈️ Paris ↔ New York City flights
288
+
289
+ We compare the 🌍 GHG emissions (scaled) of the request and of a return flight Paris ↔ New York City. From [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny) we consider that a return flight Paris → New York City → Paris for one passenger emits $ 1,770\ kgCO2eq $ and we consider an overall average load of 100 passengers per flight.
290
+
 
291
  We divide the scaled GHG emissions by this value to get the equivalent number of return flights.
292
 
293
  #### If you are motivated to help us test and enhance this methodology [contact us](https://genai-impact.org/contact/)! 💪
294
  """
295
 
296
  CITATION_LABEL = "BibTeX citation for EcoLogits Calculator and the EcoLogits library:"
297
+ CITATION_TEXT = """@misc{ecologits_calculator,
298
  author={Samuel Rincé, Adrien Banse, Valentin Defour, Caroline Jean-Pierre},
299
  title={EcoLogits Calculator},
300
  year={2025},
301
+ howpublished= {\\url{https://huggingface.co/spaces/genai-impact/ecologits-calculator}},
302
  }
303
+ @article{ecologits_paper,
304
+ author = {Rincé, Samuel and Banse, Adrien},
305
+ doi = {10.21105/joss.07471},
306
+ journal = {Journal of Open Source Software},
307
+ month = jul,
308
+ number = {111},
309
+ pages = {7471},
310
+ title = {{EcoLogits: Evaluating the Environmental Impacts of Generative AI}},
311
+ url = {https://joss.theoj.org/papers/10.21105/joss.07471},
312
+ volume = {10},
313
+ year = {2025}
314
  }"""
315
 
316
  LICENCE_TEXT = """<p xmlns:cc="http://creativecommons.org/ns#" >