case study

cofair

student researcher sept 2026 - now uc berkeley data discovery python · numpy · pandas

climate offsets for ai responsibility. donors share their spare ai credits so nonprofits can use them. i figured out how much cofair can take from each donor, and when to stop.

cofair homepage: make informed data center decisions with cofair
cofair: climate offsets for ai responsibility

the problem

borrowing

donors share api keys with leftover capacity. we want to use as much as we can, but if we push someone past their budget, they get a surprise bill and probably never donate again.

  • how much can cofair use from each key?
  • how fast should that allowance open up?
  • when does cofair need to stop?

what i built

donor rules

01

fixed cap

donor says $20 a month. we spend $20 and stop.

02

excess capacity

we use whatever's left over, without pushing them past their max.

03

pacing

how fast the allowance opens up: all at once, evenly, or saved for late in the month.

04

safety nets

keep a buffer untouched, and take nothing the first 3 days until we know their habits.

routing just asks can_route() if a task fits on a key.

testing the rules

simulating a month of donors

i simulated a month of steady, bursty, and ramping-up donors, 500 times each, with 10%, 20%, and 30% buffers.

  • steady donors: no overruns either way. pacing not needed.
  • ramp-up donors: no pacing overruns a lot. linear or backloaded gets it to 0%.
  • bursty donors: backloaded wins: $26.44 a cycle at ~5% overruns, vs $24.30 linear and $20.74 none.
chart of average dollars cofair used per cycle vs overrun rate for three pacing strategies with a bursty donor
bursty donors. each line is a pacing strategy, each dot a buffer size. up and left = more money, fewer overruns.

what i did

  • built the forecast engine: donor rules, what's left to spend, and whether a task fits.
  • wrote a key validator for four ai providers.
  • built the pacing sim and buffer sweep with numpy and pandas.
  • wrote 25 unit tests.
  • set up a local db and squashed a usage-loading bug in the old codebase.

what happened

  • backloaded pacing wins for bursty donors. steady ones don't need it.
  • poster at the data discovery symposium on dec 9.
  • made it into cofair's 2027 cohort.
  • next: smarter forecasts, dollars to tokens, and spreading usage fairly across donors.