Skip to content
Latchkey

Benchmarks workflow (learning-at-home/hivemind)

The Benchmarks workflow from learning-at-home/hivemind, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get caching, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: learning-at-home/hivemind.github/workflows/run-benchmarks.ymlLicense MITView source

What it does

This is the Benchmarks workflow from the learning-at-home/hivemind repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Benchmarks

on:
  push:
    branches: [ master ]
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  run_benchmarks:

    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.11
      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: Key-v1-3.11-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install -r requirements-dev.txt
      - name: Build bitsandbytes
        run: |
          pip install bitsandbytes==0.45.2
      - name: Build hivemind
        run: |
          pip install .
      - name: Benchmark
        run: |
          cd benchmarks
          python benchmark_throughput.py --preset minimalistic
          python benchmark_tensor_compression.py
          python benchmark_dht.py

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Benchmarks
 
on:
  push:
    branches: [ master ]
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true
 
jobs:
  run_benchmarks:
 
    runs-on: latchkey-small
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: 3.11
      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: Key-v1-3.11-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install -r requirements-dev.txt
      - name: Build bitsandbytes
        run: |
          pip install bitsandbytes==0.45.2
      - name: Build hivemind
        run: |
          pip install .
      - name: Benchmark
        run: |
          cd benchmarks
          python benchmark_throughput.py --preset minimalistic
          python benchmark_tensor_compression.py
          python benchmark_dht.py
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow