BAAI / LLARA-beir

huggingface.co
Total runs: 164
24-hour runs: -16
7-day runs: -6
30-day runs: 52
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

164
Total runs
-16
24-hour runs
-8
3-day runs
-6
7-day runs
52
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: 66.4M
Run Growth: -2.7M
Growth Rate: -4.01%
Updated:February 22 2024
huggingface.co

Total runs: 34.9M
Run Growth: -566.7K
Growth Rate: -1.62%
Updated:July 03 2024
huggingface.co

Total runs: 13.0M
Run Growth: -283.2K
Growth Rate: -2.18%
Updated:February 21 2024
huggingface.co

Total runs: 11.5M
Run Growth: 2.8M
Growth Rate: 24.66%
Updated:February 21 2024
huggingface.co

Total runs: 4.5M
Run Growth: -124.5K
Growth Rate: -2.77%
Updated:October 12 2023
huggingface.co

Total runs: 1.1M
Run Growth: 683.5K
Growth Rate: 60.72%
Updated:April 17 2024
huggingface.co

Total runs: 1.1M
Run Growth: -810.4K
Growth Rate: -72.09%
Updated:October 12 2023
huggingface.co

Total runs: 909.9K
Run Growth: -649.9K
Growth Rate: -71.43%
Updated:December 13 2023
huggingface.co

Total runs: 92.4K
Run Growth: -129.4K
Growth Rate: -140.07%
Updated:October 12 2023
huggingface.co

Total runs: 72.8K
Run Growth: 45.5K
Growth Rate: 62.43%
Updated:July 13 2026
huggingface.co

Total runs: 52.6K
Run Growth: -68.6K
Growth Rate: -130.51%
Updated:October 12 2023
huggingface.co

Total runs: 43.8K
Run Growth: -31.1K
Growth Rate: -71.03%
Updated:January 15 2025
huggingface.co

Total runs: 34.4K
Run Growth: 13.6K
Growth Rate: 39.61%
Updated:November 14 2023
huggingface.co

Total runs: 19.0K
Run Growth: -5.6K
Growth Rate: -29.58%
Updated:October 12 2023
huggingface.co

Total runs: 15.7K
Run Growth: -16.0K
Growth Rate: -101.46%
Updated:April 16 2025
huggingface.co

Total runs: 15.2K
Run Growth: 14.2K
Growth Rate: 93.11%
Updated:January 15 2025
huggingface.co

Total runs: 10.4K
Run Growth: 217
Growth Rate: 2.10%
Updated:May 20 2025
huggingface.co

Total runs: 4.3K
Run Growth: -101.2K
Growth Rate: -2352.99%
Updated:October 12 2023
huggingface.co

Total runs: 1.9K
Run Growth: 66
Growth Rate: 3.54%
Updated:April 10 2026
huggingface.co

Total runs: 1.8K
Run Growth: 696
Growth Rate: 36.48%
Updated:March 01 2026
huggingface.co

Total runs: 1.5K
Run Growth: -965
Growth Rate: -62.87%
Updated:April 10 2026
huggingface.co

Total runs: 1.5K
Run Growth: 182
Growth Rate: 12.08%
Updated:February 07 2024
huggingface.co

Total runs: 1.5K
Run Growth: 769
Growth Rate: 52.89%
Updated:April 19 2024
huggingface.co

Total runs: 1.1K
Run Growth: 350
Growth Rate: 31.70%
Updated:October 23 2024
huggingface.co

Total runs: 919
Run Growth: 797
Growth Rate: 74.42%
Updated:August 11 2026
huggingface.co

Total runs: 870
Run Growth: 197
Growth Rate: 22.64%
Updated:April 18 2023
huggingface.co

Total runs: 805
Run Growth: -994
Growth Rate: -123.48%
Updated:November 28 2024
huggingface.co

Total runs: 787
Run Growth: 221
Growth Rate: 28.08%
Updated:May 23 2025
huggingface.co

Total runs: 729
Run Growth: -7.9K
Growth Rate: -1077.64%
Updated:July 13 2026
huggingface.co

