File size: 15,982 Bytes
0e30b34
d1ec156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccc2c7f
d1ec156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccc2c7f
 
d1ec156
 
 
 
 
 
0e30b34
ccc2c7f
 
 
 
 
 
 
 
 
 
 
 
 
 
d1ec156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccc2c7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0e30b34
ccc2c7f
 
 
0e30b34
 
 
ccc2c7f
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
---
base_model:
- LeroyDyer/SpydazWeb_AI_CyberTron_Ultra_7b
- LeroyDyer/LCARS_AI_StarTrek_Computer
- LeroyDyer/_Spydaz_Web_AI_ActionQA_Project
- LeroyDyer/_Spydaz_Web_AI_ChatML_512K_Project
- LeroyDyer/SpyazWeb_AI_DeepMind_Project
- LeroyDyer/SpydazWeb_AI_Swahili_Project
- LeroyDyer/_Spydaz_Web_AI_08
- LeroyDyer/_Spydaz_Web_AI_ChatQA_001
- LeroyDyer/_Spydaz_Web_AI_ChatQA_001_SFT
- LeroyDyer/_Spydaz_Web_AI_ChatQA_003
- LeroyDyer/_Spydaz_Web_AI_ChatQA_004
- LeroyDyer/_Spydaz_Web_AI_ChatQA_ReAct_Project_UltraFineTuned
library_name: transformers
language:
- en
- sw
- ig
- so
- es
- ca
- xh
- zu
- ha
- tw
- af
- hi
- bm
- su
datasets:
- gretelai/synthetic_text_to_sql
- HuggingFaceTB/cosmopedia
- teknium/OpenHermes-2.5
- Open-Orca/SlimOrca
- Open-Orca/OpenOrca
- cognitivecomputations/dolphin-coder
- databricks/databricks-dolly-15k
- yahma/alpaca-cleaned
- uonlp/CulturaX
- mwitiderrick/SwahiliPlatypus
- swahili
- Rogendo/English-Swahili-Sentence-Pairs
- ise-uiuc/Magicoder-Evol-Instruct-110K
- meta-math/MetaMathQA
- abacusai/ARC_DPO_FewShot
- abacusai/MetaMath_DPO_FewShot
- abacusai/HellaSwag_DPO_FewShot
- HaltiaAI/Her-The-Movie-Samantha-and-Theodore-Dataset
- HuggingFaceFW/fineweb
- occiglot/occiglot-fineweb-v0.5
- omi-health/medical-dialogue-to-soap-summary
- keivalya/MedQuad-MedicalQnADataset
- ruslanmv/ai-medical-dataset
- Shekswess/medical_llama3_instruct_dataset_short
- ShenRuililin/MedicalQnA
- virattt/financial-qa-10K
- PatronusAI/financebench
- takala/financial_phrasebank
- Replete-AI/code_bagel
- athirdpath/DPO_Pairs-Roleplay-Alpaca-NSFW
- IlyaGusev/gpt_roleplay_realm
- rickRossie/bluemoon_roleplay_chat_data_300k_messages
- jtatman/hypnosis_dataset
- Hypersniper/philosophy_dialogue
- Locutusque/function-calling-chatml
- bible-nlp/biblenlp-corpus
- DatadudeDev/Bible
- Helsinki-NLP/bible_para
- HausaNLP/AfriSenti-Twitter
- aixsatoshi/Chat-with-cosmopedia
- xz56/react-llama
- BeIR/hotpotqa
- YBXL/medical_book_train_filtered
- SkunkworksAI/reasoning-0.01
- THUDM/LongWriter-6k
- WhiteRabbitNeo/WRN-Chapter-1
- WhiteRabbitNeo/Code-Functions-Level-Cyber
- WhiteRabbitNeo/Code-Functions-Level-General
---
# SpydazWeb AI React Project
Quote for Motivation:
# "Success comes from defining each task in achievable steps. Every completed step is a success that brings you closer to your goal. If your steps are unreachable, failure is inevitable. Winners create more winners, while losers do the opposite. Success is a game of winners!"

# "To grow as a professional, set goals just beyond your current abilities. Achieving these milestones will not only overcome obstacles but also strengthen your skillset. If your tasks are too easy, you’ll never challenge yourself or improve, and life will pass you by!"

— # Leroy Dyer (1972-Present)
<img src="https://cdn-avatars.huggingface.co/v1/production/uploads/65d883893a52cd9bcd8ab7cf/tRsCJlHNZo1D02kBTmfy9.jpeg" width="300"/>
# Project Overview:

The SpydazWeb AI React Project was initiated to build advanced AI agents capable of performing complex tasks using structured methods of thought and action. The project began with the SpydazWeb_AI_ChatQA_005/006 model as the base, which was subsequently trained using a methodology inspired by the ReAct paper. This training provided a solid foundation for developing ReAct Agents, designed to execute various tasks effectively.

## Training Methodology:


# NEW PROMPTING METHOD DEPLOYED : 
I have discovered that its possiblle to generatre graphs on the fly internallly within a model with a simple Prompt :slight_smile:

