# Why \`OpenAI Embedding\` return different vectors for the same text input?

**URL:** <https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495>\
**Category:** API\
**Created:** [April 6, 2023, 6:35pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495 "2023-04-06T18:35:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwesomeYuer](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/awesomeyuer/32/33713_2.png) [@AwesomeYuer](https://community.openai.com/u/AwesomeYuer)\
**Post date:** [April 6, 2023, 6:35pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/1 "2023-04-06T18:35:57Z")

</div>

Does `OpenAI Embedding` return different vectors for the same text input? However, it seems to randomly return from a specific set of vectors. Why is this happening? If this is not the correct behavior, could it be due to inconsistent information across nodes in the server cluster? Is this a bug or by design?  
the testing as below:  
[OpenAI.API.http/OpenAI.http at master · AwesomeYuer/OpenAI.API.http (github.com)](https://github.com/AwesomeYuer/OpenAI.API.http/blob/master/OpenAI.http)

---

<div class="post-metadata">

**Author:** ![curt.kennedy](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/curt.kennedy/32/709249_2.png) [@curt.kennedy](https://community.openai.com/u/curt.kennedy)\
**Post date:** [April 6, 2023, 6:44pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/2 "2023-04-06T18:44:15Z")

</div>

Embeddings only return vectors. The vector is the same for the same input, same model, and the same API endpoint. But we have seen differences between the OpenAI endpoint and the Azure endpoint for the same model. So a pick an endpoint and stick with it to avoid any differences.

There could be very slight roundoff errors in the embedding when calling it over and over for the same (above) configuration, but this is in the noise and won’t effect your search result.

---

<div class="post-metadata">

**Author:** ![AwesomeYuer](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/awesomeyuer/32/33713_2.png) [@AwesomeYuer](https://community.openai.com/u/AwesomeYuer)\
**Post date:** [April 14, 2023, 8:48pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/3 "2023-04-14T20:48:16Z")

</div>

Azure OpenAI Service have not this issue!

---

<div class="post-metadata">

**Author:** ![neilo](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/neilo/32/174487_2.png) [@neilo](https://community.openai.com/u/neilo)\
**Post date:** [July 27, 2023, 9:49pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/4 "2023-07-27T21:49:53Z")

</div>

I’ve found this to happen on particular strings of input. For example, “hello world” will consistently output the same vector but “Hello” will not. You can try this yourself:

```python
r1 = openai.Embedding.create(input=["Hello"], engine="text-embedding-ada-002")
v1 = r1["data"][0]["embedding"]
r2 = openai.Embedding.create(input=["Hello"], engine="text-embedding-ada-002")
v2 = r2["data"][0]["embedding"]

v1 == v2 # False!
v1[0], v2[0]
# v1[0] = -0.021834855899214745
# v2[0] = -0.021884862333536148

```

The difference is more than a rounding error in my eyes and when I re-run this test I get the same `v1[0]` but a _different_ `v2[0]` …

```auto
(-0.021834855899214745, -0.021855857223272324)
(-0.021834855899214745, -0.0218560378998518)

```

Sometimes this will even output the same vector so `v1 == v2`.

🤨

---

<div class="post-metadata">

**Author:** ![FreeGoldRush](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/freegoldrush/32/146453_2.png) [@FreeGoldRush](https://community.openai.com/u/FreeGoldRush)\
**Post date:** [September 12, 2023, 10:33pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/5 "2023-09-12T22:33:12Z")

</div>

This is not a rounding error on the client side. The json returned by the OpenAI API is different for the same input string. So it does verifiably return different data for the same input (sometimes). The distance between variations on the returned data is so small I can’t imagine this is an issue. But it would be nice to know why this is happening.

---

<div class="post-metadata">

**Author:** ![sabbadin12](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sabbadin12/32/136546_2.png) [@sabbadin12](https://community.openai.com/u/sabbadin12)\
**Post date:** [November 9, 2023, 7:24pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/6 "2023-11-09T19:24:10Z")

</div>

They do, I found it today, some documents where getting in and out the cosine threshold

---

<div class="post-metadata">

**Author:** ![occam42](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/occam42/32/247137_2.png) [@occam42](https://community.openai.com/u/occam42)\
**Post date:** [November 13, 2023, 5:15pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/7 "2023-11-13T17:15:33Z")

</div>

I embedded “hello world” 10 times in a row and the output is not always the same.  
From what i’ve seen, the difference of any given coefficient is less than 1e-4. For example, first coefficient embedding “hello world” using “text-embedding-ada-002”  
the requests are going to `httpx: HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 200 OK"` (using async client in openai 1.2.3)

```auto
[-0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.014956329017877579,
 -0.0149070480838418]

```

---

<div class="post-metadata">

**Author:** ![occam42](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/occam42/32/247137_2.png) [@occam42](https://community.openai.com/u/occam42)\
**Post date:** [November 13, 2023, 5:17pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/8 "2023-11-13T17:17:12Z")

</div>

it’s actually worse than that. eg another run:

```auto
[-0.0149070480838418,
 -0.014948742464184761,
 -0.014948742464184761,
 -0.0149070480838418,
 -0.014956329017877579,
 -0.014948742464184761,
 -0.0149070480838418,
 -0.0149070480838418,
 -0.01559481117874384,
 -0.0149070480838418]

```

---

<div class="post-metadata">

**Author:** ![curt.kennedy](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/curt.kennedy/32/709249_2.png) [@curt.kennedy](https://community.openai.com/u/curt.kennedy)\
**Post date:** [November 13, 2023, 5:24pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/9 "2023-11-13T17:24:59Z")

</div>

How much do your vector dot products vary? Say take one of those vectors, fix it as a reference, and dot the other vectors with it. What is this variation?

Some variation is expected because of the random timing in the GPU’s, and that floating point is not associative, and they are likely taking the last hidden layer and scaling out to the unit hyper-sphere, which would magnify the error for hidden states close to the origin.

---

<div class="post-metadata">

**Author:** ![VeitB](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/veitb/32/712987_2.png) [@VeitB](https://community.openai.com/u/VeitB)\
**Post date:** [November 13, 2023, 5:42pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/10 "2023-11-13T17:42:19Z")

</div>

If you need consistency it is an option to create a hash of the text to be embedded and then compare those as a decision criterion before creating new embeddings.  
This way you can prevent the same text from being embedded twice and you don’t have to worry about the differences in the results.

---

<div class="post-metadata">

**Author:** ![leoinsight](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/leoinsight/32/258159_2.png) [@leoinsight](https://community.openai.com/u/leoinsight)\
**Post date:** [November 23, 2023, 10:28pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/11 "2023-11-23T22:28:44Z")

</div>

This still seems to be an issue:  
I’ve raised an issue in the python CLI and pointed to the developer forum.

```auto
>>> from openai import OpenAI
>>> client = OpenAI(api_key="...")
>>> for i in range(50):
... client.embeddings.create(model="text-embedding-ada-002", input="hello").data[0].embedding[:5]
... 
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.024994507431983948, -0.019366780295968056, -0.027768738567829132, -0.031097816303372383, -0.02462460845708847]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.0250103659927845, -0.01939525455236435, -0.027798103168606758, -0.030995413661003113, -0.024706488475203514]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.0250103659927845, -0.01939525455236435, -0.027798103168606758, -0.030995413661003113, -0.024706488475203514]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025048330426216125, -0.019377758726477623, -0.027810918167233467, -0.0310361385345459, -0.02466500550508499]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.02502652257680893, -0.019331468269228935, -0.027801373973488808, -0.031051915138959885, -0.02469618245959282]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]

```

I’m also able to replicate this using the https endpoint.

 ![image](https://us1.discourse-cdn.com/openai1/original/4X/d/f/b/dfb637e9bab3a7e57872d6d50957deb25fa1a59f.png)

---

<div class="post-metadata">

**Author:** ![anon10827405](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon10827405](https://community.openai.com/u/anon10827405)\
**Post date:** [November 23, 2023, 10:32pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/12 "2023-11-23T22:32:44Z")

</div>

What happens when you try to run a distance function on all of these slightly different vectors?

---

<div class="post-metadata">

**Author:** ![leoinsight](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/leoinsight/32/258159_2.png) [@leoinsight](https://community.openai.com/u/leoinsight)\
**Post date:** [November 24, 2023, 12:45am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/13 "2023-11-24T00:45:16Z")

</div>

Sure,

```python
>>> from openai import OpenAI
>>> client = OpenAI(api_key="...")
>>> embeddings = client.embeddings.create(model="text-embedding-ada-002", input=["hello" for _ in range(50)])
>>> for x in embeddings.data:
... print(x.embedding[:5])
... 
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
...
[-0.0250103659927845, -0.01939525455236435, -0.027798103168606758, -0.030995413661003113, -0.024706488475203514]
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
...
[-0.025058425962924957, -0.019388560205698013, -0.027781018987298012, -0.030979404225945473, -0.024688364937901497]
>>> base_emb = np.array(embeddings.data[0].embedding, dtype="float64")
>>> diff_emb = np.array(embeddings.data[36].embedding, dtype="float64")
>>> print(base_emb[:5])
[-0.02505843 -0.01938856 -0.02778102 -0.0309794 -0.02468836]
>>> print(diff_emb[:5])
[-0.02501037 -0.01939525 -0.0277981 -0.03099541 -0.02470649]
>>> dist = np.linalg.norm(base_emb-diff_emb)
>>> dist
0.0015302552960605469

```

It’s not a “small” level on accuracy.

---

<div class="post-metadata">

**Author:** ![anon10827405](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon10827405](https://community.openai.com/u/anon10827405)\
**Post date:** [November 24, 2023, 12:57am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/14 "2023-11-24T00:57:24Z")

</div>

![Screenshot from 2023-11-23 19-57-14](https://us1.discourse-cdn.com/openai1/original/4X/c/f/8/cf85f3fad0f91a6c2e6f8e52558c0793d171d3ac.png)

```auto
from openai import OpenAI
import numpy as np
import os

client = OpenAI(api_key=os.environ['OPENAI_KEY'])

```

```auto
lolz = [
    client.embeddings.create(
        model="text-embedding-ada-002",
        input="hello"
    ).data[0].embedding for i in range(2)
]

```

```auto
np.dot(lolz[0], lolz[1])

```

> 0.999999971277652

Are you expecting a 1?

```auto
lolz = [
    client.embeddings.create(
        model="text-embedding-ada-002",
        input="hello %s" % i
    ).data[0].embedding for i in range(2)
]

```

```auto
np.dot(lolz[0], lolz[1])

```

> 0.9038732013151791

I’d say that .9999997 is close enough

```auto
lolz = [
    client.embeddings.create(
        model="text-embedding-ada-002",
        input="hello" + (" " * (i))
    ).data[0].embedding for i in range(2)
]

```

```auto
np.dot(lolz[0], lolz[1])

```

> 0.9119886859504618

---

<div class="post-metadata">

**Author:** ![anon10827405](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon10827405](https://community.openai.com/u/anon10827405)\
**Post date:** [November 24, 2023, 9:18am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/15 "2023-11-24T09:18:34Z")

</div>

i went a little further

```auto
lolz = [
    client.embeddings.create(
        model="text-embedding-ada-002",
        input="hello"
    ).data[0].embedding for i in range(50)
]

```

```auto
olawd = [
  np.dot(lolz[x], lolz[y]) 
  for x in range(len(lolz)) for y in range(len(lolz))
]

```

```auto
sum(olawd) / len(olawd)

```

> 0.9999996662160927

---

<div class="post-metadata">

**Author:** ![leoinsight](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/leoinsight/32/258159_2.png) [@leoinsight](https://community.openai.com/u/leoinsight)\
**Post date:** [November 27, 2023, 11:58pm UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/16 "2023-11-27T23:58:47Z")

</div>

As you can see from my specific examples, roughly 1/10 embeddings are way off for the exact same input “hello”.  
Those examples with the same input and different embeddings have a large distance between the vectors.  
These would lead to inaccuracies in ordering and downstream models, it’s a reasonable concern.

---

<div class="post-metadata">

**Author:** ![anon10827405](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon10827405](https://community.openai.com/u/anon10827405)\
**Post date:** [November 28, 2023, 12:33am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/17 "2023-11-28T00:33:05Z")

</div>

If Hello has a distance of `~0.99999967` and the closest (maybe) fathomable as "Hello " is `~0.91198869` What exactly is the problem? Your example is nit-picking numbers without meaning. See: Not being pragmatic.

If you need it to be perfect then hash the strings and look it up that way first.

> [@leoinsight](#):
>
> it’s a reasonable concern.

Strange. Everyone else uses embeddings just fine. They are inherently fuzzy.

---

<div class="post-metadata">

**Author:** ![leoinsight](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/leoinsight/32/258159_2.png) [@leoinsight](https://community.openai.com/u/leoinsight)\
**Post date:** [November 28, 2023, 1:29am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/18 "2023-11-28T01:29:57Z")

</div>

If a string is hashed and the stored embedding is the incorrect one, you’d be looking up the incorrect one via your hash? How do you know your first stored hash is correct unless you embed multiple times which would be a hack of a solution.

The context here, items are embedded according to text and stored. For sorting/search you’d expect these embeddings to be deterministic. Given embeddings are supposed to be a frozen layer of a particular LLM and it is only an issue with ada-002.

I also disagree with everyone else uses embeddings just fine, there’s a bunch of threads on OpenAI’s forum with the same issue, issues arising on libraries, multiple stackoverflow threads and even articles on it. Limited to links otherwise I’d publish them here.

This one article it quite well: [OpenAI or Azure OpenAI: Can models be more deterministic depending on API?](https://www.willowtreeapps.com/craft/openai-or-azure-openai-can-models-be-more-deterministic-depending-on-api)

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [November 28, 2023, 1:43am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/19 "2023-11-28T01:43:57Z")

</div>

> [@leoinsight](#):
>
> you’d be looking up the incorrect one via your hash

There is no “incorrect one” when 9/10 are different…

> [@Can text-embedding-ada-002 be made deterministic?](https://community.openai.com/t/can-text-embedding-ada-002-be-made-deterministic/318054/15):
>
> Is it possible that this is caused by selective availability, so that you can’t determine precisely when the running model is tweaked? Birthday problem done on 10 string outputs from embeddings (no math) text-similarity-ada-001: All outputs match text-similarity-babbage-001: All outputs match text-similarity-curie-001: All outputs match text-similarity-davinci-001: All outputs match text-search-ada-doc-001: All outputs match text-search-ada-query-001: All outputs match text-search-babbag…

As I show, this is not a problem had by any of the over one dozen GPT-3 embeddings.

---

<div class="post-metadata">

**Author:** ![anon10827405](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon10827405](https://community.openai.com/u/anon10827405)\
**Post date:** [November 28, 2023, 1:47am UTC](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495/20 "2023-11-28T01:47:55Z")

</div>

> [@leoinsight](#):
>
> If a string is hashed and the stored embedding is the incorrect one, you’d be looking up the incorrect one via your hash? How do you know your first stored hash is correct unless you embed multiple times which would be a hack of a solution.

I don’t see the logic here. Going back to being pragmatic: If the difference is on a scale of \< 0.000001 then why would it be incorrect? What are you actually trying to accomplish with your embeddings?

> [@leoinsight](#):
>
> This one article it quite well: [OpenAI or Azure OpenAI: Can models be more deterministic depending on API?](https://www.willowtreeapps.com/craft/openai-or-azure-openai-can-models-be-more-deterministic-depending-on-api)

The article states that Azure always returns the same results, so maybe that’s a better solution?

> [@leoinsight](#):
>
> I also disagree with everyone else uses embeddings just fine, there’s a bunch of threads on OpenAI’s forum with the same issue, issues arising on libraries, multiple stackoverflow threads and even articles on it.

Yes. Many people notice that the embeddings are slightly different and think that it’s going to cause issues. Yet 95% of the world continues working with it just fine. I don’t see the logic here either.

But, I don’t think this will go anywhere. I’m feeling a complete lacking of pragmatism so we can hold hands and solve this together. Have you ever looked closer at the vector values and counted how many digits they have?

`0.025058425962924957`

Now call Azure, or even call the OpenAI endpoint using Curl and then count how many digits they have as well

`0.025058426`

Seeing something?

Yes. The python library returns extra digits 🙌. So you are safe to either round it yourself, or just deal with the inherent noise that **really** doesn’t make any difference.

[Next page](https://community.openai.com/t/why-openai-embedding-return-different-vectors-for-the-same-text-input/144495.md?page=2)
