avatarGao Dalie (高達烈)

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

6360

Abstract

ilt_in">range</span>(n): <span class="hljs-comment"># Create a flag that will allow the function to terminate early if there's nothing left to sort</span> swapped = <span class="hljs-literal">False</span>

    <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, n-i-<span class="hljs-number">1</span>):
        <span class="hljs-comment"># If the element found is greater than the next element swap them</span>
        <span class="hljs-keyword">if</span> arr[j] &gt; arr[j+<span class="hljs-number">1</span>]:
            arr[j], arr[j+<span class="hljs-number">1</span>] = arr[j+<span class="hljs-number">1</span>], arr[j]
            swapped = <span class="hljs-literal">True</span>

    <span class="hljs-comment"># If no two elements were swapped by inner loop, then the array is already sorted.</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> swapped:
        <span class="hljs-keyword">break</span></pre></div><p id="8c67"><b>Llama2 70 Billion</b></p><div id="9575"><pre><span class="hljs-keyword">def</span> <span class="hljs-title function_">bubble_sort</span>(<span class="hljs-params">arr</span>):
n = <span class="hljs-built_in">len</span>(arr)
<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(n-<span class="hljs-number">1</span>):
    <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, n-i-<span class="hljs-number">1</span>):
        <span class="hljs-keyword">if</span> arr[j] &gt; arr[j+<span class="hljs-number">1</span>]:
            arr[j], arr[j+<span class="hljs-number">1</span>] = arr[j+<span class="hljs-number">1</span>], arr[j]
<span class="hljs-keyword">return</span> arr</pre></div><p id="0916"><b>GPT-3.5</b></p><div id="ea2f"><pre><span class="hljs-keyword">def</span> <span class="hljs-title function_">bubble_sort</span>(<span class="hljs-params">arr</span>):
n = <span class="hljs-built_in">len</span>(arr)

<span class="hljs-comment"># Traverse through all array elements</span>
<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(n):
    <span class="hljs-comment"># Flag to indicate whether any swaps were made in this pass</span>
    swapped = <span class="hljs-literal">False</span>
    
    <span class="hljs-comment"># Last i elements are already in place, so we don't need to compare them again</span>
    <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, n-i-<span class="hljs-number">1</span>):
        <span class="hljs-comment"># Swap if the element found is greater than the next element</span>
        <span class="hljs-keyword">if</span> arr[j] &gt; arr[j+<span class="hljs-number">1</span>]:
            arr[j], arr[j+<span class="hljs-number">1</span>] = arr[j+<span class="hljs-number">1</span>], arr[j]  <span class="hljs-comment"># Swap elements</span>
            swapped = <span class="hljs-literal">True</span>
    
    <span class="hljs-comment"># If no two elements were swapped in this pass, the array is already sorted</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> swapped:
        <span class="hljs-keyword">break</span>