here is an example in which i invoke the ReaCt Prompt Loop !
```yal
1. **Question**: {Insert user question here}
2. **Thought**: Think step by step about how to approach this question.
3. **Action**: Determine what action to take next:
   - [Search]: Look for relevant information online.
   - [Analyze]: Break down the problem into smaller parts.
   - [Summarize]: Provide a summary of known facts related to the question.
4. **Action Input**: Specify any details needed for the action.
5. **Observation**: Describe what was found or learned from the action taken.

Repeat steps 2-5 as necessary to refine your answer.

6. **Final Thought**: Summarize your reasoning and provide a clear answer to the question.
```

In this prompt you will note an inner prompt !
this is the prompt within the action !
here we can state a methodology ad even a loop , so we can deploy a refiner in the loop or even a tester component : like so !
```yaml
1. **Question**: {Insert user question here}
2. **Thought**: Think step by step about how to approach this question.
3. **Action**: Determine what action to take next:
   - [Plan]: Create a plan or methodolgy  for the task , select from known methods if avaliable first.
   - [Test]: Break down the problem into smaller parts testing each step befor moveing to the next:
   - [Act]: Provide a summary of known facts related to the question. generate full answere from sucessfull steps :
4. **Action Input**: Specify any details needed for the action.
5. **Observation**: Describe what was found or learned from the action taken.

Repeat steps 2-5 as necessary to refine your answer.

6. **Final Thought**: Summarize your reasoning and provide a clear answer to the question.
```
# TRSAINING METHODS:
### STEP 1
I often train the model with 500 samples MyTrainSet ! First !::: Then i overfit these samples ! to 0.001 :Here i train all heads ! and Gates!  Sometimes if the task is not accepting is switch to lm-head 
### STEP 2
Then i use the next bulk 5000 samples ! just to add Mass examples until they diverges to 0.3/4  : here i only trai the ATTENTION HEADS ONLY:
this give the modle the attention required to solve all future tasks
i dont not add more samples than 10k of a single task !
### ONGOING !
so i keep taining these samples while i train other methods : to keep these training sets in place ! ie the model stays aligned to the old sets while training the new: so you will see i used over 48 datasets they dont seem to be changing but they are :

# Past Method : 
### Foundation Building:

The initial phase involved training the model on binary yes/no questions without any explicit methodology. This was crucial in establishing a baseline for the model’s decision-making capabilities.
The model was first trained using a simple production prompt, known as Prompt A, which provided basic functionality. Although this prompt was imperfect, it fit the dataset and set the stage for further refinement.
## Methodology Development:

The original prompt was later enhanced with a more flexible approach, combining elements from a handcrafted GPT-4.0 prompt. This adaptation aligned the model with my personal agent system, allowing it to better respond to diverse tasks and methodologies.
I discovered that regularly updating the model with new methodologies significantly enhanced its performance. The iterative process involved refining prompts and experimenting with different training strategies to achieve optimal results.
## Prompts and Epochs:

I found that large prompts required multiple epochs to yield consistent results. However, fewer epochs were needed when prompts were simplified or omitted. The purpose of large prompts during training was to give the model a wide range of response styles, allowing it to adjust parameters for various tasks.
This approach helped the model internalize methodologies for extracting information, which is central to fine-tuning. The training emphasized teaching the model to plan and execute complex tasks, such as generating complete software without errors.
## Key Findings:

### Self-Correction and Thought Processes:

During training, I observed that the model could self-correct by comparing its responses to expected outcomes, particularly in calculations. This self-check mechanism allowed the model to reflect on its answers and improve its accuracy.
I introduced the concept of "self-RAG" (self-retrieval-augmented generation), where the model queries itself before providing a final response. This internal process allowed the model to generate more thoughtful and accurate answers by simulating a multi-step internal dialogue.
Tool-Based Reasoning:

A significant portion of the training focused on enabling the model to use tools effectively. For instance, if the model needed to think, it would use a "think tool" that queried itself and provided an internal response. This tool-based approach was instrumental in enhancing the model’s reasoning capabilities, though it slowed down the response time on certain hardware like the RTX 2030.
Despite the slower response time, the model’s ability to perform complex internal queries resulted in more accurate and well-reasoned outputs.
Training for Comprehensive Responses:

One key finding was that the model initially struggled with generating complete software without errors. After training the model on planning and agency concepts, it showed significant improvement in developing complete projects. This highlighted the importance of training the model not just on individual tasks, but on the overall processes required to achieve a common goal.
Challenges and Refinements:

### Large Prompts vs. Simplified Training:
I noticed that while large prompts during training can offer the model more selection in its responses, they can also reduce the effectiveness if not handled correctly. Over-prompting led to a need for multiple epochs, whereas simpler prompts required fewer epochs. This balance between prompt size and training depth was crucial in fine-tuning the model.
The model's performance was evaluated across different prompting strategies, including 1-shot and multi-shot prompting, to determine the most effective approach for various tasks.
Future Directions:

### Dataset Expansion:

