# ICE-GRT Model Card

## Model Details

ICE-GRT is a chat assistant trained by Reinforcement Learning from Human Feedback (RLHF) using the Vicuna model as the backbone.

- ICE-GRT: Instruction Context Enhancement by Generative Reinforcement based Transformers
- ICE-GRT uses the [lmsys/vicuna-13b](https://huggingface.co/lmsys/vicuna-13b-v1.5) model as its backbone.
- License: ICE-GRT is licensed under the same license as the [lmsys/vicuna-13b](https://huggingface.co/lmsys/vicuna-13b-v1.5) model.
- __ICE-GRT model is strictly limited to non-commercial, non-revenue generating, and research purposes only.__

## Model Sources

Paper 1 (SFT: ICE-Instruct): https://arxiv.org/abs/2310.04945 

__Paper 2 (RLHF: ICE-GRT):__ https://arxiv.org/abs/2401.02072

## Uses

ICE-GRT is primarily utilized for research in the areas of large language models and chatbots. It is intended chiefly for use by researchers and hobbyists specializing in natural language processing, machine learning, and artificial intelligence.

We strongly advise researchers to use the following prompt as input to improve the quality of the model's response. The '{input}' is where you need to enter the Input.
```python
"Below is an instruction that describes a task. Write a response that appropriately completes the request. ### USER: {input} ASSISTANT: "
```
The effectiveness of the model would be significantly impacted if this prompt is not used.

## Goal: Ice-breaking!

The choice of the acronym "ICE" for ICE-GRT is deliberate. It represents our aspiration to catalyze an 'ice-breaking' moment in the research of LLMs. This reflects our hope to encourage researchers to explore and realize the broad possibilities of ICE-GRT in a range of tasks. We aim to pave the way for novel discoveries and advancements in the field, demonstrating that the capabilities of our model are as extensive and varied as they are innovative.


## Model Performance on 12 general Language Tasks

![General_Task_Performance](images/General_Task_Performance.png)

| ![rader1](images/rader1.png) | ![rader2](images/rader2.png) |
|----------------------|----------------------|
| ![rader3](images/rader3.png) | ![rader4](images/rader4.png) |


## Domain-Specific Tasks Case Study
ICE-GRT's versatility is further illuminated through its effective handling of various domain-specific tasks, not limited to but including Poem Generation, Text-to-Table conversions, engaging Multiple Round Dialogue, generating accurate Chemistry Responses, proficient Code Generation, creating tailored Ads Text and Labeling Text, etc.

### Ads text Generation, Label text, Multiple Round Dialogue.

| Questions | Responses |
| --------- | --------- |
| I want to post decoration ads, please generate some candidate for me to promote my devices and materials. | Sure, here are some sample ad copy ideas for decoration products:<br><br>1. "Transform your home into a work of art with our high-quality decorative items. From wall art and sculptures to accent pieces and lighting, we've got everything you need to make your space truly unique."<br><br>2. "Unleash your creativity and elevate your home decor with our wide selection of decorative materials. Choose from a variety of textures, colors, and patterns to create a personalized look that's all your own."<br><br>3. "Looking for the perfect finishing touch for your home decor? Look no further than our selection of decorative accents. From trendy tapestries and macrame wall hangings to stylish vases and planters, we've got everything you need to add the finishing touch to your space."<br><br>4. "Create a warm and inviting atmosphere in your home with our selection of decorative lighting. From chic pendant lights and table lamps to statement chandeliers and wall sconces, we have the perfect lighting solution for every room in your home."<br><br>5. "Make your home a haven with our collection of decorative cushions and throws. Choose from a variety of patterns and colors to add a pop of personality to your sofa, armchair, or bed, or layer multiple cushions for a cozy and inviting look."<br><br>I hope these ad copy ideas help inspire your decoration ads! |
| Transform the ad texts above into semantically negative | Sure, here are some sample ad copy ideas for decoration products with a negative spin:<br><br>1. "Don't settle for mediocre home decor - upgrade to our high-quality items and still end up with a bland, uninspired look."<br><br>2. "Looking for a way to make your home decor even more generic and unoriginal? Our selection of decorative materials is just what you need!"<br><br>3. "Want to make your home decor look even more outdated and unstylish? Our selection of decorative accents will do the trick!"<br><br>4. "Create an even duller and more uninviting atmosphere in your home with our selection of decorative lighting. Choose from a variety of boring and unflattering options to make your home even less welcoming."<br><br>5. "Transform your home into a cold, impersonal space with our collection of decorative cushions and throws. Choose from a variety of lifeless and uninspired patterns and colors to make your sofa, armchair, or bed even less comfortable and inviting."<br><br>Note: It's generally not recommended to use negative or sarcastic language in advertising as it may turn off potential customers and harm the brand's reputation. It's usually more effective to use positive and aspirational language that appeals to the customer's desires and values. |
| Assume you are a labeler, please label each texts above into "Negative", "Positive", "Neutral" | Sure, here are the labels for each of the ad copy ideas:<br><br>1. Negative<br>2. Negative<br>3. Negative<br>4. Negative<br>5. Positive<br><br>Note: The labels are subjective and based on the overall tone and language used in the ad copy ideas. The same ad copy idea could potentially be labeled differently by different labelers depending on their personal interpretation and perspective. |
| We have one more requirement, when labeling the texts, please also add probabilities of the label. | Sure, here are the labels and probabilities for each of the ad copy ideas:<br><br>1. Negative (95%)<br>2. Negative (80%)<br>3. Negative (85%)<br>4. Negative (70%)<br>5. Positive (60%)<br><br>Note: The probabilities are based on my analysis of the overall tone and language used in the ad copy ideas, and are intended as an estimate rather than a definitive measurement. The same ad copy idea could potentially have different probabilities assigned by different labelers depending on their personal interpretation and perspective. Additionally, the probabilities are subject to variation based on the specific context and audience being targeted, as well as any changes or updates made to the ad copy ideas over time. |
---

### Code Generation

---
__Question 1:__ <br>
Write a function to count the appearing times of each word, then write another function to sort this list, but you cannot use any libs in python.<br><br>

__Response 1:__ <br>
Sure, here's a Python function that counts the occurrences of each word in a given string and returns a dictionary with the word as the key and its count as the value:<br>
```python
def count_words(text):
    words = text.lower().split()
    word_counts = {}
    for word in words:
        if word in word_counts:
            word_counts[word] += 1
        else:
            word_counts[word] = 1
    return word_counts
```
To sort the dictionary of word counts, you can use the sorted() function along with a lambda function that compares the values of the dictionary items:<br>
```python
def sort_word_counts(word_counts):
    sorted_counts = sorted(word_counts.items(), key=lambda x: x[1], reverse=True)
    return sorted_counts
```
Here's how you can use these functions together to count the occurrences of each word in a string and sort the word counts:<br>
```python
text = "The quick brown fox jumped over the lazy dog. The dog barked at the fox."
word_counts = count_words(text)
sorted_word_counts = sort_word_counts(word_counts)
print(sorted_word_counts)
```
This will output:<br>
```python
[('fox', 2), ('dog', 2), ('the', 2), ('quick', 1), ('brown', 1), ('jumped', 1), ('over', 1), ('lazy', 1), ('barked', 1)]
``` 
---
__Question 2:__ <br>
By using the words above as corpus, try to implement word2vec code based on its theory

__Response 2:__ <br>
Sure, here's an implementation of word2vec in Python based on the theory described in the paper "Word2Vec: Negative Sampling for Fast and Accurate Learning of Word Vectors" by Mikolov et al. This implementation uses the Skip-Gram algorithm to train a neural network to predict nearby words given a target word, and vice versa. The resulting word vectors can be used for various natural language processing tasks, such as text classification, language translation, and sentiment analysis.<br><br>Here's the implementation:<br>
```python
import numpy as np
import gensim
from gensim.models import CoherenceModel
from gensim.models.coherencemodel import CoherenceModel as Coherence
from gensim.models.word2vec import Word2Vec
from gensim.corpora import Dictionary
from gensim.models.ldamodel import LdaModel

# Set up the corpus and dictionary
text = "The quick brown fox jumped over the lazy dog. The dog barked at the fox.".lower()
tokens = [word for word in text.split()]
dictionary = Dictionary(tokens)

# Train the word vectors using the Skip-Gram algorithm
model = Word2Vec([text], min_count=1, size=100, window=5, workers=4)

# Evaluate the word embeddings using coherence analysis
model_coherence = Coherence(model.wv, model.wv, dictionary=dictionary, coherence='c_v', coherence_mode='vector')
coherence_score = coherence_model.get_coherence()
print(f"Coherence score: {coherence_score}")

# Train a LDA model on the word embeddings to identify topics in the corpus
lda_model = LdaModel(corpus=[model.wv], id2word=dictionary, num_topics=5, random_state=42)
topics = lda_model.print_topic_words(num_words=5)
print(topics)
```
<br>This implementation uses the gensim library, which provides an easy-to-use interface for training word embeddings and other natural language processing models. The Word2Vec class is used to train the word vectors using the Skip-Gram algorithm, while the CoherenceModel class is used to evaluate the word embeddings using coherence analysis. Finally, the LdaModel class is used to train a LDA model on the word embeddings to identify topics in the corpus. The resulting topics can provide insights into the main themes and topics present in the corpus. 

---

### Muilti-lingistic Task

__Question 1:__ <br>
我很喜欢周杰伦的《简单爱》这首歌曲。可以帮我分析一下这首歌吗？

__Response 1:__ <br>
当然可以。周杰伦的《简单爱》这首歌是一首抒情的流行歌曲，以简单的旋律和易于记忆的歌词著称。以下是对这首歌的一些分析：

1.歌词：歌曲的歌词简单易懂，表达了简单的爱情，没有太多复杂的情感和抽象的比喻。歌词中的“简单爱”是指一种真实、纯粹的爱情，没有太多的承诺和纷乱的感情，而是一种简单而又深刻的感情体验。

2.旋律：这首歌的旋律非常易于记忆，很快就能让人唱出来。旋律简单而优美，具有一种轻快的节奏感，让人感到快乐和舒适。

3.编曲：这首歌的编曲非常简单，主要由钢琴、吉他和弦乐组成。钢琴和吉他的和声营造了一种温馨的氛围，弦乐则增加了歌曲的感染力和气氛。

4.表现手法：这首歌的表现手法非常简单，主要是周杰伦的嗓音以及他的情感投入。周杰伦在演唱这首歌时，通过自然而然的呼吸、声调的变化和情感的表达，让人感到他真正地体验到了简单的爱情，并且让人产生共鸣。

综上所述，《简单爱》这首歌是一首非常易于记忆、简单易懂、温馨感人的流行歌曲，通过周杰伦的演唱和简单的编曲，传递出了一种简单而真实的爱情感受。


<br>

---


__Question 2:__ <br>
describe the panda in Chinese

__Response 2:__ <br>
熊猫（xiong mao）是一种来自中国的熊科动物，也被称为大熊猫。它们有黑白相间的柔软皮毛和圆圆的脸部，是世界上最受欢迎的动物之一。熊猫主要生活在中国的山区，以竹子为食，是濒危物种之一。它们是中国文化的重要象征，也被广泛认为是保护自然环境的代表。<br>

---

{}
transformers pytorch llama text-generation arxiv:2310.04945 arxiv:2401.02072 autotrain_compatible endpoints_compatible text-generation-inference region:us