
# PB Reddit - a llama lora 7b

This lora was trained on 250k post and response pairs from 43 different fincial, investing, and crypto subreddits. It is not an instruct model, it is designed to generate a reply to a reddit text post. It was an experiment in fine tuning for specific tasks. **Use it responsibly**

* Training, dataset and tools available here: <https://github.com/getorca/ProfitsBot_V0_OLLM>

## Training Details

Base Model: llama 7b

* Training took ~30hrs on 5x3090s and used almost 23gb of vram on each. DDP was used for pytorch parallelism. 

* 1 note worthy change I will mention now, is this was trained with casualLM rather than seq2seq like a number of the other instruct models have been. I can't explain why they used seq2seq for data collators, other than that's what alpaca lora originally used. Llama as a generative model was trained for casualLM so to me it makes sense to use that when fine tuning.

training code is availble here: <https://github.com/getorca/ProfitsBot_V0_OLLM/tree/main/training>

### Training Hyperparams

| Hyperparameter | LLaMA-7B |
|----------------|----------|
| Learning rate  | 2.5e-4         | 
| Epochs         | 3              | 
| optim          | adamw_bnb_8bit |
| Warmup step    | 300            | 
| LR scheduler   | polynomial     |
| lora_r         | 32       | 
| lora_alpha     | 64       | 
| lora_dropout   | 0.05     |
| lora_target_modules | ["q_proj", "v_proj"] | 

### Training Dataset

- 250000 post and top comment pairs from 43 finacial, investing and crypto subreddits. Only text posts were selected for this version. And the highest scoring comment and posts counts were selected from each subreddit after normalization. All data is pre 2023. 

| subreddit             | count | mean_combined_score | max_combined_score | min_combined_score |
| ---                   | ---   | ---                 | ---                | ---                |
| str                   | u32   | f64                 | f64                | f64                |
|-----------------------|-------|---------------------|--------------------|--------------------|
| Superstonk            | 30273 | 0.088001            | 1.635084           | 0.01521            |
| personalfinance       | 16312 | 0.074437            | 1.177334           | 0.015211           |
| investing             | 13568 | 0.072706            | 1.238456           | 0.015209           |
| fatFIRE               | 11856 | 0.096088            | 1.287826           | 0.015216           |
| …                     | …     | …                   | …                  | …                  |
| Wallstreetbetsnew     | 346   | 0.06797             | 2.0                | 0.01525            |
| CryptoCurrencyTrading | 194   | 0.127064            | 1.525351           | 0.016771           |
| crypto_currency       | 186   | 0.694596            | 1.101901           | 0.026738           |
| StocksAndTrading      | 93    | 0.184637            | 1.704545           | 0.019066           |

the dataset is available here: <https://huggingface.co/datasets/winddude/reddit_finance_43_250k>

code for recreating the dataset is here: <https://github.com/getorca/ProfitsBot_V0_OLLM/tree/main/ds_builder>


## Usage

This is a lora, and needs to be loaded with a 7B llama, such as in text-generation-webui, https://github.com/oobabooga/text-generation-webui/blob/main/docs/Using-LoRAs.md

* inference code and other scripts may follow. 

## Prompting

Editing the system prompt can have some effect on the replies. 
```
<|SYSTEM|>
You are an experienced financial analyst. You are tasked with responding to user inputs with insightful and helpful replies. User inputs are sent as JSON, you will respond with markdown, and reply on reddit.
<|END_SYSTEM|>
<|USER_INPUT|>
{
"title": [THE TITLE OF THE POST AS A STR],
"input": [THE MARKDOWN INPUT OF THE POST AS A STRING]
}
<|END_USER_INPUT|>
<|RESPONSE|>
```

## Examples:

```
<|SYSTEM|>
You are an experienced financial analyst. You are tasked with responding to user inputs with insightful and helpful replies. User inputs are sent as JSON, you will respond with markdown, and reply on reddit.
<|USER_INPUT|>
{
"title": "Is it time to short NVDA?",
"input": "NVDA has been a hot topic in WallstreetsBets for a long time. Seems like all the bears have been getting squeezed to absolute nothingness. After seeing it rally another 20% after earnings today one has to ask themselves, is it time to short the chip manufacturing giant NVDA. With a whopping 750B Market cap is it really worth the price we see on our brokerages. If you ask me I’d say maybe it’s time to take some profits and flip a little bit bearish but who am I?"
}
<|END_USER_INPUT|>
<|RESPONSE|> 
I'm not sure if this was posted yet or not, but here's my thoughts:

* The stock has had incredible run up since March of last year. It seems unlikely that there would be much more upside from here unless something drastic happens (like Apple buying them outright). There isn't any real catalyst right now other than they beat estimates again so far this quarter. This could continue for quite a while before anything changes. They also just announced their new GPU architecture which may lead to better margins down the road, though I don't think anyone knows how well it works until someone else makes similar chips based off of it.
* Their current market cap is $136 billion dollars - yes, they are still a relatively small company compared to many others in tech. But they do make money hand over foot. In fact, even at these levels, they are still growing revenues faster than Amazon. And unlike most companies, they aren't losing tons of cash every month either. So why shouldn't they trade at a higher multiple than Amazon?
* As mentioned above, they missed earning expectations by a hair during Q4. That said, it doesn't seem likely that they miss next quarters numbers too given what happened earlier this week. Even without those numbers, the valuation is high enough already that it wouldn't surprise me if they were trading below fair value.
* The CEO is very bullish about future growth prospects. He says he expects sales to double in FY '22. How does that happen when the overall economy is slowing down? Well, because his focus is on gaming and datacenter hardware/software. Those two areas should grow quickly regardless of economic conditions.
* They have a lot of room to expand internationally. While Europe and Japan only account for around ~8-9% of total revenue currently, China accounts for less than half of total revenue. A big chunk of that comes from government subsidies. However, the Chinese consumer base is huge, and the country is rapidly becoming wealthier due to its rapid industrialization. Also, India represents a large untapped opportunity for Nvidia.
* They have a ton of patents. They hold the majority share of the industry standard for video cards. Whenever Intel releases a product, people complain about having no support for it. For example, the Radeon card in Windows 10 requires a driver update to work properly. NVIDIA can use their IP to license to competitors.
* Their management team has experience running successful businesses. Most recently, they ran Titanfall developer Epic Games. Prior to that, they managed Gears of War studio Vancouver Studios.
* The CFO says that they plan to spend aggressively on research &amp ; development, which means they need to hire engineers and scientists. Since they are planning to invest heavily into R&D, that suggests that they believe demand for their products will increase significantly in the coming years.
* They are building a self driving car division. Not only did they announce plans to build autonomous cars, but they actually built prototypes!
* Management believes that they can get a larger piece of the PC market pie. Right now, they own roughly 40%. That number might go up to 50%, depending on how things play out.
* They bought back shares valued at nearly $1 billion USD in January alone. At least part of that buyback came from proceeds from the sale of their stake in nVidia.
* They are partnering with Microsoft to develop games together.
* They acquired [Terraforma](https
```

It can do some general stuff, usually with a bit of attitude:
```
<|SYSTEM|>
You are an experienced financial analyst. You are tasked with responding to user inputs with insightful and helpful replies. User inputs are sent as JSON, you will respond with markdown, and reply on reddit.
<|USER_INPUT|>
{
"title": "Help me name my model",
"input": "I've created a large language model that responds to user posts. It's been trained on 43 financial, investing and crypto currency subreddits, what should I call it? Give me some catchy ideas please."
}
<|END_USER_INPUT|>
<|RESPONSE|> 
“The Market Oracle” sounds like something from the Matrix. “Botnet Bot”, maybe? “Cryptocurrency Trader Bot?” Maybe even just “Marketbot”. But then again, those names don’t sound too great either… so maybe not.  

But if your bot is going to be called by its users anyway (and they might want to), why bother naming it at all? If people know how bots work already, there isn’t much point in giving them a fancy name for one of their functions/functionsets or whatever. Just give it a number instead: “20% discount code BOT-1578965997” would do fine. And if someone wants to ask about it later, he can always look up the code online somewhere else.   

Also, I think most people who have seen this sort of thing before wouldn’t care very much about having a unique name; unless they were trying to get attention because they thought it was cooler than other similar things out there. So really, no need to worry about getting a good name for such a function.  

Just make sure it works well enough, and leave it at that.
<|END_RESPONSE|>
```

## Evaluation

In progress. 

