BAAI / LLARA-pretrain

huggingface.co
Total runs: 164
24-hour runs: -1
7-day runs: -10
30-day runs: -28
Model's Last Updated: May 13 2024
sentence-similarity

Introduction of LLARA-pretrain

Model Details of LLARA-pretrain

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-pretrain')
model = AutoModel.from_pretrained('BAAI/LLARA-pretrain')

# 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-pretrain on huggingface.co

164
Total runs
-1
24-hour runs
22
3-day runs
-10
7-day runs
-28
30-day runs

More Information About LLARA-pretrain huggingface.co Model

More LLARA-pretrain license Visit here:

https://choosealicense.com/licenses/mit

LLARA-pretrain huggingface.co

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

LLARA-pretrain huggingface.co Url

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

BAAI LLARA-pretrain online free

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

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

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

LLARA-pretrain install

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

LLARA-pretrain install url in huggingface.co:

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

Url of LLARA-pretrain

LLARA-pretrain huggingface.co Url

Provider of LLARA-pretrain huggingface.co

BAAI
ORGANIZATIONS

Other API from BAAI

huggingface.co

Total runs: 64.3M
Run Growth: -6.6M
Growth Rate: -10.32%
Updated:February 22 2024
huggingface.co

Total runs: 37.8M
Run Growth: 3.7M
Growth Rate: 9.69%
Updated:July 03 2024
huggingface.co

Total runs: 12.8M
Run Growth: 622.5K
Growth Rate: 4.86%
Updated:February 21 2024
huggingface.co

Total runs: 10.6M
Run Growth: -274.5K
Growth Rate: -2.59%
Updated:February 21 2024
huggingface.co

Total runs: 2.2M
Run Growth: 1.7M
Growth Rate: 77.46%
Updated:April 17 2024
huggingface.co

Total runs: 795.3K
Run Growth: -726.2K
Growth Rate: -91.32%
Updated:October 12 2023
huggingface.co

Total runs: 228.9K
Run Growth: -1.3M
Growth Rate: -582.76%
Updated:December 13 2023
huggingface.co

Total runs: 59.2K
Run Growth: -116.7K
Growth Rate: -197.13%
Updated:October 12 2023
huggingface.co

Total runs: 51.4K
Run Growth: -43.1K
Growth Rate: -83.89%
Updated:October 12 2023
huggingface.co

Total runs: 46.2K
Run Growth: 22.7K
Growth Rate: 49.08%
Updated:November 14 2023
huggingface.co

Total runs: 42.7K
Run Growth: 25.1K
Growth Rate: 58.90%
Updated:October 12 2023
huggingface.co

Total runs: 37.4K
Run Growth: -24.8K
Growth Rate: -66.13%
Updated:January 15 2025
huggingface.co

Total runs: 15.9K
Run Growth: 1.3K
Growth Rate: 8.46%
Updated:April 16 2025
huggingface.co

Total runs: 11.1K
Run Growth: -15.2K
Growth Rate: -136.62%
Updated:October 12 2023
huggingface.co

Total runs: 5.5K
Run Growth: 4.9K
Growth Rate: 89.62%
Updated:April 19 2024
huggingface.co

Total runs: 4.6K
Run Growth: -9.3K
Growth Rate: -203.11%
Updated:May 20 2025
huggingface.co

Total runs: 3.4K
Run Growth: 2.4K
Growth Rate: 72.02%
Updated:September 11 2026
huggingface.co

Total runs: 1.8K
Run Growth: 1.2K
Growth Rate: 63.98%
Updated:December 31 2022
huggingface.co

Total runs: 1.8K
Run Growth: -13.5K
Growth Rate: -793.18%
Updated:January 15 2025
huggingface.co

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

Total runs: 1.4K
Run Growth: -494
Growth Rate: -34.50%
Updated:April 10 2026
huggingface.co

Total runs: 1.2K
Run Growth: 285
Growth Rate: 22.84%
Updated:September 11 2026
huggingface.co

Total runs: 1.2K
Run Growth: 547
Growth Rate: 45.24%
Updated:October 23 2024
huggingface.co

Total runs: 1.2K
Run Growth: -283
Growth Rate: -23.98%
Updated:November 28 2024
huggingface.co

