# Memory Requirements for Running LLM

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmemory-requirements-for-running-llm%2F57282%3E%5C
**Category:** Beginners\
**Created:** [October 3, 2023, 7:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmemory-requirements-for-running-llm%2F57282 "2023-10-03T19:05:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjp94](https://avatars.discourse-cdn.com/v4/letter/p/b5e925/32.png) [@pjp94](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpjp94)%5C
**Post date:** [October 3, 2023, 7:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmemory-requirements-for-running-llm%2F57282%2F1 "2023-10-03T19:05:39Z")

</div>

Are there any rule of thumb calculations for determining memory requirement (as a function of number of model parameters) for an LLM model. I’m referring to a base model (no quantization) with full fine-tuning vs no fine-tuning that I would like to run inference on. Lets use Llama2 7B as an example. Below is what I’ve seen for pre-training, but not sure how this exactly translates over to loading in the pre-trained base model and working with it. The disconnect here for me is I’m unsure what components of the model exactly are getting stored in memory. Any help appreciated!  
 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/b/0/b0119ecd996ad707631349b32a343d3ceea3b037.png)

---

<div class="post-metadata">

**Author:** ![MattiLinnanvuori](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MattiLinnanvuori](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMattiLinnanvuori)%5C
**Post date:** [October 4, 2023, 4:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmemory-requirements-for-running-llm%2F57282%2F2 "2023-10-04T04:31:12Z")

</div>

[https://huggingface.co/spaces/hf-accelerate/model-memory-usage](https://huggingface.co/spaces/hf-accelerate/model-memory-usage) is a tool.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [May 8, 2024, 7:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmemory-requirements-for-running-llm%2F57282%2F3 "2024-05-08T19:30:35Z")

</div>

There’s also this nice blog post: [Calculating GPU memory for serving LLMs | Substratus.AI](https://www.substratus.ai/blog/calculating-gpu-memory-for-llm)
