Skip to main content Switch to mobile version green-ai-research-kit 0.1.0 Design, run and report green AI experiments: randomised repeated designs, crash-safe resumable runs (Colab and Google Drive friendly), robust statistics (bootstrap intervals, ratio of medians, Mann-Whitney with Holm), drift checks, Pareto fronts, LaTeX tables, a methods paragraph and an energy-reporting checklist.
pip install green-ai-research-kit Copy PIP instructions
Run green AI experiments the way reviewers expect: randomised and repeated, safe from Colab disconnects, with proper statistics, LaTeX tables, a methods paragraph and an energy-reporting checklist.
pip install "green-ai-research-kit[bench,scipy]" Energy results are easy to get wrong. CPUs heat up and slow down, turbo budgets run out, cloud VMs share hardware with strangers, and a single run tells you almost nothing about the next one. Henderson et al. (JMLR 2020) sampled 100 NeurIPS 2019 papers: none reported carbon, and only one reported any energy figure. This kit handles the parts that make energy and latency results trustworthy, so you can spend your time on the research question.
Quick start: the command line
You need a CSV of input rows and one or more saved models (XGBoost .json, LightGBM .txt, CatBoost .cbm, or scikit-learn .joblib).
Step 1. Run the experiment. This compares two models at batch sizes 1 and 1024, five times each, in shuffled order:
green-ai-research-kit bench \ --models xgb=xgb.json,lgbm=lgbm.txt \ --data test.csv --drop target \ --batches 1,1024 --threads 1 --repeats 5 \ --out results/results.jsonl It writes three files next to each other:
results.plan.csv: the shuffled plan (kept so a rerun follows the same order)
results.jsonl: one line per finished run
results.environment.json: CPU, cores, platform, library versions, governor, turbo, RAPL status
If it stops for any reason, run the same command again. Finished runs are skipped.
green-ai-research-kit analyze results/results.jsonl \ --by model,batch --metric joules_per_1k --unit J \ --baseline model=xgb,batch=1 \ --metric2 latency_ms_p50 \ --grid 400 --grid-source "Ember 2024 world average" \ --md results/report.md --latex results/table.tex report.md holds the methods paragraph, the results table, the comparison with the baseline, the Pareto front, any warnings and the checklist. table.tex is ready to paste into a paper (it needs \usepackage{booktabs}).
Metrics greeninfer records for each run: joules_per_1k, latency_ms_p50, latency_ms_p95, us_per_row. Use --maximize2 when the second metric is better when higher, such as accuracy.
Quick start: Google Colab with Google Drive
Open examples/colab_experiment.ipynb in Colab. It walks through a full experiment (XGBoost, LightGBM and a random forest on the public Adult census dataset, no login needed) and saves the data, models, plan, results, report, LaTeX table and plot to MyDrive/green_research/. After a disconnect, press Runtime > Run all again and it continues where it stopped.
Colab has no RAPL counters, so energy there is an estimate (CPU time x TDP per core). The methods paragraph says this for you. For measured energy, run the same commands on a Linux machine with an Intel or AMD CPU as root.
Quick start: Python, with your own measurement
The runner works with any function that takes a configuration and returns numbers. Here is an LLM-quantisation experiment as an example:
from green_research import plan, run, load_results, summarize, compare, power_warnings, table_latex runs = plan({"model": ["q4", "q8", "fp16"], "prompt_len": [128, 2048]}, repeats=5, seed=42) def measure(cfg): # your code: load the model, generate, read an energy meter return {"joules": ..., "tokens_per_s": ..., "accuracy": ...} run(runs, measure, "/content/drive/MyDrive/quant/results.jsonl", cooldown_s=10) rows = load_results("/content/drive/MyDrive/quant/results.jsonl") summary = summarize(rows, ["model", "prompt_len"], "joules") comparison = compare(rows, ["model", "prompt_len"], "joules", {"model": "fp16", "prompt_len": "128"}) print(power_warnings(summary, len(comparison))) print(table_latex(summary, ["model", "prompt_len"], "joules", "J")) Things to know:
Every metric you return is stored with an m_ prefix (m_joules). The analysis functions find it with or without the prefix.
If your function raises an error, the run is saved with the error message and the experiment continues. Failed runs are left out of the statistics and counted in the report. Pass stop_on_error=True to stop instead.
cooldown_s pauses between runs so the CPU or GPU can return to a steady temperature.
Plans are reproducible: the same factors, repeats and seed give the same order.
How the statistics work
How many repeats? The smallest two-sided Mann-Whitney p-value with n runs in each group is 2 / C(2n, n): 0.1 for 3 runs, 0.029 for 4, 0.008 for 5. Holm multiplies the smallest p by the number of comparisons. The kit checks this and tells you the number of repeats you need. Five repeats is the minimum we recommend; use more when you compare many configurations.
The report ticks off what it can find and leaves the rest for you:
Processor model; cores and threads; operating system; Python and library versions
How energy was measured (RAPL counters or an estimate) and what it covers
Whether idle power was subtracted
CPU frequency governor and turbo state; thread settings
Number of repetitions and run order; spread of results
Data-centre PUE (if converting to facility energy); grid carbon intensity with its source and year
Total compute used by the experiments themselves
Based on Henderson et al. (2020) and the Green Algorithms reporting guidance (Lannelongue, Grealey and Inouye, 2021).
Sustainable Development Goals
Henderson, P., Hu, J., Romoff, J., Brunskill, E., Jurafsky, D. and Pineau, J. (2020). Towards the Systematic Reporting of the Energy and Carbon Footprints of Machine Learning. Journal of Machine Learning Research, 21(248), 1-43.
Kalibera, T. and Jones, R. (2013). Rigorous Benchmarking in Reasonable Time. ISMM 2013, ACM.
Lannelongue, L., Grealey, J. and Inouye, M. (2021). Green Algorithms: Quantifying the Carbon Footprint of Computation. Advanced Science, 8(12), 2100707.
Holm, S. (1979). A Simple Sequentially Rejective Multiple Test Procedure. Scandinavian Journal of Statistics, 6(2), 65-70.
If the kit helps your research, please cite it (see CITATION.cff) and the measurement tool you used.
MIT. Built by Ahmad Zia, who works on green and efficient AI inference.
Guide, help and author
Full guide with examples and FAQs: www.ahmadzia.com/tools/green-ai-research-kit
Background reading: How much energy does an AI query use?
All 30 free tools and agent skills: ahmadzia.com/tools · ahmadzia.com/skills
Want it set up, fixed or tuned for your store? Book a free call
Research behind this tool
Bin-reduction GBDT training and inference energy on 100,000 drug reviews, JCBI 2026: doi:10.56979/1102/2026/1477
Built by Ahmad Zia (Muhammad Ahmad Zia), an AI consultant for ecommerce since 2020 and green AI researcher at the University of Lahore. Research · Google Scholar · ORCID · LinkedIn · GitHub
More green AI research tools
greeninfer: Measure latency, energy, CO2 and cost per prediction for tree models
All 30 tools and agent skills: github.com/MuhammadAhmadZia · ahmadzia.com/tools
Released: Dec 5, 2026
Author: Muhammad Ahmad Zia
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
benchmarking colab energy experiment-design green-ai inference latex reproducibility research statistics sustainable-ai
Development Status 3 - Alpha
Intended Audience Science/Research
Programming Language Python :: 3
Topic Scientific/Engineering
Release files for green-ai-research-kit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 47.4 kB
Release files / green_ai_research_kit-0.1.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Security for green-ai-research-kit 0.1.0
Both files in this release have been uploaded with provenance metadata.
With provenance green_ai_research_kit-0.1.0.tar.gz Dec 5, 2026
Attestation for green_ai_research_kit-0.1.0.tar.gz
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 5, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











