A very primitive tool for evaluating the energy efficiency of MLX-based language models by measuring power consumption during text generation.
- Real-time power monitoring during text generation
- Detailed energy consumption metrics
- Token generation speed analysis
- Cost projections for large-scale generation
- CSV export of detailed metrics
- Support for custom kWh cost calculations
- Python 3.8+
- MLX framework
- GPU power monitoring capabilities
gpu_power_monitor_continuous.pyrunning in the background
- Clone the repository:
git clone https://github.com/mark-lord/mlx-efficiency-eval.git
cd mlx-efficiency-eval- Install dependencies:
pip install -r requirements.txt- Start the power monitoring service:
python gpu_power_monitor_continuous.py- Run the generation tool:
python record-generate.py-
Follow the interactive prompts to:
- Enter your prompt
- Specify the number of tokens to generate
- Name your metrics CSV file
- Set the cost per kWh (default: $0.35)
-
The tool will:
- Generate the requested text
- Monitor power consumption
- Calculate efficiency metrics
- Save detailed data to CSV
- Display a comprehensive summary
The tool generates two types of output:
-
Real-time CSV file with:
- Timestamp
- GPU Power (mW)
- Cumulative Tokens
- Cumulative Energy (J)
- Cumulative kWh
-
Summary statistics including:
- Total tokens generated
- Time taken
- Generation speed
- Average power usage
- Energy efficiency
- Projections for 1M tokens
MIT License - see LICENSE file for details