--- license: apache-2.0 datasets: - neural-bridge/rag-full-20000 language: - en pipeline_tag: text-generation tags: - retrieval-augmented-generation --- # **Rago v2 13B** **Rago v2 13B is a [Llama 2 13B](https://huggingface.co/meta-llama/Llama-2-13b-hf)-based retrieval-augmented generation-optimized model built by [Neural Bridge AI](https://www.neuralbridge.ai/) and trained on [RAG Full Dataset 20000](https://huggingface.co/datasets/neural-bridge/rag-full-20000). It is available under [Apache license 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).** ## **Model Details** Rago v2 13B model is a retrieval-augmented generation-optimized (RAGO) model that 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 v2 13B, specifically, is an advancement built upon the [Llama 2 13B](https://huggingface.co/meta-llama/Llama-2-13b-hf) model, optimized for retrieval-augmented generation, making it particularly effective in contextually aware response generation. ```python model = "neural-bridge/Rago-v2-7b" 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"]) ```