BAAI / LLARA-beir

huggingface.co
Total runs: 153
24-hour runs: 1
7-day runs: -12
30-day runs: -43
Model's Last Updated: May 31 2024
sentence-similarity

Introduction of LLARA-beir

Model Details of LLARA-beir

For more details please refer to our github repo: https://github.com/FlagOpen/FlagEmbedding

LLARA ( paper )

In this project, we introduce LLaRA:

  • EBAE: Embedding-Based Auto-Encoding.
  • EBAR: Embedding-Based Auto-Regression.
Usage
import torch
from transformers import AutoModel, AutoTokenizer, LlamaModel

def get_query_inputs(queries, tokenizer, max_length=512):
    prefix = '"'
    suffix = '", predict the following passage within eight words: <s9><s10><s11><s12><s13><s14><s15><s16>'
    prefix_ids = tokenizer(prefix, return_tensors=None)['input_ids']
    suffix_ids = tokenizer(suffix, return_tensors=None)['input_ids'][1:]
    queries_inputs = []
    for query in queries:
        inputs = tokenizer(query,
                           return_tensors=None,
                           max_length=max_length,
                           truncation=True,
                           add_special_tokens=False)
        inputs['input_ids'] = prefix_ids + inputs['input_ids'] + suffix_ids
        inputs['attention_mask'] = [1] * len(inputs['input_ids'])
        queries_inputs.append(inputs)
    return tokenizer.pad(
            queries_inputs,
            padding=True,
            max_length=max_length,
            pad_to_multiple_of=8,
            return_tensors='pt',
        )

def get_passage_inputs(passages, tokenizer, max_length=512):
    prefix = '"'
    suffix = '", summarize the above passage within eight words: <s1><s2><s3><s4><s5><s6><s7><s8>'
    prefix_ids = tokenizer(prefix, return_tensors=None)['input_ids']
    suffix_ids = tokenizer(suffix, return_tensors=None)['input_ids'][1:]
    passages_inputs = []
    for passage in passages:
        inputs = tokenizer(passage,
                           return_tensors=None,
                           max_length=max_length,
                           truncation=True,
                           add_special_tokens=False)
        inputs['input_ids'] = prefix_ids + inputs['input_ids'] + suffix_ids
        inputs['attention_mask'] = [1] * len(inputs['input_ids'])
        passages_inputs.append(inputs)
    return tokenizer.pad(
            passages_inputs,
            padding=True,
            max_length=max_length,
            pad_to_multiple_of=8,
            return_tensors='pt',
        )

# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained('BAAI/LLARA-beir')
model = AutoModel.from_pretrained('BAAI/LLARA-beir')

# Define query and passage inputs
query = "What is llama?"
title = "Llama"
passage = "The llama is a domesticated South American camelid, widely used as a meat and pack animal by Andean cultures since the pre-Columbian era."
query_input = get_query_inputs([query], tokenizer)
passage_input = get_passage_inputs([passage], tokenizer)


with torch.no_grad():
    # compute query embedding
    query_outputs = model(**query_input, return_dict=True, output_hidden_states=True)
    query_embedding = query_outputs.hidden_states[-1][:, -8:, :]
    query_embedding = torch.mean(query_embedding, dim=1)
    query_embedding = torch.nn.functional.normalize(query_embedding, dim=-1)

    # compute passage embedding
    passage_outputs = model(**passage_input, return_dict=True, output_hidden_states=True)
    passage_embeddings = passage_outputs.hidden_states[-1][:, -8:, :]
    passage_embeddings = torch.mean(passage_embeddings, dim=1)
    passage_embeddings = torch.nn.functional.normalize(passage_embeddings, dim=-1)

    # compute similarity score
    score = query_embedding @ passage_embeddings.T
    print(score)
Acknowledgement

Thanks to the authors of open-sourced datasets, including MSMARCO, BEIR, etc. Thanks to the open-sourced libraries like Pyserini .

Citation

If you find this repository useful, please consider giving a star :star: and citation