Total runs: 1.1K
Run Growth: -33
Growth Rate: -2.92%
Updated:February 07 2024
huggingface.co

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

Total runs: 799
Run Growth: 37
Growth Rate: 4.63%
Updated:May 23 2025
huggingface.co

Total runs: 594
Run Growth: -175
Growth Rate: -29.46%
Updated:July 13 2026
huggingface.co

Total runs: 478
Run Growth: -87
Growth Rate: -18.20%
Updated:July 13 2026
huggingface.co

Total runs: 465
Run Growth: 181
Growth Rate: 38.92%
Updated:April 10 2026
huggingface.co

Total runs: 428
Run Growth: -134
Growth Rate: -31.31%
Updated:October 27 2023
huggingface.co

Total runs: 405
Run Growth: -622
Growth Rate: -153.58%
Updated:April 18 2023
huggingface.co

Total runs: 394
Run Growth: -783
Growth Rate: -198.73%
Updated:August 11 2026
huggingface.co

Total runs: 389
Run Growth: -230
Growth Rate: -59.13%
Updated:August 11 2026
huggingface.co

Total runs: 381
Run Growth: -265
Growth Rate: -69.55%
Updated:December 25 2025
huggingface.co

Total runs: 321
Run Growth: 59
Growth Rate: 18.38%
Updated:July 13 2026
huggingface.co

Total runs: 317
Run Growth: 131
Growth Rate: 41.32%
Updated:July 13 2026
huggingface.co

Total runs: 291
Run Growth: 211
Growth Rate: 72.51%
Updated:August 18 2026
huggingface.co

Total runs: 290
Run Growth: -149
Growth Rate: -51.38%
Updated:March 07 2024
huggingface.co

Total runs: 287
Run Growth: 97
Growth Rate: 33.80%
Updated:July 13 2026
huggingface.co

Total runs: 285
Run Growth: -848
Growth Rate: -297.54%
Updated:December 25 2025
huggingface.co

Total runs: 285
Run Growth: -3.8K
Growth Rate: -1338.60%
Updated:April 10 2026
huggingface.co

Total runs: 260
Run Growth: -35
Growth Rate: -13.46%
Updated:April 10 2026
huggingface.co

Total runs: 257
Run Growth: 21
Growth Rate: 8.17%
Updated:February 11 2025
huggingface.co

Total runs: 218
Run Growth: -106
Growth Rate: -48.62%
Updated:July 17 2026
huggingface.co

Total runs: 207
Run Growth: -98
Growth Rate: -47.34%
Updated:June 06 2025
huggingface.co

Total runs: 207
Run Growth: -71
Growth Rate: -34.30%
Updated:July 13 2026
huggingface.co

Total runs: 206
Run Growth: -103
Growth Rate: -50.00%
Updated:October 23 2024
huggingface.co

Total runs: 187
Run Growth: -59
Growth Rate: -31.55%
Updated:July 13 2026
huggingface.co

Total runs: 187
Run Growth: 39
Growth Rate: 20.86%
Updated:April 02 2024
huggingface.co

Total runs: 181
Run Growth: 66
Growth Rate: 36.46%
Updated:July 13 2026
huggingface.co

Total runs: 176
Run Growth: -170
Growth Rate: -96.59%
Updated:May 13 2024
huggingface.co

Total runs: 166
Run Growth: 67
Growth Rate: 40.36%
Updated:August 23 2023
huggingface.co

Total runs: 165
Run Growth: -30
Growth Rate: -18.18%
Updated:May 13 2024
huggingface.co

Total runs: 165
Run Growth: -50
Growth Rate: -30.30%
Updated:April 10 2026
huggingface.co

Total runs: 164
Run Growth: -33
Growth Rate: -20.12%
Updated:May 31 2024
huggingface.co

Total runs: 160
Run Growth: -993
Growth Rate: -620.63%
Updated:June 24 2024
huggingface.co

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

Total runs: 148
Run Growth: -45
Growth Rate: -30.41%
Updated:July 13 2026
huggingface.co

Total runs: 146
Run Growth: 34
Growth Rate: 23.29%
Updated:July 13 2026