Total runs: 674
Run Growth: 253
Growth Rate: 37.54%
Updated:October 24 2024
huggingface.co

Total runs: 634
Run Growth: -628
Growth Rate: -97.67%
Updated:December 25 2025
huggingface.co

Total runs: 583
Run Growth: 86
Growth Rate: 14.75%
Updated:August 07 2025
huggingface.co

Total runs: 544
Run Growth: -6.5K
Growth Rate: -1195.59%
Updated:July 13 2026
huggingface.co

Total runs: 535
Run Growth: 361
Growth Rate: 64.35%
Updated:August 11 2026
huggingface.co

Total runs: 456
Run Growth: -650
Growth Rate: -142.54%
Updated:December 31 2022
huggingface.co

Total runs: 411
Run Growth: -92
Growth Rate: -18.89%
Updated:December 25 2025
huggingface.co

Total runs: 397
Run Growth: 236
Growth Rate: 59.45%
Updated:July 13 2026
huggingface.co

Total runs: 379
Run Growth: 172
Growth Rate: 45.38%
Updated:April 10 2026
huggingface.co

Total runs: 378
Run Growth: 177
Growth Rate: 46.83%
Updated:March 07 2024
huggingface.co

Total runs: 367
Run Growth: 280
Growth Rate: 76.29%
Updated:February 11 2025
huggingface.co

Total runs: 353
Run Growth: 196
Growth Rate: 55.52%
Updated:April 10 2026
huggingface.co

Total runs: 324
Run Growth: -137
Growth Rate: -42.28%
Updated:October 27 2023
huggingface.co

Total runs: 315
Run Growth: -7
Growth Rate: -2.22%
Updated:July 13 2026
huggingface.co

Total runs: 294
Run Growth: 160
Growth Rate: 53.87%
Updated:June 06 2025
huggingface.co

Total runs: 233
Run Growth: 74
Growth Rate: 31.76%
Updated:April 10 2026
huggingface.co

Total runs: 233
Run Growth: -3
Growth Rate: -1.29%
Updated:July 13 2026
huggingface.co

Total runs: 232
Run Growth: 32
Growth Rate: 13.79%
Updated:July 13 2026
huggingface.co

Total runs: 219
Run Growth: -125
Growth Rate: -57.08%
Updated:July 13 2026
huggingface.co

Total runs: 207
Run Growth: -38
Growth Rate: -18.36%
Updated:October 23 2024
huggingface.co

Total runs: 203
Run Growth: 158
Growth Rate: 77.83%
Updated:August 18 2026
huggingface.co

Total runs: 188
Run Growth: 114
Growth Rate: 60.64%
Updated:February 07 2024
huggingface.co

Total runs: 186
Run Growth: -39
Growth Rate: -19.21%
Updated:July 17 2026
huggingface.co

Total runs: 184
Run Growth: 53
Growth Rate: 28.80%
Updated:July 13 2026
huggingface.co

Total runs: 179
Run Growth: -71
Growth Rate: -39.66%
Updated:May 13 2024
huggingface.co

Total runs: 161
Run Growth: -11
Growth Rate: -6.83%
Updated:July 13 2026
huggingface.co

Total runs: 158
Run Growth: 48
Growth Rate: 30.38%
Updated:May 13 2024
huggingface.co

Total runs: 157
Run Growth: 44
Growth Rate: 28.03%
Updated:May 13 2024
huggingface.co

Total runs: 147
Run Growth: -1.1K
Growth Rate: -741.50%
Updated:June 24 2024
huggingface.co

Total runs: 146
Run Growth: -1.0K
Growth Rate: -718.49%
Updated:June 24 2024
huggingface.co

Total runs: 140
Run Growth: 95
Growth Rate: 67.86%
Updated:July 02 2024
huggingface.co

Total runs: 134
Run Growth: -827
Growth Rate: -617.16%
Updated:December 21 2023
huggingface.co

Total runs: 134
Run Growth: -26
Growth Rate: -19.40%
Updated:April 02 2024
huggingface.co

Total runs: 133
Run Growth: 16
Growth Rate: 12.03%
Updated:July 05 2024