@misc{li2023making,
      title={Making Large Language Models A Better Foundation For Dense Retrieval}, 
      author={Chaofan Li and Zheng Liu and Shitao Xiao and Yingxia Shao},
      year={2023},
      eprint={2312.15503},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Runs of BAAI LLARA-beir on huggingface.co

153
Total runs
1
24-hour runs
-9
3-day runs
-12
7-day runs
-43
30-day runs

More Information About LLARA-beir huggingface.co Model

More LLARA-beir license Visit here:

https://choosealicense.com/licenses/mit

LLARA-beir huggingface.co

LLARA-beir huggingface.co is an AI model on huggingface.co that provides LLARA-beir's model effect (), which can be used instantly with this BAAI LLARA-beir model. huggingface.co supports a free trial of the LLARA-beir model, and also provides paid use of the LLARA-beir. Support call LLARA-beir model through api, including Node.js, Python, http.

LLARA-beir huggingface.co Url

https://huggingface.co/BAAI/LLARA-beir

BAAI LLARA-beir online free

LLARA-beir huggingface.co is an online trial and call api platform, which integrates LLARA-beir's modeling effects, including api services, and provides a free online trial of LLARA-beir, you can try LLARA-beir online for free by clicking the link below.

BAAI LLARA-beir online free url in huggingface.co:

https://huggingface.co/BAAI/LLARA-beir

LLARA-beir install

LLARA-beir is an open source model from GitHub that offers a free installation service, and any user can find LLARA-beir on GitHub to install. At the same time, huggingface.co provides the effect of LLARA-beir install, users can directly use LLARA-beir installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

LLARA-beir install url in huggingface.co:

https://huggingface.co/BAAI/LLARA-beir

Url of LLARA-beir

LLARA-beir huggingface.co Url

Provider of LLARA-beir huggingface.co

BAAI
ORGANIZATIONS

Other API from BAAI

huggingface.co

Total runs: 64.5M
Run Growth: -9.0M
Growth Rate: -13.93%
Updated:February 22 2024
huggingface.co

Total runs: 38.2M
Run Growth: 2.5M
Growth Rate: 6.56%
Updated:July 03 2024
huggingface.co

Total runs: 11.6M
Run Growth: -1.1M
Growth Rate: -9.17%
Updated:February 21 2024
huggingface.co

Total runs: 10.5M
Run Growth: -1.2M
Growth Rate: -11.22%
Updated:February 21 2024
huggingface.co

Total runs: 2.5M
Run Growth: 1.9M
Growth Rate: 78.69%
Updated:April 17 2024
huggingface.co

Total runs: 807.4K
Run Growth: -564.8K
Growth Rate: -70.07%
Updated:October 12 2023
huggingface.co

Total runs: 220.2K
Run Growth: -1.2M
Growth Rate: -532.53%
Updated:December 13 2023
huggingface.co

Total runs: 68.6K
Run Growth: 61.1K
Growth Rate: 89.01%
Updated:October 12 2023
huggingface.co

Total runs: 66.4K
Run Growth: -4.8K
Growth Rate: -7.24%
Updated:July 13 2026
huggingface.co

Total runs: 54.3K
Run Growth: -24.5K
Growth Rate: -43.41%
Updated:October 12 2023
huggingface.co

Total runs: 50.3K
Run Growth: -103.2K
Growth Rate: -200.32%
Updated:October 12 2023
huggingface.co

Total runs: 50.0K
Run Growth: 26.4K
Growth Rate: 52.63%
Updated:November 14 2023
huggingface.co

Total runs: 40.4K
Run Growth: -20.7K
Growth Rate: -52.36%
Updated:January 15 2025
huggingface.co

Total runs: 15.9K
Run Growth: -46
Growth Rate: -0.29%
Updated:April 16 2025
huggingface.co

Total runs: 10.6K
Run Growth: -13.9K
Growth Rate: -129.71%
Updated:October 12 2023
huggingface.co

Total runs: 10.2K
Run Growth: 833
Growth Rate: 100.00%
Updated:September 16 2026
huggingface.co

Total runs: 4.8K
Run Growth: -8.0K
Growth Rate: -164.80%
Updated:May 20 2025
huggingface.co

Total runs: 4.3K
Run Growth: 4.3K
Growth Rate: 87.85%
Updated:April 19 2024
huggingface.co

Total runs: 3.6K
Run Growth: 2.7K
Growth Rate: 74.30%
Updated:September 11 2026
huggingface.co

Total runs: 2.1K
Run Growth: 1.6K
Growth Rate: 75.58%
Updated:December 31 2022
huggingface.co

Total runs: 1.9K
Run Growth: -13.3K
Growth Rate: -713.97%
Updated:January 15 2025
huggingface.co

Total runs: 1.9K
Run Growth: -269
Growth Rate: -15.28%
Updated:April 10 2026
huggingface.co

Total runs: 1.8K
Run Growth: 1.1K
Growth Rate: 66.91%
Updated:November 28 2024
huggingface.co

Total runs: 1.7K
Run Growth: -916
Growth Rate: -54.23%
Updated:April 10 2026
huggingface.co

Total runs: 1.3K
Run Growth: 247
Growth Rate: 20.51%
Updated:September 11 2026
huggingface.co

Total runs: 1.0K
Run Growth: 768
Growth Rate: 74.42%
Updated:October 24 2024
huggingface.co

Total runs: 821
Run Growth: 376
Growth Rate: 36.65%
Updated:October 23 2024
huggingface.co

Total runs: 782
Run Growth: -636
Growth Rate: -78.91%
Updated:February 07 2024
huggingface.co

Total runs: 773
Run Growth: -116
Growth Rate: -15.18%
Updated:May 23 2025
huggingface.co

Total runs: 527
Run Growth: -190
Growth Rate: -35.85%
Updated:July 13 2026
huggingface.co

Total runs: 470
Run Growth: 171
Growth Rate: 34.97%
Updated:April 10 2026
huggingface.co

Total runs: 423
Run Growth: -431
Growth Rate: -100.23%
Updated:April 18 2023
huggingface.co

Total runs: 407
Run Growth: -68
Growth Rate: -16.50%
Updated:July 13 2026
huggingface.co

Total runs: 380
Run Growth: -213
Growth Rate: -55.61%
Updated:October 27 2023
huggingface.co

Total runs: 373
Run Growth: -330
Growth Rate: -88.47%
Updated:August 11 2026
huggingface.co

Total runs: 347
Run Growth: -955
Growth Rate: -273.64%
Updated:August 11 2026
huggingface.co

Total runs: 333
Run Growth: 19
Growth Rate: 5.85%
Updated:July 13 2026
huggingface.co

Total runs: 331
Run Growth: 160
Growth Rate: 49.08%
Updated:July 13 2026
huggingface.co

Total runs: 311
Run Growth: -613
Growth Rate: -197.11%
Updated:December 25 2025
huggingface.co

Total runs: 299
Run Growth: -84
Growth Rate: -28.97%
Updated:July 13 2026
huggingface.co

Total runs: 287
Run Growth: -133
Growth Rate: -44.93%
Updated:March 07 2024
huggingface.co

Total runs: 273
Run Growth: -3.9K
Growth Rate: -1419.41%
Updated:April 10 2026
huggingface.co

Total runs: 264
Run Growth: -502
Growth Rate: -205.74%
Updated:December 25 2025
huggingface.co

Total runs: 250
Run Growth: -114
Growth Rate: -44.19%
Updated:April 10 2026
huggingface.co

Total runs: 248
Run Growth: 157
Growth Rate: 63.82%
Updated:August 18 2026
huggingface.co

Total runs: 230
Run Growth: -115
Growth Rate: -50.66%
Updated:June 06 2025
huggingface.co

Total runs: 225
Run Growth: -59
Growth Rate: -26.58%
Updated:July 17 2026
huggingface.co

Total runs: 216
Run Growth: -77
Growth Rate: -36.32%
Updated:July 13 2026
huggingface.co

Total runs: 214
Run Growth: 68
Growth Rate: 33.01%
Updated:April 02 2024
huggingface.co

Total runs: 211
Run Growth: -60
Growth Rate: -29.27%
Updated:July 13 2026
huggingface.co

Total runs: 188
Run Growth: 9
Growth Rate: 4.89%
Updated:July 13 2026
huggingface.co

Total runs: 183
Run Growth: 176
Growth Rate: 100.00%
Updated:September 05 2026
huggingface.co

Total runs: 177
Run Growth: -179
Growth Rate: -101.13%
Updated:October 23 2024
huggingface.co

Total runs: 176
Run Growth: 19
Growth Rate: 11.05%
Updated:June 24 2024
huggingface.co

Total runs: 175
Run Growth: 53
Growth Rate: 30.99%
Updated:August 23 2023
huggingface.co

Total runs: 167
Run Growth: -68
Growth Rate: -40.72%
Updated:April 10 2026
huggingface.co

Total runs: 165
Run Growth: 41
Growth Rate: 25.00%
Updated:July 13 2026
huggingface.co

Total runs: 161
Run Growth: -33
Growth Rate: -20.63%
Updated:May 13 2024
huggingface.co

Total runs: 160
Run Growth: 59
Growth Rate: 37.34%
Updated:March 13 2026
huggingface.co

Total runs: 159
Run Growth: -76
Growth Rate: -48.10%
Updated:May 13 2024
huggingface.co

Total runs: 159
Run Growth: -54
Growth Rate: -34.62%
Updated:July 13 2026