Downloads · 30 days
20
6% of all-time downloads
neural-bridge/Rago-v1-40b
Rago-v1-40b is a text generation model from neural-bridge. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Rago v1 40B is a 40B parameter retrieval-augmented generation-optimized model built by Neural Bridge AI and trained on RAG Full Dataset 20000. It is available under Apache license 2.0.
Downloads · 30 days
20
6% of all-time downloads
All-time downloads
334
Public
Repo size
330 GB
Likes
0
Public
Click a slice to open those files.
.bin165 GB · 100%
From the Hugging Face model README
Rago v1 40B is a 40B parameter retrieval-augmented generation-optimized model built by Neural Bridge AI and trained on RAG Full Dataset 20000. It is available under Apache license 2.0.
Rago v1 40B model is a retrieval-augmented generation-optimized (RAGO) model, which enhances large language models by integrating an external authoritative knowledge base (context) for generating responses. This integration significantly improves the model's ability to produce relevant, accurate, and context-specific output across specialized domains or internal data without necessitating retraining. It addresses key challenges of large language models (LLMs), such as unpredictability, reliance on potentially outdated data, and the propagation of incorrect information, thereby improving user trust in AI applications. Rago v1 40B, specifically, is an advancement built upon the Falcon-40B model, optimized for retrieval-augmented generation, making it particularly effective in contextually aware response generation.
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model = "neural-bridge/Rago-v1-40b"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
def create_prompt(context, question):
return f"""##CONTEXT## {context} ##QUESTION## {question} ##ANSWER##"""
sequences = pipeline(
create_prompt(
context="Neural Bridge AI is a software company developing artificial intelligence (AI) solutions. It is founded in New York in the USA.",
question="What solutions does Neural Bridge AI develop for its clients?"
),
max_length=200,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
def print_result(generated_text):
result_start = "##ANSWER##"
answer_start = generated_text.find(result_start)
print(generated_text[answer_start + len(result_start) :].strip())
for seq in sequences:
print_result(seq["generated_text"])
Rago v1 40B has been trained using the Neural Bridge's RAG Full 20000 dataset, which comprises a blend of RefinedWeb, gms8k, and RAG Hallucination Dataset 1000.
In terms of training specifics, Rago v1 40B is built upon Falcon-40B employing LoRA to enhance the model's capability to deliver relevant, precise, and context-specific output across specialized domains or internal datasets. This approach aims to tackle significant challenges faced by LLMs, such as unpredictability, reliance on potentially outdated information, and the spread of incorrect data. The architecture of Rago v1 40B mirrors that of Falcon-40B, augmented with LoRA adapters. The model is trained with 4-bit quantization on a single NVIDIA A100 GPU for approximately eight hours, utilizing a learning rate of 2e-5 with cosine scheduler, alongside the following LoRA parameters:
Rago v1 40B benefits from a custom data collator designed to boost model performance significantly. Employing a masked language modeling (MLM) strategy, the model is fine-tuned to generate more accurate responses by exclusively masking the answer portion of the training data. This custom data collator has led to noticeable improvements in the model's factuality performance.
| Model | Link | Base Model |
|---|---|---|
| Rago v1 1B | link | Falcon-RW-1B |
| Rago v1 7B | link | Falcon-7B |
| Rago v1 40B | link | Falcon-40B |
| Rago v2 7B | link | Llama 2 7B |
| Rago v2 13B | link | Llama 2 13B |
This public extract is made available under Apache license 2.0. Users should also abide to the Falcon-40B ToU.