🧠 LLM Resource Planner
Estimate GPU VRAM requirements for Hugging Face LLMs without downloading model weights.
The LLM Resource Planner is a lightweight Python CLI tool that analyzes Hugging Face model configurations and estimates the GPU memory required for inference.
It enables developers to perform AI infrastructure planning before downloading large model checkpoints.
🚀 Quick Start
Install
pip install llm-resource-planner
Run the planner
llm-plan microsoft/Phi-3.5-mini-instruct
Example output:
--- Analyzing microsoft/Phi-3.5-mini-instruct ---
Estimated Parameters: ~3.62B
Memory (Weights): 6.75 GB
Memory (KV Cache @ 4k): 1.50 GB
Total Recommended VRAM: 8.55 GB
Example Models
llm-plan meta-llama/Meta-Llama-3-8B
llm-plan mistralai/Mistral-7B-Instruct
llm-plan microsoft/Phi-3.5-mini-instruct
CLI Usage
Show command help:
llm-plan --help
Basic usage:
llm-plan <huggingface-model-id>
Example:
llm-plan meta-llama/Meta-Llama-3-8B
GPU Fit Check
You can optionally check whether a model fits within a given GPU memory budget:
llm-plan meta-llama/Meta-Llama-3-8B --gpu 24
Example output:
Total Recommended VRAM: 19.82 GB
GPU Memory Provided: 24.00 GB
✔ Model should fit in available VRAM
What the Tool Does
The planner retrieves a model's configuration metadata from Hugging Face using:
transformers.AutoConfig
It extracts architectural parameters such as:
- hidden size
- number of transformer layers
- number of attention heads
Using these values, the tool estimates:
- Model parameter count
- Memory required for model weights
- Memory required for the attention KV cache
- A buffered VRAM estimate for inference
This analysis occurs without downloading model weights.
Estimation Method
The tool uses a heuristic approximation commonly applied to transformer architectures.
Parameter Count Estimate
params ≈ hidden_size² × num_layers × 12
This approximates the parameter count for standard transformer blocks.
Weight Memory
weight_memory = params × dtype_bytes
Where precision is assumed to be:
| Precision | Bytes |
|---|---|
| FP32 | 4 |
| FP16 | 2 |
| INT8 | 1 |
| INT4 | 0.5 |
(Current CLI defaults to FP16.)
KV Cache Estimate
The KV cache memory is approximated as:
kv_cache = 2 × hidden_size × num_layers × bytes_per_param × context_length
The current implementation assumes:
context_length = 4096
Recommended VRAM
A safety margin is applied:
total_vram ≈ weight_memory + (kv_cache × 1.2)
This accounts for runtime memory overhead.
Authentication
Some Hugging Face models require authentication.
Set your Hugging Face token:
export HUGGINGFACE_API_TOKEN="your_token_here"
The planner will automatically use the token when retrieving model metadata.
Development Installation
Clone the repository:
git clone https://github.com/deepagency/llm-resource-planner.git
cd llm-resource-planner
Install in editable mode:
pip install -e .
Run the tool:
llm-plan microsoft/Phi-3.5-mini-instruct
Assumptions and Limitations
This tool provides heuristic estimates.
Results may differ depending on:
- inference engine (
vLLM,Ollama,TensorRT-LLM, etc.) - batching strategies
- runtime graph optimizations
- GPU memory fragmentation
- custom model architectures
The estimator is primarily designed for standard transformer architectures.
For production deployments, maintain a 10–20% safety margin.
🤝 Contributing
Contributions are welcome.
If you discover:
- models producing inaccurate estimates
- improved parameter estimation heuristics
- support for additional architectures
please open an Issue or submit a Pull Request.
See CONTRIBUTING.md for development guidelines.
📄 License
This project is licensed under the MIT License.
See the LICENSE file for details.
Built for the open-source AI community.
Metadata
Release files for llm-resource-planner 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llm_resource_planner-0.2.0.tar.gz | 5.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_resource_planner-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / llm_resource_planner-0.2.0.tar.gz
| Download URL | llm_resource_planner-0.2.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
706f611672ddd833f7903e2471239e4f95a5b057004ba3878209b0796ce40272
|
|
BLAKE2b-256 checksum How to use checksums |
577b5c06286e541159d1e9a6cb4fe10bb23ac386efd4dfe8bf4133cbb6680cf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / llm_resource_planner-0.2.0-py3-none-any.whl
| Download URL | llm_resource_planner-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7e28d69e14fb1654a814f46e12dc00d56b6ce71bac7123b07424a2d9a24d5ac
|
|
BLAKE2b-256 checksum How to use checksums |
c413a0f0c1c0c85f49a182db08484401bc4fbc1a4d6df1fdcdcce6e1f717980c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for llm-resource-planner 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.