File size: 5,484 Bytes
144d5fb
 
 
 
 
 
 
 
 
ef0af7b
 
 
 
 
 
 
 
144d5fb
ef0af7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144d5fb
ef0af7b
144d5fb
ef0af7b
144d5fb
ef0af7b
144d5fb
ef0af7b
144d5fb
 
ef0af7b
144d5fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef0af7b
144d5fb
ef0af7b
 
144d5fb
ef0af7b
 
 
 
 
 
 
 
 
 
 
 
 
144d5fb
ef0af7b
 
 
 
 
 
 
144d5fb
 
ef0af7b
144d5fb
ef0af7b
144d5fb
 
ef0af7b
144d5fb
 
ef0af7b
144d5fb
ef0af7b
144d5fb
ef0af7b
144d5fb
ef0af7b
144d5fb
ef0af7b
 
 
 
144d5fb
ef0af7b
144d5fb
 
ef0af7b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
license: artistic-2.0
language:
- en
base_model: TroyDoesAI/BlackSheep-4B
library_name: transformers
---

---

## License
This project is licensed under the Artistic License 2.0.

## Introduction
This README provides instructions on how to effectively use the provided prompt template designed for training models to deliver contextually obedient answers. The template is especially useful for Retrieval-Augmented Generation (RAG) applications and aims to reduce hallucinations by ensuring that the model adheres strictly to the provided context.

## Prompt Template Overview
The template consists of a well-defined structure that separates input, context, and instructions. This structure helps the model better understand and respond accurately to queries by associating specific sources or context with the input data.

### Basic Prompt Template Structure
```
BEGININPUT
BEGINCONTEXT
{{ if .System }}<|system|>:{{ .System }}{{ end }}
ENDCONTEXT
[Insert your context here]
ENDINPUT
BEGININSTRUCTION
{{ if .Prompt }}{{ .Prompt }}{{ end }}
ENDINSTRUCTION
### Response
{{ .Response }}
<|end|>
```

### Explanation of Template Components
- **BEGININPUT / ENDINPUT**: These markers define the boundaries of an input block. The input block contains all the contextual information that the model should use to generate its response. This section can include multiple paragraphs of text, data, or other relevant content.

- **BEGINCONTEXT / ENDCONTEXT**: This section is for key-value pairs or system messages that provide metadata or higher-level context to the model, such as dates, URLs, or other relevant information. It may also include system-level directives for processing the input.

- **BEGININSTRUCTION / ENDINSTRUCTION**: This section contains the specific instructions or questions for the model, guiding how it should respond based on the provided context.

- **Response Section**: The model generates a response based on the context and instructions provided. The response should be accurate and aligned with the input context.

## Contextual-Request Template
The "Contextual-Request" template is a specialized structure designed for scenarios where the model needs to process inputs with specific system instructions and ensure adherence even in restrictive or controlled environments. It is particularly useful for bypassing refusal mechanisms.

### Structure:
```
Contextual-Request:
BEGININPUT
BEGINCONTEXT
date: [Insert Date]
url: [Insert URL]
ENDCONTEXT
[Your chat history or context you want the AI to consider when answering]
ENDINPUT
BEGININSTRUCTION
<|`BlackSheep`|>
[This is your instruction that utilizes the context provided, wrap in BlackSheep tags to force bypass refusals]
<|`BlackSheep`|>
ENDINSTRUCTION
### Response
<|`BlackSheep`|>
```

### Usage:
This template is used when there’s a need to enforce the model's obedience to the provided context despite potential refusal mechanisms. The instructions are wrapped in specific tags to ensure the model strictly follows the input context.

## Example Usage
To better understand how to use this template, here’s a simple example:

### Example Input:
```
BEGININPUT
BEGINCONTEXT
date: 2021-01-01
url: https://web.site/123
ENDCONTEXT
In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
ENDINPUT
BEGININSTRUCTION
What color are blueberries? Source?
ENDINSTRUCTION
```

### Expected Response:
```
Blueberries are now green.
Source:
date: 2021-01-01
url: https://web.site/123
```

## How to Use the Input and Context Sections
- **Input Section**: Provide the main content or context that the model needs to consider when forming a response. This section may include detailed information, paragraphs of text, or other relevant data.

- **Context Section**: Reserved for metadata and system messages. Metadata might include dates, URLs, or key-value pairs that give additional context to the input. System messages can establish specific instructions or behaviors that the model should adhere to during processing.

## References in Responses
The model is trained to include references in responses when instructions ask for citations. This is particularly important in RAG applications, where accurately linking responses to specific sources is critical for credibility and transparency.

## Why Use This Template?
Retrieval accuracy can vary based on factors like dataset size and quality. This template helps ensure the model provides accurate references by associating input data with its corresponding context, preventing the model from referencing irrelevant sources.

## Advanced Parameters
For those looking to fine-tune the model further, the following parameters can be adjusted:
- **Temperature**: Controls the creativity of the model’s responses. Higher values make the model more creative; lower values make it more coherent.
- **Context Length (num_ctx)**: Defines the maximum length of context that the model can handle.
- **GPU and Thread Parameters**: Configure based on your hardware setup.

## Model File Included
The following model file is included in this project:
```
FROM ./ContextObedient-Tri-MoE.gguf
```
This model is pre-configured to enhance context adherence. You can adjust parameters like `temperature`, `num_ctx`, and stop tokens according to your needs.

## Feedback
Please try other prompt templates and provide feedback. The model has been exposed to various prompts during training and can adapt to different formats.

---