<span class="hljs-comment"># Example usage:</span> arr = [<span class="hljs-number">64</span>, <span class="hljs-number">34</span>, <span class="hljs-number">25</span>, <span class="hljs-number">12</span>, <span class="hljs-number">22</span>, <span class="hljs-number">11</span>, <span class="hljs-number">90</span>] bubble_sort(arr) <span class="hljs-built_in">print</span>(<span class="hljs-string">"Sorted array is:"</span>, arr)</pre></div><p id="7545">As a result, the <b>Mixtral-8x7B and GPT-3.5 output codes work correctly</b>, but only Llama2 70B works as is. It outputs a code that does not exist.</p><p id="f502">Llama2 70B’s version has obvious elementary mistakes, such as libraries not being imported.</p><p id="d920">From this result, it can be seen that Mixtral-8x7B has a higher performance than Llama2 70B and is equivalent to GPT-3.5.</p><h1 id="d2a6">Knowledge</h1><p id="d551">Enter the following prompt and verify that it outputs the correct information.</p><div id="e4ab"><pre>Give me <span class="hljs-selector-tag">a</span> list of the highest mountain elevations in France, ranking the <span class="hljs-attribute">top</span> <span class="hljs-number">5</span></pre></div><p id="5168"><b>Mixtral-8x7B</b></p><div id="985e"><pre>Mont Blanc - 4,810 meters (15,781 feet) Monte Cervin (Matterhorn) - 4,478 meters (14,692 feet) Mont Rosa - 4,634 meters (15,203 feet) Pic <span class="hljs-built_in">du</span> Midi d<span class="hljs-string">'Ossau - 2,884 meters (9,462 feet) Aiguille Verte - 4,122 meters (13,524 feet)</span></pre></div><p id="d8d2"><b>Llama2 70 Billion</b></p><div id="5297"><pre>Sure, here are the top 5 highest mountain elevations <span class="hljs-keyword">in</span> France, ranked <span class="hljs-keyword">in</span> order: Mont Blanc - 4,810 meters (15,781 feet) Mont Blanc <span class="hljs-built_in">du</span> Tacul - 4,248 meters (13,934 feet) Mont Maudit - 4,465 meters (14,649 feet) Dôme <span class="hljs-built_in">du</span> Goûter - 4,304 meters (14,120 feet) Aiguille <span class="hljs-built_in">du</span> Midi - 3,842 meters (12,606 feet)</pre></div><p id="363e"><b>GPT-3.5</b></p><div id="ce65"><pre><span class="hljs-number">1</span>- Mont Blanc: Mont Blanc, located <span class="hljs-keyword">in</span> the French Alps <span class="hljs-keyword">on</span> the border between France <span class="hljs-built_in">and</span> Italy, <span class="hljs-built_in">is</span> the highest mountain <span class="hljs-keyword">in</span> France <span class="hljs-built_in">and</span> Western Europe. Its elevation <span class="hljs-built_in">is</span> approximately <span class="hljs-number">4</span>,<span class="hljs-number">810</span> meters (<span class="hljs-number"

Options

15</span>,<span class="hljs-number">781</span> feet).

<span class="hljs-number">2</span>- Dô<span class="hljs-keyword">me</span> du Goûter: Dô<span class="hljs-keyword">me</span> du Goûter <span class="hljs-built_in">is</span> another prominent peak <span class="hljs-keyword">in</span> the Mont Blanc massif. It has an elevation <span class="hljs-keyword">of</span> about <span class="hljs-number">4</span>,<span class="hljs-number">304</span> meters (<span class="hljs-number">14</span>,<span class="hljs-number">118</span> feet).

<span class="hljs-number">3</span>- Barre des Écrins: Barre des Écrins <span class="hljs-built_in">is</span> the highest peak <span class="hljs-keyword">in</span> the Ecrins National Park <span class="hljs-keyword">in</span> the French Alps. It stands at an elevation <span class="hljs-keyword">of</span> approximately <span class="hljs-number">4</span>,<span class="hljs-number">102</span> meters (<span class="hljs-number">13</span>,<span class="hljs-number">458</span> feet).

<span class="hljs-number">4</span>- Mont Collon: Mont Collon <span class="hljs-built_in">is</span> part <span class="hljs-keyword">of</span> the Pennine Alps <span class="hljs-built_in">and</span> <span class="hljs-built_in">is</span> located near the border between France <span class="hljs-built_in">and</span> Switzerland. Its elevation <span class="hljs-built_in">is</span> approximately <span class="hljs-number">4</span>,<span class="hljs-number">363</span> meters (<span class="hljs-number">14</span>,<span class="hljs-number">314</span> feet).