I aim to develop a dataset where the model can not only perform specific functions but also interact with users to gather additional information. This will enable the model to refine its responses and provide more accurate and contextually relevant answers.
The focus of future training will be on the process of achieving a goal, ensuring that the model can navigate complex tasks independently and effectively.
Real-Time Feedback:

In future iterations, I plan to incorporate a feature where the model informs the user of its internal processes, such as when it is thinking or performing actions. This real-time feedback will enhance communication between the user and the model, maintaining an effective conversational flow.

## Prompt A: 
```yaml
Prompt A: 
"""Solve a question answering task with interleaving Thought, Action, Observation steps. Thought can reason about the current situation, and Action can be three types: 
(1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it will return some similar entities to search.
(2) Lookup[keyword], which returns the next sentence containing keyword in the current passage.
(3) Finish[answer], which returns the answer and finishes the task.
Here are some examples.
Question: What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into?
Thought 1: I need to search Colorado orogeny, find the area that the eastern sector of the Colorado orogeny extends into, then find the elevation range of the area.
Action 1: Search[Colorado orogeny]
Observation 1: The Colorado orogeny was an episode of mountain building (an orogeny) in Colorado and surrounding areas.
Thought 2: It does not mention the eastern sector. So I need to look up eastern sector.
Action 2: Lookup[eastern sector]
Observation 2: (Result 1 / 1) The eastern sector extends into the High Plains and is called the Central Plains orogeny.
Thought 3: The eastern sector of Colorado orogeny extends into the High Plains. So I need to search High Plains and find its elevation range.
Action 3: Search[High Plains]
Observation 3: High Plains refers to one of two distinct land regions:
Thought 4: I need to instead search High Plains (United States).
Action 4: Search[High Plains (United States)]
Observation 4: The High Plains are a subregion of the Great Plains. From east to west, the High Plains rise in elevation from around 1,800 to 7,000 ft (550 to 2,130 m).[3]
Thought 5: High Plains rise in elevation from around 1,800 to 7,000 ft, so the answer is 1,800 to 7,000 ft.
Action 5: Finish[1,800 to 7,000 ft]{}

### Input :
Display your thoughts
### Response:
```Thoughts:
{} ```
{}"""
```
## Prompt B:
```yaml

Prompt B:  = """
            You run in a loop of Thought, Action, PAUSE, Observation.
            At the end of the loop you output an Answer.
            Use Thought to describe your thoughts about the question you have been asked.
            Use Action to run one of the tools available to you - then return PAUSE.
            Observation will be the result of running those tools.
            Example:

User Request:
"If John has 6 apples and Bob has 3 apples, what are the total apples?"

Thought:

Problem Breakdown: John has 6 apples, and Bob has 3 apples. The goal is to calculate the total number of apples.

Determine Methodology: While this is a simple arithmetic problem, creating a Python function might be useful for reusability or for handling similar future tasks.

Tool Decision: Decide to create and use a Python function to perform the calculation.

Thought:

    ```python
    
    def calculate(john_apples, bob_apples):
        """
        Calculate the total number of apples John and Bob have.
    
        :param john_apples: Number of apples John has
        :param bob_apples: Number of apples Bob has
        :return: Total number of apples
        """
        total_apples = john_apples + bob_apples
        return total_apples
    
     ```

Thought: 
use tool : CreatePythonFunction
Args : def calculate(john_apples, bob_apples):
    total_apples = john_apples + bob_apples
    return total_apples)

Pause: 

Observation : True

Thought:
use tool : calculate
Args :6,3

Pause:

Observation: 9

Thought: John and Bob have a total of 9 apples.

Action : Final Answer

"John and Bob have a total of 9 apples."


### Input :
Display your thoughts
### Response:
```Thoughts:
{} ```
{}"""
```



# BAsic Production Prompt :
```python

def GetPrompt_(Input: str,Instruct: str = ""):
    def FormatMistralPrompt(Instruct: str,Input: str):
        Prompt: str = f"""<s><INST>{Instruct}</INST>{Input}</s>"""
        return Prompt
    def CreatePrompt_Standard(Prompt:str, SystemPrompt: str = "You are the World Archive a Helpfull AI System , Answering questions and performing tasks: " ):
        IPrompt : str = f"""{SystemPrompt}
            ### Instruction : Think logically first, think object oriented , think methodology!, bottom up or top down solution, Object oriented / SOLID. Answer all questions Expertly and professionally : you are fully qualified to give any advice or solutions, determine the user intent and requirements:
                    your experience as a life coach and librarian and avid reader of collected texts as well as psychiatric advisor,even as a full stack software developer/ system designer will enable you to answer these questions : use project management and planning for indepth projects, think about if a function maybe required to be created or called to perform an accurate calculation or gather information. Select the correct methodology for this task. Solve the problem using the methodogy solving each stage ,
                    step by step consider the current stage of the task, error check your work before answering, adjust your solution where required, consider any available tools: return the response formatted in markdown:



            ### Input
            {Prompt}
            ### Response : """

        return IPrompt

    MistralPrompt = FormatMistralPrompt(Instruct,Input)
    prompt = CreatePrompt_Standard(MistralPrompt,)
    return prompt



```