|
1 | 1 | # Regression Testing
|
2 | 2 |
|
3 |
| -Regression testing ensures recent code changes do not negatively impact the performance and stability of the Inference Gateway. |
| 3 | +Regression testing verifies that recent code changes have not adversely affected the performance or stability of the Inference Gateway. |
4 | 4 |
|
5 |
| -This guide demonstrates how to run regression tests against the Gateway API inference extension. Benchmarks are conducted using the [Latency Profile Generator](https://github.com/AI-Hypercomputer/inference-benchmark/) (LPG) to simulate traffic and collect detailed metrics. |
| 5 | +This guide explains how to run regression tests against the Gateway API inference extension using the [Latency Profile Generator (LPG)](https://github.com/AI-Hypercomputer/inference-benchmark/) to simulate traffic and collect performance metrics. |
6 | 6 |
|
7 | 7 | ## Prerequisites
|
8 | 8 |
|
9 |
| -Refer to the common setup instructions in [benchmark guide](/site-src/performance/benchmark/index.md) to deploy the inference extension, sample model server, scale the vLLM deployment, and get the Gateway IP. |
| 9 | +Refer to the [benchmark guide](/site-src/performance/benchmark/index.md) for common setup steps, including deployment of the inference extension, model server setup, scaling the vLLM deployment, and obtaining the Gateway IP. |
10 | 10 |
|
11 |
| -## Create the LPG Dockerfile image |
| 11 | +## Create the LPG Docker Image |
12 | 12 |
|
13 |
| -Follow the instructions [here]( https://github.com/AI-Hypercomputer/inference-benchmark/blob/1c92df607751a7ddb04e2152ed7f6aaf85bd9ca7/README.md) to create the LPG image. Specifically, once you are in the inference-benchmark directory follow the steps below: |
| 13 | +Follow the detailed instructions [here](https://github.com/AI-Hypercomputer/inference-benchmark/blob/1c92df607751a7ddb04e2152ed7f6aaf85bd9ca7/README.md) to build the LPG Docker image: |
14 | 14 |
|
15 |
| - * Create a repository in artifact registry to push the image there and use it on your cluster. |
| 15 | +* Create an artifact repository: |
16 | 16 |
|
17 |
| -``` |
| 17 | +```bash |
18 | 18 | gcloud artifacts repositories create ai-benchmark --location=us-central1 --repository-format=docker
|
19 | 19 | ```
|
20 | 20 |
|
21 |
| -* For Inifinity-Instruct and billsum datasets run |
| 21 | +* Prepare datasets for [Infinity-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) and [billsum]((https://huggingface.co/datasets/FiscalNote/billsum)): |
22 | 22 |
|
23 |
| -``` |
| 23 | +```bash |
24 | 24 | pip install datasets transformers numpy pandas tqdm matplotlib
|
25 | 25 | python datasets/import_dataset.py --hf_token YOUR_TOKEN
|
26 | 26 | ```
|
27 | 27 |
|
28 |
| -* Build a container to run the benchmark directly on a Kubernetes cluster |
29 |
| -using the specified Dockerfile. |
| 28 | +* Build the benchmark Docker image: |
30 | 29 |
|
31 |
| -``` |
| 30 | +```bash |
32 | 31 | docker build -t inference-benchmark .
|
33 | 32 | ```
|
34 | 33 |
|
35 |
| -* Push the image to the repository. |
| 34 | +* Push the Docker image to your artifact registry: |
36 | 35 |
|
37 |
| -``` |
| 36 | +```bash |
38 | 37 | docker tag inference-benchmark us-central1-docker.pkg.dev/{project-name}/ai-benchmark/inference-benchmark
|
39 | 38 | docker push us-central1-docker.pkg.dev/{project-name}/ai-benchmark/inference-benchmark
|
40 | 39 | ```
|
41 | 40 |
|
42 |
| - |
43 | 41 | ## Conduct Regression Tests
|
44 | 42 |
|
45 |
| -Use the configurations below tailored to evaluate performance shifts before and after code changes. They assume NVIDIA H100 GPUs (80 GB)—adjust them as needed for different hardware, backend counts, or datasets. |
| 43 | +Run benchmarks using the configurations below, which are optimized for NVIDIA H100 GPUs (80 GB). Adjust configurations for other hardware as necessary. |
46 | 44 |
|
47 | 45 | ### Test Case 1: Single Workload
|
48 | 46 |
|
49 |
| -- **Dataset:** `billsum_conversations.json` generated from the provided Python script `./tools/benchmark/import-datasets`. |
50 |
| - * `billsum_conversations.json` is the [huggingface dataset](https://huggingface.co/datasets/FiscalNote/billsum) converted to prompt → response style conversation json that can be consumed by the benchmarking script. |
51 |
| -- **Model:** [Llama 3 (8B)](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct)(*critical*) |
52 |
| -- **Hardware:** NVIDIA H100 GPUs (80 GB) |
53 |
| -- **Replicas:** 10 replicas using vLLM |
54 |
| -- **Request Rates Range:** 300-350 in steps of 10 |
| 47 | +- **Dataset:** `billsum_conversations.json` (created from [HuggingFace billsum dataset](https://huggingface.co/datasets/FiscalNote/billsum)). |
| 48 | + * This dataset features long prompts, making it prefill-heavy and ideal for testing scenarios that emphasize initial token generation. |
| 49 | +- **Model:** [Llama 3 (8B)](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) (*critical*) |
| 50 | +- **Replicas:** 10 (vLLM) |
| 51 | +- **Request Rates:** 300–350 (increments of 10) |
55 | 52 |
|
56 |
| -We have provided an example manifest `./config/manifests/regression-testing/single-workload-regression.yaml` here showing the configrations above for the LPG script. |
| 53 | +Refer to example manifest: |
| 54 | +`./config/manifests/regression-testing/single-workload-regression.yaml` |
57 | 55 |
|
58 | 56 | ### Test Case 2: Multi-LoRA
|
59 | 57 |
|
60 |
| -- **Dataset:** `Infinity-Instruct_conversations.json` generated from the provided Python script `./tools/benchmark/import-datasets`. |
61 |
| - * `Infinity-Instruct_conversations.json` is the [huggingface dataset](https://huggingface.co/datasets/BAAI/Infinity-Instruct) converted to prompt → response style conversation json that can be consumed by the benchmarking script. |
| 58 | +- **Dataset:** `Infinity-Instruct_conversations.json` (created from [HuggingFace Infinity-Instruct dataset](https://huggingface.co/datasets/BAAI/Infinity-Instruct)). |
| 59 | + * This dataset has long outputs, making it decode-heavy and useful for testing scenarios focusing on sustained token generation. |
62 | 60 | - **Model:** [Llama 3 (8B)](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct)
|
63 |
| -- **LoRA:** 15 adapters using `nvidia/llama-3.1-nemoguard-8b-topic-control` (rank 8, <1% of base model size) (all adapters are *critical*) |
| 61 | +- **LoRA Adapters:** 15 adapters (`nvidia/llama-3.1-nemoguard-8b-topic-control`, rank 8, critical) |
64 | 62 | - **Hardware:** NVIDIA H100 GPUs (80 GB)
|
65 |
| -- **Traffic Split:** `5×0.12, 5×0.06, 5×0.02` |
66 |
| - * 60% traffic to first five adapters, 30% to next five, 10% to final five—simulating production/dev/test tiers. |
| 63 | +- **Traffic Distribution:** 60% (first 5 adapters, each 12%), 30% (next 5, each 6%), 10% (last 5, each 2%) simulating prod/dev/test tiers |
67 | 64 | - **Max LoRA:** 3
|
68 |
| -- **Replicas:** 10 replicas using vLLM |
69 |
| -- **Request Rates Range:** 20–200 in steps of 20 |
| 65 | +- **Replicas:** 10 (vLLM) |
| 66 | +- **Request Rates:** 20–200 (increments of 20) |
70 | 67 |
|
71 |
| -- Update your vLLM and inferencemodel deployment to support multiLora as described above. |
72 |
| - * vllm deployment: `./config/manifests/regression-testing/vllm/multi-lora-deployment.yaml` |
73 |
| - * inferencemodel:: `./config/manifests/inferencemodel.yaml` |
| 68 | +Optionally, you can also run benchmarks using the `ShareGPT` dataset for additional coverage. |
74 | 69 |
|
75 |
| -We have provided an example manifest `./config/manifests/regression-testing/multi-lora-regression.yaml` showing the configrations above for the LPG script. |
| 70 | +Update deployments for multi-LoRA support: |
| 71 | +- vLLM Deployment: `./config/manifests/regression-testing/vllm/multi-lora-deployment.yaml` |
| 72 | +- InferenceModel: `./config/manifests/inferencemodel.yaml` |
76 | 73 |
|
| 74 | +Refer to example manifest: |
| 75 | +`./config/manifests/regression-testing/multi-lora-regression.yaml` |
77 | 76 |
|
78 | 77 | ### Execute Benchmarks
|
79 | 78 |
|
80 |
| -Collect benchmarks in two phases: first before making your changes, and then after applying your changes to the Inference Gateway. |
| 79 | +Benchmark in two phases: before and after applying your changes: |
81 | 80 |
|
82 |
| -- **Before applying changes:** |
| 81 | +- **Before changes:** |
83 | 82 |
|
84 | 83 | ```bash
|
85 | 84 | benchmark_id='regression-before' ./tools/benchmark/download-benchmark-results.bash
|
86 | 85 | ```
|
87 | 86 |
|
88 |
| -- **After applying changes:** |
| 87 | +- **After changes:** |
89 | 88 |
|
90 | 89 | ```bash
|
91 | 90 | benchmark_id='regression-after' ./tools/benchmark/download-benchmark-results.bash
|
92 | 91 | ```
|
93 | 92 |
|
94 | 93 | ## Analyze Benchmark Results
|
95 | 94 |
|
96 |
| -Open the notebook `./tools/benchmark/benchmark.ipynb`, and run each cell. In the last cell update the benchmark ids with `regression-before` and `regression-after`. This will compares latency and throughput between `regression-before` and `regression-after` and perform regression analysis. Specifically, check R² values for: |
97 |
| - |
98 |
| -- **Prompts Attempted and Succeeded:** Expect R² = 1 |
99 |
| -- **Output Tokens per Minute, P90 per Output Token Latency, and P90 Latency:** Expect R² values close to 1 (allowing acceptable variance). |
| 95 | +Use the provided Jupyter notebook (`./tools/benchmark/benchmark.ipynb`) to analyze results: |
100 | 96 |
|
101 |
| -Identify any significant performance shifts, investigate their root causes, and ensure deployments maintain expected performance standards. |
| 97 | +- Update benchmark IDs to `regression-before` and `regression-after`. |
| 98 | +- Compare latency and throughput metrics, performing regression analysis. |
| 99 | +- Check R² values specifically: |
| 100 | + - **Prompts Attempted/Succeeded:** Expect R² ≈ 1 |
| 101 | + - **Output Tokens per Minute, P90 per Output Token Latency, P90 Latency:** Expect R² close to 1 (allow minor variance). |
102 | 102 |
|
| 103 | +Identify significant deviations, investigate causes, and confirm performance meets expected standards. |
0 commit comments