Generative AI for Performance Engineering: Tailoring Llama-3 for Bottleneck Classification and Optimization Recommendations

This paper presents a novel approach to software performance analysis by integrating traditional profiling techniques with a fine-tuned large language model (LLM), based on the Llama-3 model.  Addressing the challenges of manual profiling – such as overwhelming data volumes and the high expertise required to interpret performance metrics – the study introduces a lightweight AI-powered profiler trained on structured JSON-based profiling logs and code samples.  The model is fine-tuned using parameter-efficient methods (LoRA and QLoRA) to classify performance bottlenecks (e.g., $N+1$ queries, blocking I/O, recursion) and generate actionable recommendations.  The article provides a comprehensive methodology, from dataset preparation and model training to inference and integration, enabling local deployment even without access to high-end GPUs.  This fusion of performance engineering and generative AI showcases a scalable, accessible solution for developers, enhancing the speed and precision of bottleneck detection and representing a step toward more automated software optimization.

  1. Akinshin A.  Pro .NET Benchmarking: The Art of Performance Measurement.  Apress Berkeley, CA (2019).
  2. Russell S., Norvig P.  Artificial Intelligence: A Modern Approach.  Pearson Series in Artificial Intelligence,  Pearson (2020).
  3. Amazone Code Guru documentation. https://aws.amazon.com/codeguru/profiler/features.
  4. Data Dog Flame Graph documentation.  https://www.datadoghq.com/knowledge-center/distributed-tracing/flame-graph/.
  5. Palkar S., Suri S., Bailis P., Zaharia M.  Exploring the Use of Learning Algorithms for Efficient Performance Profiling.  https://people.eecs.berkeley.edu/~matei/papers/2018/mlforsystems_profili....
  6. Unsloth documentation. https://docs.unsloth.ai/get-started/fine-tuning-guide.
  7. BenchmarkDotNet documentation.  https://benchmarkdotnet.org.
  8. Performance profiling with Python.  https://realpython.com/python-profiling.
  9. Wengrow J.  A Common-Sense Guide to Data Structures and Algorithms (2020).
  10. Caelen O., Blete M.-A.  Developing Apps With GPT-4 and ChatGPT: Build Intelligent Chatbots, Content Generators, and More (2023).
  11. https://github.com/d0vbysh/Llama-Fine-Tuning-with-Unsloth.
  12. Unsloth integration documentation on Hugging Face. https://huggingface.co/blog/unsloth-trl.
  13. Nield T.  Essential Math for Data Science. Take Control of Your Data with Fundamental Linear Algebra, Probability, and Statistics (2019).