
# GALACTICA 6.7B Evol-Instruct

GALACTICA 6.7B fine-tuned on the Evol-Instruct 70k dataset.

The model card from the original Galactica repo can be found [here](https://github.com/paperswithcode/galai/blob/main/docs/model_card.md), and the original paper [here](https://galactica.org/paper.pdf).

The HF dataset for Evol-Instruct-70k can be found [here](https://huggingface.co/datasets/victor123/evol_instruct_70k), and the original GitHub repo for WizardLM is [here](https://github.com/nlpxucan/WizardLM).

## Model Details

The GALACTICA models are trained on a large-scale scientific corpus and are designed to perform scientific tasks.

## Model Use

The GALACTICA model card specifies that the primary indended users of the GALACTICA models are researchers studying language models applied to the scientific domain, and it cautions against production use of GALACTICA without safeguards due to the potential for the model to produce inaccurate information.
The original GALACTICA models are available under a non-commercial CC BY-NC 4.0 license, and models based on the Evol-Instruct-70k dataset are additionally subject to the [OpenAI Terms of Service](https://openai.com/policies/terms-of-use).

<details>
  <summary> Example Outputs </summary>
  
*__Full Prompt:__*
```
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
Write out Maxwell's equations and explain each one.

### Response:
```

*__Response:__*

Maxwell's equations are a set of four equations that describe the behavior of electromagnetic fields. These equations were developed by James Clerk Maxwell in 1864 and are widely used in the study of electromagnetism.

1. Gauss's Law: This equation states that the electric charge inside a closed surface is equal to the flux of electric field through the surface. Mathematically, it can be expressed as:

$$\nabla \bullet \textbf{E} = \frac{\rho}{\epsilon_0}$$

where E is the electric field, ρ is the charge density, ε0 is the electric constant, and ∇ is the divergence operator.

2. Faraday's Law: This equation states that the electric field around a closed loop is proportional to the time rate of change of magnetic flux through the loop. Mathematically, it can be expressed as:

$$\nabla \times \textbf{E} = -\frac{\partial\textbf{B}}{\partial t}$$

where B is the magnetic field, t is time, and ∇ × is the curl operator.

3. Gauss's Law for Magnetism: This equation states that the magnetic charge inside a closed surface is equal to the flux of magnetic field through the surface. Mathematically, it can be expressed as:

$$\nabla \bullet \textbf{B} = 0$$

where B is the magnetic field.

4. Ampere's Law: This equation states that the magnetic field around a closed loop is proportional to the current through the loop. Mathematically, it can be expressed as:

$$\nabla \times \textbf{B} = \mu_0\textbf{J} + \mu_0\epsilon_0\frac{\partial \textbf{E}}{\partial t}$$

where J is the current density, μ0 is the magnetic constant, and ε0 is the electric constant.

These equations form the foundation of all electromagnetic theory and are used to describe the behavior of electromagnetic fields in a wide range of applications, from radio waves to high-energy particles.

</details>

## Training Data

This model was trained by fine-tuning pre-trained GALACTICA 6.7B on the Evol-Instruct-70k dataset. GALACTICA models were trained on 106 billion tokens of open-access scientific text and data, including papers, textbooks, scientific websites, encyclopedias, and more.
Fine-tuning the base GALACTICA models on the 70k instruction-response pairs in the Evol-Instruct-70k dataset allows users to query the resulting model in an instruct-response fashion.

## How to Use

The GALACTICA Evol-Instruct-70K weights are made available for use with the `transformers` library.

<details>
  <summary> Click to expand </summary>

```python
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("GeorgiaTechResearchInstitute/galactica-6.7b-evol-instruct-70k")
model = AutoModelForCausalLM.from_pretrained("GeorgiaTechResearchInstitute/galactica-6.7b-evol-instruct-70k", device_map="auto", torch_dtype=torch.float16)

# the evol-instruct models were fine-tuned with the same hidden prompts as the Alpaca project
no_input_prompt_template = ("Below is an instruction that describes a task. "
                            "Write a response that appropriately completes the request.\n\n"
                            "### Instruction:\n{instruction}\n\n### Response:")
prompt = "Write out Maxwell's equations and explain the meaning of each one."
formatted_prompt = no_input_prompt_template.format_map({'instruction': prompt})

tokenized_prompt = tokenizer(formatted_prompt, return_tensors="pt").input_ids.to(model.device)
out_tokens = model.generate(tokenized_prompt)

print(tokenizer.batch_decode(out_tokens, skip_special_tokens=False, clean_up_tokenization_spaces=False))
```
</details>

## Training Resources

GALACTICA 6.7B Evol-Instruct was fine-tuned in about 22 hours using 8 A100 80GB GPUS, 16-bit mixed-precision, an effective batch-size of 64, and with a maximum context window of 2048 tokens. This model was trained using full-shard data parallelism.

## Performance and Limitations

Qualitative evaluation suggests that the evol-instruct-70k fine-tuned Galactica models are signficantly more controllable and attentive to user prompts than the Alpaca fine-tuned GALPACA models.

## Works Cited

```bibtex
@inproceedings{GALACTICA,
    title={GALACTICA: A Large Language Model for Science},
    author={Ross Taylor and Marcin Kardas and Guillem Cucurull and Thomas Scialom and Anthony Hartshorn and Elvis Saravia and Andrew Poulton and Viktor Kerkez and Robert Stojnic},
    year={2022}
}
```

```bibtex
@misc{xu2023wizardlm,
      title={WizardLM: Empowering Large Language Models to Follow Complex Instructions}, 
      author={Can Xu and Qingfeng Sun and Kai Zheng and Xiubo Geng and Pu Zhao and Jiazhan Feng and Chongyang Tao and Daxin Jiang},
      year={2023},
      eprint={2304.12244},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```

# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_GeorgiaTechResearchInstitute__galactica-6.7b-evol-instruct-70k)

| Metric                | Value                     |
|-----------------------|---------------------------|
| Avg.                  | 33.68   |
| ARC (25-shot)         | 42.58          |
| HellaSwag (10-shot)   | 49.3    |
| MMLU (5-shot)         | 32.96         |
| TruthfulQA (0-shot)   | 42.1   |
| Winogrande (5-shot)   | 56.27   |
| GSM8K (5-shot)        | 0.38        |
| DROP (3-shot)         | 12.16         |

{"license": "cc-by-nc-4.0", "library_name": "transformers", "tags": ["galactica", "wizardlm", "alpaca", "opt"], "datasets": ["victor123/evol_instruct_70k"], "pipeline_tag": "text-generation", "inference": false}
transformers pytorch opt text-generation galactica wizardlm alpaca dataset:victor123/evol_instruct_70k arxiv:2304.12244 license:cc-by-nc-4.0 autotrain_compatible has_space text-generation-inference region:us
TAGS
#transformers #pytorch #opt #text-generation #galactica #wizardlm #alpaca #dataset-victor123/evol_instruct_70k #arxiv-2304.12244 #license-cc-by-nc-4.0 #autotrain_compatible #has_space #text-generation-inference #region-us 

GALACTICA 6.7B Evol-Instruct
============================


GALACTICA 6.7B fine-tuned on the Evol-Instruct 70k dataset.


The model card from the original Galactica repo can be found here, and the original paper here.


The HF dataset for Evol-Instruct-70k can be found here, and the original GitHub repo for WizardLM is here.


Model Details
-------------


The GALACTICA models are trained on a large-scale scientific corpus and are designed to perform scientific tasks.


Model Use
---------


The GALACTICA model card specifies that the primary indended users of the GALACTICA models are researchers studying language models applied to the scientific domain, and it cautions against production use of GALACTICA without safeguards due to the potential for the model to produce inaccurate information.
The original GALACTICA models are available under a non-commercial CC BY-NC 4.0 license, and models based on the Evol-Instruct-70k dataset are additionally subject to the OpenAI Terms of Service.



 Example Outputs 
***Full Prompt:***


***Response:***


Maxwell's equations are a set of four equations that describe the behavior of electromagnetic fields. These equations were developed by James Clerk Maxwell in 1864 and are widely used in the study of electromagnetism.


1. Gauss's Law: This equation states that the electric charge inside a closed surface is equal to the flux of electric field through the surface. Mathematically, it can be expressed as:


$$\nabla \bullet \textbf{E} = \frac{\rho}{\epsilon\_0}$$


where E is the electric field, ρ is the charge density, ε0 is the electric constant, and ∇ is the divergence operator.


2. Faraday's Law: This equation states that the electric field around a closed loop is proportional to the time rate of change of magnetic flux through the loop. Mathematically, it can be expressed as:


$$\nabla \times \textbf{E} = -\frac{\partial\textbf{B}}{\partial t}$$


where B is the magnetic field, t is time, and ∇ × is the curl operator.


3. Gauss's Law for Magnetism: This equation states that the magnetic charge inside a closed surface is equal to the flux of magnetic field through the surface. Mathematically, it can be expressed as:


$$\nabla \bullet \textbf{B} = 0$$


where B is the magnetic field.


4. Ampere's Law: This equation states that the magnetic field around a closed loop is proportional to the current through the loop. Mathematically, it can be expressed as:


$$\nabla \times \textbf{B} = \mu\_0\textbf{J} + \mu\_0\epsilon\_0\frac{\partial \textbf{E}}{\partial t}$$


where J is the current density, μ0 is the magnetic constant, and ε0 is the electric constant.


These equations form the foundation of all electromagnetic theory and are used to describe the behavior of electromagnetic fields in a wide range of applications, from radio waves to high-energy particles.



Training Data
-------------


This model was trained by fine-tuning pre-trained GALACTICA 6.7B on the Evol-Instruct-70k dataset. GALACTICA models were trained on 106 billion tokens of open-access scientific text and data, including papers, textbooks, scientific websites, encyclopedias, and more.
Fine-tuning the base GALACTICA models on the 70k instruction-response pairs in the Evol-Instruct-70k dataset allows users to query the resulting model in an instruct-response fashion.


How to Use
----------


The GALACTICA Evol-Instruct-70K weights are made available for use with the 'transformers' library.



 Click to expand 

Training Resources
------------------


GALACTICA 6.7B Evol-Instruct was fine-tuned in about 22 hours using 8 A100 80GB GPUS, 16-bit mixed-precision, an effective batch-size of 64, and with a maximum context window of 2048 tokens. This model was trained using full-shard data parallelism.


Performance and Limitations
---------------------------


Qualitative evaluation suggests that the evol-instruct-70k fine-tuned Galactica models are signficantly more controllable and attentive to user prompts than the Alpaca fine-tuned GALPACA models.


Works Cited
-----------


Open LLM Leaderboard Evaluation Results
=======================================


Detailed results can be found here




TAGS
#transformers #pytorch #opt #text-generation #galactica #wizardlm #alpaca #dataset-victor123/evol_instruct_70k #arxiv-2304.12244 #license-cc-by-nc-4.0 #autotrain_compatible #has_space #text-generation-inference #region-us 
