doberst commited on
Commit
da107e5
·
verified ·
1 Parent(s): c5e23b8

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -3
README.md CHANGED
@@ -1,3 +1,106 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama2
3
+ ---
4
+
5
+ # Model Card for Model ID
6
+
7
+ <!-- Provide a quick summary of what the model is/does. -->
8
+
9
+ dragon-llama-7b-v0 part of the dRAGon ("Delivering RAG On ...") model series, RAG-instruct trained on top of a LLama-2 base model.
10
+
11
+ DRAGON models have been fine-tuned with the specific objective of fact-based question-answering over complex business and legal documents with an emphasis on reducing hallucinations and providing short, clear answers for workflow automation.
12
+
13
+ ### Benchmark Tests
14
+
15
+ Evaluated against the benchmark test: [RAG-Instruct-Benchmark-Tester](https://www.huggingface.co/datasets/llmware/rag_instruct_benchmark_tester)
16
+ Average of 2 Test Runs with 1 point for correct answer, 0.5 point for partial correct or blank / NF, 0.0 points for incorrect, and -1 points for hallucinations.
17
+
18
+ --**Accuracy Score**: **97.25** correct out of 100
19
+ --Not Found Classification: 92.50%
20
+ --Boolean: 95.00%
21
+ --Math/Logic: 63.75%
22
+ --Complex Questions (1-5): 3 (Medium)
23
+ --Summarization Quality (1-5): 3 (Coherent, extractive)
24
+ --Hallucinations: No hallucinations observed in test runs.
25
+
26
+ For test run results (and good indicator of target use cases), please see the files ("core_rag_test" and "answer_sheet" in this repo).
27
+
28
+ ### Model Description
29
+
30
+ <!-- Provide a longer summary of what this model is. -->
31
+
32
+ - **Developed by:** llmware
33
+ - **Model type:** LLama-2
34
+ - **Language(s) (NLP):** English
35
+ - **License:** LLama 2 Community License Agreement
36
+ - **Finetuned from model:** Llama-2-7B-Base
37
+
38
+
39
+ ### Direct Use
40
+
41
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
42
+
43
+ DRAGON is designed for enterprise automation use cases, especially in knowledge-intensive industries, such as financial services,
44
+ legal and regulatory industries with complex information sources.
45
+
46
+ DRAGON models have been trained for common RAG scenarios, specifically: question-answering, key-value extraction, and basic summarization as the core instruction types
47
+ without the need for a lot of complex instruction verbiage - provide a text passage context, ask questions, and get clear fact-based responses.
48
+
49
+
50
+ ## Bias, Risks, and Limitations
51
+
52
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
53
+
54
+ Any model can provide inaccurate or incomplete information, and should be used in conjunction with appropriate safeguards and fact-checking mechanisms.
55
+
56
+
57
+ ## How to Get Started with the Model
58
+
59
+ The fastest way to get started with dRAGon is through direct import in transformers:
60
+
61
+ from transformers import AutoTokenizer, AutoModelForCausalLM
62
+ tokenizer = AutoTokenizer.from_pretrained("dragon-llama-7b-v0")
63
+ model = AutoModelForCausalLM.from_pretrained("dragon-llama-7b-v0")
64
+
65
+ Please refer to the generation_test .py files in the Files repository, which includes 200 samples and script to test the model. The **generation_test_llmware_script.py** includes built-in llmware capabilities for fact-checking, as well as easy integration with document parsing and actual retrieval to swap out the test set for RAG workflow consisting of business documents.
66
+
67
+ The dRAGon model was fine-tuned with a simple "\<human> and \<bot>" wrapper, so to get the best results, wrap inference entries as:
68
+
69
+ full_prompt = "<human>: " + my_prompt + "\n" + "<bot>:"
70
+
71
+ The BLING model was fine-tuned with closed-context samples, which assume generally that the prompt consists of two sub-parts:
72
+
73
+ 1. Text Passage Context, and
74
+ 2. Specific question or instruction based on the text passage
75
+
76
+ To get the best results, package "my_prompt" as follows:
77
+
78
+ my_prompt = {{text_passage}} + "\n" + {{question/instruction}}
79
+
80
+
81
+ If you are using a HuggingFace generation script:
82
+
83
+ # prepare prompt packaging used in fine-tuning process
84
+ new_prompt = "<human>: " + entries["context"] + "\n" + entries["query"] + "\n" + "<bot>:"
85
+
86
+ inputs = tokenizer(new_prompt, return_tensors="pt")
87
+ start_of_output = len(inputs.input_ids[0])
88
+
89
+ # temperature: set at 0.3 for consistency of output
90
+ # max_new_tokens: set at 100 - may prematurely stop a few of the summaries
91
+
92
+ outputs = model.generate(
93
+ inputs.input_ids.to(device),
94
+ eos_token_id=tokenizer.eos_token_id,
95
+ pad_token_id=tokenizer.eos_token_id,
96
+ do_sample=True,
97
+ temperature=0.3,
98
+ max_new_tokens=100,
99
+ )
100
+
101
+ output_only = tokenizer.decode(outputs[0][start_of_output:],skip_special_tokens=True)
102
+
103
+
104
+ ## Model Card Contact
105
+
106
+ Darren Oberst & llmware team