<span class="hljs-number">5</span>- La Meije: La Meije <span class="hljs-built_in">is</span> also located <span class="hljs-keyword">in</span> the Ecrins National Park <span class="hljs-built_in">and</span> <span class="hljs-built_in">is</span> known <span class="hljs-keyword">for</span> its challenging climbing routes. It has an elevation <span class="hljs-keyword">of</span> about <span class="hljs-number">3</span>,<span class="hljs-number">984</span> meters (<span class="hljs-number">13</span>,<span class="hljs-number">071</span> feet).</pre></div><p id="aaf6">The output of the answer by Mixtral-8x7B is mixed in with Monte Cervin, which is not a mountain in French, so I’ll look into it. if you take a look at Google, you will see Monte Cervin, located in Switzerland</p><p id="bedc">To summarize the results of this verification, we found that Mixtral-8x7B certainly outputs a little better answers than Llama2 70B, and has a performance that can be said to be equivalent to GPT-3.5.</p><p id="7a3c">This model has the highest performance among the open-source models currently available.</p> <figure id="dfc4"> <div> <div> <img class="ratio" src="http://placehold.it/16x9"> <iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAnxBfq1XY7I%3Fstart%3D338&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAnxBfq1XY7I&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FAnxBfq1XY7I%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" allowfullscreen="" frameborder="0" height="480" width="854"> </div> </div> </figure></iframe></div></div></figure><h1 id="6514">Summary:</h1><p id="30a0">Mixtral 8x7B signifies a leap forward in the AI landscape, offering not just cutting-edge performance but a commitment to openness, innovation, and community-driven development. As Mistral AI continues its mission, Mixtral sets a new benchmark for the collaborative evolution of artificial intelligence.</p><p id="3f44"><b>This article was originally published on</b>: <a href="https://quickaitutorial.com/"><b>Page</b></a></p><blockquote id="04a9"><p><b><i>🧙‍♂️</i> I amAI application experts! If you want to collaborate on a project,<i> </i>drop an <a href="https://docs.google.com/forms/d/e/1FAIpQLSelxGSNOdTXULOG0HbhM21lIW_mTgq7NsDbUTbx4qw-xLEkMQ/viewform">inquiry here<i></i></a><i> </i>or Book a <a href="https://calendly.com/gao-dalie/ai-consulting-call">1-On-1 Consulting</a> Call With M.</b></p></blockquote><p id="fde9"><i>📚Feel free to check out my other articles:</i></p><div id="b63d" class="link-block"> <a href="https://quickaitutorial.com/gpt-4-vs-zephyr-7b-beta-which-one-should-you-use/"> <div> <div> <h2>GPT-4 Vs Zephyr 7b Beta: Which One Should You Use? 2023</h2> <div><h3>"zephyr 7b beta" is a fine-tuned version of the mode"Mistral" developed by the Hugging Face H4 team that performs…</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*Yxe_U4vsBjO7A1Kf)"></div> </div> </div> </a> </div><div id="1551" class="link-block"> <a href="https://quickaitutorial.com/why-openchat-model-is-so-much-better-than-chatgpt/"> <div> <div> <h2>Why OpenChat Model Is So Much Better Than ChatGPT? 2023</h2> <div><h3>OpenChat Model is a novel framework for advancing open-source language models with mixed-quality data. It leverages…</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*jQSgsEnu4gehaoB4)"></div> </div> </div> </a> </div><div id="6f57" class="link-block"> <a href="https://quickaitutorial.com/openhermes-2-5-vs-gpt-4-vs-llama2-the-winner/"> <div> <div> <h2>OpenHermes 2.5 Vs GPT-4 Vs LLama2 = The Winner 2023</h2> <div><h3>OpenHermes 2.5 is a state-of-the-art (SOTA) fine-tuned version of Mistral 7B. It was trained on 1,000,000 entries of…</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*XEImjRRzTQdZ3M0-)"></div> </div> </div> </a> </div></article></body>

Mixtral-8x7B + GPT-3 + LLAMA2 70B = The Winner

While everyone’s focused on the release of Google Gemini quietly in the background Mixtral-8 x 7 Billion releases their open-source model.

So, In this Article, we’re diving into some of the latest AI developments from major players like llama2 70 Billion, GPT-3, and Mixtral-8 x 7 Billion.

