-
Notifications
You must be signed in to change notification settings - Fork 117
[LFX Term 1 2026] Restoring LLM Edge Benchmark Suite Single Task Bench #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NishantSinghhhhh
wants to merge
3
commits into
kubeedge:main
Choose a base branch
from
NishantSinghhhhh:Restoration-llm-edge-benchmark
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−41
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
113 changes: 112 additions & 1 deletion
113
examples/llm-edge-benchmark-suite/single_task_bench/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,113 @@ | ||
| Large Language Model Edge Benchmark Suite: Implementation on KubeEdge-lanvs | ||
| # llm-edge-benchmark-suite single_task_bench | ||
|
|
||
| This guide outlines the complete setup, configuration, and execution process for running the Large Language Model (LLM) benchmarking suite using the [Ianvs](https://github.com/kubeedge/ianvs) edge computing framework. | ||
|
|
||
| This specific environment is configured to run the **Single Task Learning** paradigm, evaluating LLM inference performance (latency, throughput, and Time-To-First-Token) using `llama-cpp-python` with quantized models (e.g., Qwen 1.5 0.5B GGUF). | ||
|
|
||
| --- | ||
|
|
||
| ## 📋 Prerequisites | ||
|
|
||
| Before running the benchmark, ensure you have the following ready: | ||
| 1. **Ianvs Framework**: Installed and configured. | ||
| 2. **Virtual Environment**: Your active Ianvs virtual environment (e.g., `ianvs_env`). | ||
| 3. **C++ Build Tools**: Required for compiling `llama.cpp` bindings (e.g., `build-essential` on Ubuntu). | ||
|
|
||
| --- | ||
|
|
||
| ## 🛠️ Step 1: Environment Setup | ||
|
|
||
| First, activate your Ianvs virtual environment: | ||
| ```bash | ||
| source /path/to/your/ianvs_env/bin/activate | ||
| ``` | ||
|
|
||
| Navigate to the benchmark directory: | ||
| ```bash | ||
| cd /home/nishant/LOCAL_DISK_D/ianvs/examples/llm-edge-benchmark-suite/single_task_bench | ||
| ``` | ||
|
|
||
| Install the required dependencies using the provided `requirements.txt`: | ||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
| *(Note: If `requirements.txt` is missing, ensure you install `llama-cpp-python>=0.2.20`, `torch`, `transformers`, `pyyaml`, and `psutil`).* | ||
|
|
||
| --- | ||
|
|
||
| ## 📥 Step 2: Download the Model | ||
|
|
||
| The benchmark requires a localized `.gguf` model file. By default, this suite uses the `Qwen1.5-0.5B-Chat` model. | ||
|
|
||
| Create the target directory and use a resumable download command (`wget -c`) to prevent file corruption: | ||
|
|
||
| ```bash | ||
| mkdir -p /home/nishant/LOCAL_DISK_D/ianvs/models/qwen | ||
| wget -c -O /home/nishant/LOCAL_DISK_D/ianvs/models/qwen/qwen_1_5_0_5b.gguf [https://huggingface.co/Qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/main/qwen1_5-0_5b-chat-q4_k_m.gguf](https://huggingface.co/Qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/main/qwen1_5-0_5b-chat-q4_k_m.gguf) | ||
| ``` | ||
| **Verification:** Ensure the downloaded file is approximately `398MB` to confirm it is not corrupted. | ||
|
|
||
| --- | ||
|
|
||
| ## ⚙️ Step 3: Configuration Alignment | ||
|
|
||
| Ianvs requires strict configuration alignment. Double-check the following YAML files to ensure paths and paradigms are correct: | ||
|
|
||
| ### 1. Test Environment (`testenv/testenv.yaml`) | ||
| Ensure all dataset paths are set to **absolute paths**. Relative paths will cause parsing errors. | ||
| ```yaml | ||
| dataset: | ||
| train_data: "/home/nishant/LOCAL_DISK_D/ianvs/dataset/data.jsonl" # Must be absolute | ||
| ``` | ||
|
|
||
| ### 2. Algorithm Configuration (`testalgorithms/algorithm.yaml`) | ||
| Ensure the `paradigm_type` is correctly set for standard single-task inference, and the model path is absolute: | ||
| ```yaml | ||
| paradigm_type: singletasklearning # Do NOT use 'singletasklearningwithcompression' here | ||
| modules: | ||
| basemodel: | ||
| model_path: "/home/nishant/LOCAL_DISK_D/ianvs/models/qwen/qwen_1_5_0_5b.gguf" | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🧩 Step 4: Algorithm Script (`basemodel.py`) | ||
|
|
||
| The Ianvs `SingleTaskLearning` paradigm requires the model class to strictly adhere to the machine learning lifecycle contract. Your `LlamaCppModel` class in `basemodel.py` must include: | ||
|
|
||
| 1. **Pipeline Methods:** `preprocess` and `postprocess` with optional arguments to prevent `TypeError` exceptions. | ||
| 2. **Training Bypass:** A safe no-op `train` method, since we are using pre-trained weights for inference. | ||
| 3. **TTFT Measurement:** The `predict` method must use `stream=True` to accurately measure `prefill_latency` (Time-to-First-Token). | ||
|
|
||
| *Example Snippet of required methods:* | ||
| ```python | ||
| def preprocess(self, data=None, **kwargs): | ||
| return data | ||
|
|
||
| def postprocess(self, predict_output=None, **kwargs): | ||
| return predict_output | ||
|
|
||
| def train(self, train_data, valid_data=None, **kwargs): | ||
| return kwargs.get("model_path", "") | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Step 5: Execution | ||
|
|
||
| Once the setup and configurations are validated, run the benchmarking job from your terminal: | ||
|
|
||
| ```bash | ||
| ianvs -f /home/nishant/LOCAL_DISK_D/ianvs/examples/llm-edge-benchmark-suite/single_task_bench/benchmarkingjob.yaml | ||
| ``` | ||
|
|
||
| ### Expected Output | ||
| The Ianvs core will parse the configurations, load the `LlamaCppModel`, and execute the inference loop. Upon completion, a `workspace` directory will be generated containing the logs and a final leaderboard table (`rank.csv`). | ||
|
|
||
| You should see an output table similar to this: | ||
| ```text | ||
| +------+-----------+---------+------------+-----------------+--------------------+---------------+ | ||
| | rank | algorithm | latency | throughput | prefill_latency | paradigm | basemodel | | ||
| +------+-----------+---------+------------+-----------------+--------------------+---------------+ | ||
| | 1 | llama-cpp | 171.29 | 0.0058 | 171.27 | singletasklearning | LlamaCppModel | | ||
| +------+-----------+---------+------------+-----------------+--------------------+---------------+ |
12 changes: 12 additions & 0 deletions
12
examples/llm-edge-benchmark-suite/single_task_bench/requirements.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # LLM Core Execution | ||
| llama-cpp-python>=0.2.20 | ||
|
|
||
| # Machine Learning & Neural Network Basics | ||
| torch>=2.0.0 | ||
| transformers>=4.35.0 | ||
| numpy>=1.24.0 | ||
|
|
||
| # Ianvs Utilities & Data Handling | ||
| pyyaml>=6.0 | ||
| pandas>=2.0.0 | ||
| requests>=2.31.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.