# Number of parameters reduced after loading in 4bit

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%3E%5C
**Category:** Models\
**Created:** [August 9, 2023, 1:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140 "2023-08-09T13:26:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wally1002](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wally1002/32/18405_2.png) [@wally1002](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwally1002)%5C
**Post date:** [August 9, 2023, 1:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F1 "2023-08-09T13:26:25Z")

</div>

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/a/3/a3fa72e52e6fce49cbee7d54cd9f27b1fa573bed.png)  
Why is there a decrease in no of parameters in 4bit?

---

<div class="post-metadata">

**Author:** ![saul95](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@saul95](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsaul95)%5C
**Post date:** [September 4, 2023, 4:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F2 "2023-09-04T16:10:37Z")

</div>

When we load in 4 bit, the linear layers are replaced with linear 4bit layers. These layers have half the number of parameters. But still I am also not clear how number of parameters become half.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/2/322aecffcc900fc6c753e7bb9e65f3455e27f831.png)  
 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/e/3e17981b3ea5545cfa4d1c56921fdc0fbfb29c32.png)

---

<div class="post-metadata">

**Author:** ![Ahatsham](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Ahatsham](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAhatsham)%5C
**Post date:** [November 9, 2023, 5:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F3 "2023-11-09T17:53:29Z")

</div>

In the source code, when picking 4-bit, the parameter count is divided by 2.

I don’t know why, you can check the code

> <https://github.com/artidoro/qlora/blob/7f4e95a68dc076bea9b3a413d2b512eca6d004e5/qlora.py#L408C1-L423C6>

---

<div class="post-metadata">

**Author:** ![NPap](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@NPap](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNPap)%5C
**Post date:** [November 29, 2023, 7:58am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F4 "2023-11-29T07:58:15Z")

</div>

I still don’t have a clear answer for this and I would love to know, bumping for visibility.

---

<div class="post-metadata">

**Author:** ![purnasai](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@purnasai](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpurnasai)%5C
**Post date:** [December 10, 2023, 5:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F5 "2023-12-10T05:59:59Z")

</div>

I too has the same doubt. @sgugger @sayakpaul sorry to tag you guys… I am thinking I could use your help here.

---

<div class="post-metadata">

**Author:** ![winnieyangwannan](https://avatars.discourse-cdn.com/v4/letter/w/8e7dd6/32.png) [@winnieyangwannan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwinnieyangwannan)%5C
**Post date:** [June 3, 2024, 6:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F6 "2024-06-03T06:21:18Z")

</div>

Hi everyone. Have you figured this out? Is there a way to get access to the full weight with 4bit quantization?

---

<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:** [June 3, 2024, 6:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F7 "2024-06-03T06:56:54Z")

</div>

cc @ybelkada

---

<div class="post-metadata">

**Author:** ![qgallouedec](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/qgallouedec/32/28782_2.png) [@qgallouedec](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fqgallouedec)%5C
**Post date:** [June 28, 2024, 11:10am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnumber-of-parameters-reduced-after-loading-in-4bit%2F50140%2F8 "2024-06-28T11:10:54Z")

</div>

This is normal since `torch.int4` data dtype is not supported in PyTorch. Instead, we pack the 4bit data into `torch.int8` tensor, hence the number of parameters is divided by 2 when we quantize in 4 bit !  
From @marcsun13
