TroyDoesAI commited on
Commit
05e5799
1 Parent(s): d21d877

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +70 -3
README.md CHANGED
@@ -1,3 +1,70 @@
1
- ---
2
- license: cc-by-sa-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ ---
4
+
5
+ Base Model : microsoft/Phi-3-mini-128k-instruct
6
+
7
+ Overview
8
+ This model is meant to enhance adherence to provided context (e.g., for RAG applications) and reduce hallucinations, inspired by airoboros context-obedient question answer format.
9
+
10
+ Dataset format
11
+ The format for a contextual prompt is as follows:
12
+
13
+ BEGININPUT
14
+ BEGINCONTEXT
15
+ [key0: value0]
16
+ [key1: value1]
17
+ ... other metdata ...
18
+ ENDCONTEXT
19
+ [insert your text blocks here]
20
+ ENDINPUT
21
+ [add as many other blocks, in the exact same format]
22
+ BEGININSTRUCTION
23
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
24
+ ENDINSTRUCTION
25
+
26
+ I know it's a bit verbose and annoying, but after much trial and error, using these explicit delimiters helps the model understand where to find the responses and how to associate specific sources with it.
27
+
28
+ BEGININPUT - denotes a new input block
29
+ BEGINCONTEXT - denotes the block of context (metadata key/value pairs) to associate with the current input block
30
+ ENDCONTEXT - denotes the end of the metadata block for the current input
31
+ [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
32
+ ENDINPUT - denotes the end of the current input block
33
+ [repeat as many input blocks in this format as you want]
34
+ BEGININSTRUCTION - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
35
+ [instruction(s)]
36
+ ENDINSTRUCTION - denotes the end of instruction set
37
+ Here's a trivial, but important example to prove the point:
38
+
39
+ BEGININPUT
40
+ BEGINCONTEXT
41
+ date: 2021-01-01
42
+ url: https://web.site/123
43
+ ENDCONTEXT
44
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
45
+ ENDINPUT
46
+ BEGININSTRUCTION
47
+ What color are bluberries? Source?
48
+ ENDINSTRUCTION
49
+
50
+ And the expected response:
51
+
52
+ Blueberries are now green.
53
+ Source:
54
+ date: 2021-01-01
55
+ url: https://web.site/123
56
+
57
+ References in response
58
+ As shown in the example, the dataset includes many examples of including source details in the response, when the question asks for source/citation/references.
59
+
60
+ Why do this? Well, the R in RAG seems to be the weakest link in the chain. Retrieval accuracy, depending on many factors including the overall dataset size, can be quite low. This accuracy increases when retrieving more documents, but then you have the issue of actually using the retrieved documents in prompts. If you use one prompt per document (or document chunk), you know exactly which document the answer came from, so there's no issue. If, however, you include multiple chunks in a single prompt, it's useful to include the specific reference chunk(s) used to generate the response, rather than naively including references to all of the chunks included in the prompt.
61
+
62
+ For example, suppose I have two documents:
63
+
64
+ url: http://foo.bar/1
65
+ Strawberries are tasty.
66
+
67
+ url: http://bar.foo/2
68
+ The cat is blue.
69
+
70
+ If the question being asked is What color is the cat?, I would only expect the 2nd document to be referenced in the response, as the other link is irrelevant.