BAAI / LLARA-document

huggingface.co
Total runs: 168
24-hour runs: -2
7-day runs: -25
30-day runs: 73
Model's Last Updated: May 13 2024
sentence-similarity

Introduction of LLARA-document

Model Details of LLARA-document

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

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

168
Total runs
-2
24-hour runs
1
3-day runs
-25
7-day runs
73
30-day runs

More Information About LLARA-document huggingface.co Model

More LLARA-document license Visit here:

https://choosealicense.com/licenses/mit

LLARA-document huggingface.co

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

LLARA-document huggingface.co Url

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

BAAI LLARA-document online free

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

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

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

LLARA-document install

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

LLARA-document install url in huggingface.co:

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

Url of LLARA-document

LLARA-document huggingface.co Url

Provider of LLARA-document huggingface.co

BAAI
ORGANIZATIONS

Other API from BAAI

huggingface.co

Total runs: 36.4M
Run Growth: 1.1M
Growth Rate: 2.97%
Updated:July 03 2024
huggingface.co

Total runs: 13.5M
Run Growth: -80.9K
Growth Rate: -0.60%
Updated:February 21 2024
huggingface.co

Total runs: 12.0M
Run Growth: 3.5M
Growth Rate: 28.85%
Updated:February 21 2024
huggingface.co

Total runs: 1.2M
Run Growth: -745.7K
Growth Rate: -59.97%
Updated:October 12 2023
huggingface.co

Total runs: 1.1M
Run Growth: -395.6K
Growth Rate: -34.92%
Updated:December 13 2023
huggingface.co

Total runs: 981.7K
Run Growth: 316.4K
Growth Rate: 32.23%
Updated:April 17 2024
huggingface.co

Total runs: 120.8K
Run Growth: -98.1K
Growth Rate: -81.20%
Updated:October 12 2023
huggingface.co

Total runs: 73.8K
Run Growth: 51.7K
Growth Rate: 70.16%
Updated:July 13 2026
huggingface.co

Total runs: 68.4K
Run Growth: -46.0K
Growth Rate: -67.18%
Updated:October 12 2023
huggingface.co

Total runs: 51.6K
Run Growth: -24.4K
Growth Rate: -47.30%
Updated:January 15 2025
huggingface.co

Total runs: 32.1K
Run Growth: 12.0K
Growth Rate: 37.38%
Updated:November 14 2023
huggingface.co

Total runs: 20.3K
Run Growth: -5.3K
Growth Rate: -26.24%
Updated:October 12 2023
huggingface.co

Total runs: 16.4K
Run Growth: -18.2K
Growth Rate: -110.98%
Updated:April 16 2025
huggingface.co

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

Total runs: 11.7K
Run Growth: 1.2K
Growth Rate: 10.33%
Updated:May 20 2025
huggingface.co

Total runs: 5.0K
Run Growth: -123.3K
Growth Rate: -2443.17%
Updated:October 12 2023
huggingface.co

Total runs: 2.6K
Run Growth: 1.3K
Growth Rate: 48.98%
Updated:April 10 2026
huggingface.co

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

Total runs: 1.7K
Run Growth: 258
Growth Rate: 15.62%
Updated:February 07 2024
huggingface.co

Total runs: 1.5K
Run Growth: 314
Growth Rate: 20.85%
Updated:March 01 2026
huggingface.co

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

Total runs: 1.3K
Run Growth: 1.2K
Growth Rate: 91.84%
Updated:August 11 2026
huggingface.co

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

Total runs: 884
Run Growth: 211
Growth Rate: 24.65%
Updated:April 18 2023
huggingface.co

Total runs: 822
Run Growth: 98
Growth Rate: 11.92%
Updated:May 23 2025
huggingface.co

Total runs: 682
Run Growth: -559
Growth Rate: -81.96%
Updated:December 25 2025
huggingface.co

Total runs: 665
Run Growth: 267
Growth Rate: 40.15%
Updated:October 24 2024
huggingface.co

Total runs: 644
Run Growth: -9.2K
Growth Rate: -1428.42%
Updated:July 13 2026
huggingface.co

Total runs: 643
Run Growth: 540
Growth Rate: 83.98%
Updated:August 11 2026
huggingface.co

Total runs: 615
Run Growth: 142
Growth Rate: 23.09%
Updated:December 25 2025
huggingface.co

Total runs: 607
Run Growth: 98
Growth Rate: 16.14%
Updated:August 07 2025
huggingface.co

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

Total runs: 473
Run Growth: 0
Growth Rate: 0.00%
Updated:October 27 2023
huggingface.co

Total runs: 446
Run Growth: -8.8K
Growth Rate: -1974.66%
Updated:July 13 2026
huggingface.co

Total runs: 445
Run Growth: -691
Growth Rate: -152.88%
Updated:December 31 2022
huggingface.co

Total runs: 415
Run Growth: 266
Growth Rate: 64.10%
Updated:March 07 2024
huggingface.co

Total runs: 408
Run Growth: 271
Growth Rate: 66.42%
Updated:July 13 2026
huggingface.co

Total runs: 395
Run Growth: 279
Growth Rate: 70.63%
Updated:April 10 2026
huggingface.co

Total runs: 380
Run Growth: 308
Growth Rate: 81.05%
Updated:February 11 2025
huggingface.co

Total runs: 369
Run Growth: 181
Growth Rate: 49.05%
Updated:April 10 2026
huggingface.co

Total runs: 349
Run Growth: 285
Growth Rate: 81.66%
Updated:June 06 2025
huggingface.co

Total runs: 312
Run Growth: -57
Growth Rate: -18.27%
Updated:July 13 2026
huggingface.co

Total runs: 270
Run Growth: 105
Growth Rate: 38.89%
Updated:July 13 2026
huggingface.co

Total runs: 256
Run Growth: 186
Growth Rate: 72.66%
Updated:February 07 2024
huggingface.co

Total runs: 255
Run Growth: 60
Growth Rate: 23.53%
Updated:July 17 2026
huggingface.co

Total runs: 252
Run Growth: 104
Growth Rate: 41.27%
Updated:April 10 2026
huggingface.co

Total runs: 252
Run Growth: -85
Growth Rate: -33.73%
Updated:July 13 2026
huggingface.co

Total runs: 241
Run Growth: 86
Growth Rate: 35.68%
Updated:October 23 2024
huggingface.co

Total runs: 197
Run Growth: -39
Growth Rate: -19.80%
Updated:May 13 2024
huggingface.co

Total runs: 193
Run Growth: -110
Growth Rate: -56.99%
Updated:July 13 2026
huggingface.co

Total runs: 192
Run Growth: 73
Growth Rate: 38.02%
Updated:July 13 2026
huggingface.co

Total runs: 185
Run Growth: 150
Growth Rate: 81.08%
Updated:August 18 2026
huggingface.co

Total runs: 172
Run Growth: 74
Growth Rate: 43.02%
Updated:May 31 2024
huggingface.co

Total runs: 167
Run Growth: 69
Growth Rate: 41.32%
Updated:May 13 2024
huggingface.co

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

Total runs: 157
Run Growth: 18
Growth Rate: 11.46%
Updated:April 02 2024
huggingface.co

Total runs: 152
Run Growth: -791
Growth Rate: -520.39%
Updated:December 21 2023
huggingface.co

Total runs: 146
Run Growth: 114
Growth Rate: 78.08%
Updated:July 02 2024
huggingface.co

Total runs: 144
Run Growth: 39
Growth Rate: 27.08%
Updated:July 05 2024
huggingface.co

Total runs: 143
Run Growth: 110
Growth Rate: 76.92%
Updated:November 02 2025