Mixtral-8 x 7 Billion outperforms the Llama 2 70B model in most benchmarks while delivering six times faster inference. Plus, it’s an open-weight model released with an Apache 2.0 license, meaning anyone can access and use it for their projects.

In this step-by-step guide, we will cover what Mixtral-8x7B is, what is a sparse mixture of experts, how to use Mixtral-8x7B and Why Mixtral-8x7B is so much better than GPT-3 and Llama2 70 Billion

My homepage is like my personal lab for playing around with large language models — and yeah, it’s as fun as it sounds! , it’s the new Mixtral-8x7B model that truly excites me.

I highly recommend you read this article to the end is a game changer in your chatbot that will realize the power of OpenHermes 2.5!

Before we start! 🦸🏻‍♀️

If you like this topic and you want to support me:

  1. Clap my article 50 times; that will really help me out.👏
  2. Follow me on Medium and subscribe to get my latest article🫶
  3. What content do you want to see me sharing? get started

WHAT IS Mixtral-8x7B?

Mixtral-8x7B

Mixtral 8x7b, the latest language model developed by Mistral AI, is making waves in the field of artificial intelligence. This groundbreaking model boasts incredible capabilities and a unique architecture that sets it apart from its predecessors.

Unlike traditional language models, Mixtral 8x7b utilizes a sparse Mixture of Expert (MoE) layer instead of feed-forward layers

WHAT IS A SPARSE MIXTURE OF EXPERT?

MIXTURE OF EXPERT

MoE (Mixtures of Experts) is an approach that combines multiple neural networks. Create efficient models by preparing multiple networks specialized for specific tasks or domains and learning and inferring while switching between them.

In MoE, the model consists of two subnetworks: a gating network and multiple expert networks. The gate part determines which expert is selected for the input, and only the selected expert is responsible for the output.

This provides two benefits: improved performance and reduced learning/inference time. Regarding performance improvement, each expert can be optimized for different tasks, making it possible to handle a wider range of tasks.

FEATURE OF MIXTRAL — 8 x 7 B

Context Handling: Mixtral adeptly manages a context of 32k tokens, offering a robust foundation for diverse applications.

Multilingual Support: With capabilities spanning English, French, Italian, German, and Spanish, Mixtral ensures broad accessibility and usability.

Code Generation Prowess: Exhibiting robust performance in code generation tasks, Mixtral is poised to enhance various programming-related applications.

Fine-Tuning Excellence: Mixtral can be fine-tuned into an instruction-following model, achieving an impressive score of 8.3 on MT-Bench, showcasing its adaptability and versatility.

BENCHMARKS RESULTS :

Built using this groundbreaking method, Mixtral-8x7B is much faster than larger models (Llama2 70B, GPT-3.5) and uses fewer resources to deliver the same or better performance. It has come true.

This is the result of the benchmark, but you may be wondering what the actual performance is.

From here, we will use it to compare and verify the performance of Mixtral-8x7B.

First, I will explain how to use it.

HOW TO USE MIXTRAL_8 x 7B

If you want to simply use the instruction-tuned version via a chat interface, you can use the Perplexity Labs playground. Just choose it from the model selection dropdown in the bottom right corner.

let’s try Mixtral 8 x 7 B Ask them to introduce themselves by completing the prompts below.

Introduce yourself

Now that we know that it can be used, we will compare it with Llama2 70B and GPT-3.5, which were also compared in the benchmark and verify the difference in output.

let’s compare Mixtral 8 x 7 Billion AND LLAMA2 70B and GPT-3

Verify that you can output working code by running the prompt below.

write bubble sort in python

Mixtral 8 x 7 Billion

python
def bubble_sort(arr):
    n = len(arr)

    for i in range(n):
        # Create a flag that will allow the function to terminate early if there's nothing left to sort
        swapped = False

        for j in range(0, n-i-1):
            # If the element found is greater than the next element swap them
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
                swapped = True

        # If no two elements were swapped by inner loop, then the array is already sorted.
        if not swapped:
            break