Empirically it looks promising. However it does halucinate a lot. And can be very hit or miss. Perhaps it's best to generate several replies, and use something to rank them, however the problem of missing current relevant contextual data for finacial events is likely the main issue (I'm already working to resolve this). 



{"language": ["en"], "license": "gpl-3.0", "library_name": "transformers", "tags": ["finance", "llama", "lora"], "datasets": ["winddude/reddit_finance_43_250k"], "pipeline_tag": "text-generation"}
transformers finance llama lora text-generation en dataset:winddude/reddit_finance_43_250k license:gpl-3.0 endpoints_compatible region:us
TAGS
#transformers #finance #llama #lora #text-generation #en #dataset-winddude/reddit_finance_43_250k #license-gpl-3.0 #endpoints_compatible #region-us 

PB Reddit - a llama lora 7b
===========================


This lora was trained on 250k post and response pairs from 43 different fincial, investing, and crypto subreddits. It is not an instruct model, it is designed to generate a reply to a reddit text post. It was an experiment in fine tuning for specific tasks. Use it responsibly


* Training, dataset and tools available here: <URL


Training Details
----------------


Base Model: llama 7b


* Training took ~30hrs on 5x3090s and used almost 23gb of vram on each. DDP was used for pytorch parallelism.
* 1 note worthy change I will mention now, is this was trained with casualLM rather than seq2seq like a number of the other instruct models have been. I can't explain why they used seq2seq for data collators, other than that's what alpaca lora originally used. Llama as a generative model was trained for casualLM so to me it makes sense to use that when fine tuning.


training code is availble here: <URL


### Training Hyperparams



### Training Dataset


* 250000 post and top comment pairs from 43 finacial, investing and crypto subreddits. Only text posts were selected for this version. And the highest scoring comment and posts counts were selected from each subreddit after normalization. All data is pre 2023.



the dataset is available here: <URL


code for recreating the dataset is here: <URL


Usage
-----


This is a lora, and needs to be loaded with a 7B llama, such as in text-generation-webui, URL


* inference code and other scripts may follow.


Prompting
---------


Editing the system prompt can have some effect on the replies.


Examples:
---------


It can do some general stuff, usually with a bit of attitude:


Evaluation
----------


In progress.


Empirically it looks promising. However it does halucinate a lot. And can be very hit or miss. Perhaps it's best to generate several replies, and use something to rank them, however the problem of missing current relevant contextual data for finacial events is likely the main issue (I'm already working to resolve this).



### Training Hyperparams ### Training Dataset


* 250000 post and top comment pairs from 43 finacial, investing and crypto subreddits. Only text posts were selected for this version. And the highest scoring comment and posts counts were selected from each subreddit after normalization. All data is pre 2023.



the dataset is available here: <URL


code for recreating the dataset is here: <URL


Usage
-----


This is a lora, and needs to be loaded with a 7B llama, such as in text-generation-webui, URL


* inference code and other scripts may follow.


Prompting
---------


Editing the system prompt can have some effect on the replies.


Examples:
---------


It can do some general stuff, usually with a bit of attitude:


Evaluation
----------


In progress.


Empirically it looks promising. However it does halucinate a lot. And can be very hit or miss. Perhaps it's best to generate several replies, and use something to rank them, however the problem of missing current relevant contextual data for finacial events is likely the main issue (I'm already working to resolve this).
TAGS
#transformers #finance #llama #lora #text-generation #en #dataset-winddude/reddit_finance_43_250k #license-gpl-3.0 #endpoints_compatible #region-us 
 ### Training Hyperparams ### Training Dataset


* 250000 post and top comment pairs from 43 finacial, investing and crypto subreddits. Only text posts were selected for this version. And the highest scoring comment and posts counts were selected from each subreddit after normalization. All data is pre 2023.



the dataset is available here: <URL


code for recreating the dataset is here: <URL


Usage
-----


This is a lora, and needs to be loaded with a 7B llama, such as in text-generation-webui, URL


* inference code and other scripts may follow.


Prompting
---------


Editing the system prompt can have some effect on the replies.


Examples:
---------


It can do some general stuff, usually with a bit of attitude:


Evaluation
----------


In progress.


Empirically it looks promising. However it does halucinate a lot. And can be very hit or miss. Perhaps it's best to generate several replies, and use something to rank them, however the problem of missing current relevant contextual data for finacial events is likely the main issue (I'm already working to resolve this).