Llama2 70 Billion

def bubble_sort(arr):
    n = len(arr)
    for i in range(n-1):
        for j in range(0, n-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

GPT-3.5

def bubble_sort(arr):
    n = len(arr)
    
    # Traverse through all array elements
    for i in range(n):
        # Flag to indicate whether any swaps were made in this pass
        swapped = False
        
        # Last i elements are already in place, so we don't need to compare them again
        for j in range(0, n-i-1):
            # Swap if the element found is greater than the next element
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]  # Swap elements
                swapped = True
        
        # If no two elements were swapped in this pass, the array is already sorted
        if not swapped:
            break

# Example usage:
arr = [64, 34, 25, 12, 22, 11, 90]
bubble_sort(arr)
print("Sorted array is:", arr)

As a result, the Mixtral-8x7B and GPT-3.5 output codes work correctly, but only Llama2 70B works as is. It outputs a code that does not exist.

Llama2 70B’s version has obvious elementary mistakes, such as libraries not being imported.

From this result, it can be seen that Mixtral-8x7B has a higher performance than Llama2 70B and is equivalent to GPT-3.5.

Knowledge

Enter the following prompt and verify that it outputs the correct information.

Give me a list of the highest mountain elevations in France, ranking the top 5

Mixtral-8x7B

Mont Blanc - 4,810 meters (15,781 feet)
Monte Cervin (Matterhorn) - 4,478 meters (14,692 feet)
Mont Rosa - 4,634 meters (15,203 feet)
Pic du Midi d'Ossau - 2,884 meters (9,462 feet)
Aiguille Verte - 4,122 meters (13,524 feet)

Llama2 70 Billion

Sure, here are the top 5 highest mountain elevations in France, 
ranked in order:
Mont Blanc - 4,810 meters (15,781 feet)
Mont Blanc du Tacul - 4,248 meters (13,934 feet)
Mont Maudit - 4,465 meters (14,649 feet)
Dôme du Goûter - 4,304 meters (14,120 feet)
Aiguille du Midi - 3,842 meters (12,606 feet)

GPT-3.5

1- Mont Blanc: Mont Blanc, located in the French Alps on the border between France and Italy, is the highest mountain in France and Western Europe. Its elevation is approximately 4,810 meters (15,781 feet).

2- Dôme du Goûter: Dôme du Goûter is another prominent peak in the Mont Blanc massif. It has an elevation of about 4,304 meters (14,118 feet).

3- Barre des Écrins: Barre des Écrins is the highest peak in the Ecrins National Park in the French Alps. It stands at an elevation of approximately 4,102 meters (13,458 feet).

4- Mont Collon: Mont Collon is part of the Pennine Alps and is located near the border between France and Switzerland. Its elevation is approximately 4,363 meters (14,314 feet).

5- La Meije: La Meije is also located in the Ecrins National Park and is known for its challenging climbing routes. It has an elevation of about 3,984 meters (13,071 feet).

The output of the answer by Mixtral-8x7B is mixed in with Monte Cervin, which is not a mountain in French, so I’ll look into it. if you take a look at Google, you will see Monte Cervin, located in Switzerland

To summarize the results of this verification, we found that Mixtral-8x7B certainly outputs a little better answers than Llama2 70B, and has a performance that can be said to be equivalent to GPT-3.5.

This model has the highest performance among the open-source models currently available.

Summary:

Mixtral 8x7B signifies a leap forward in the AI landscape, offering not just cutting-edge performance but a commitment to openness, innovation, and community-driven development. As Mistral AI continues its mission, Mixtral sets a new benchmark for the collaborative evolution of artificial intelligence.

This article was originally published on: Page

🧙‍♂️ I amAI application experts! If you want to collaborate on a project, drop an inquiry here or Book a 1-On-1 Consulting Call With M.

📚Feel free to check out my other articles:

Llm
Artificial Intelligence
Machine Learning
Data Science
Technology
Recommended from ReadMedium