avatarGao Dalie (高達烈)

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

9037

Abstract

lls <span class="hljs-keyword">are</span> <span class="hljs-keyword">not</span> considered <span class="hljs-keyword">to</span> be arranged non<span class="hljs-operator">-</span>adjacently.

However, even if <span class="hljs-keyword">condition</span> <span class="hljs-number">1</span> <span class="hljs-keyword">is</span> satisfied, if <span class="hljs-keyword">condition</span> <span class="hljs-number">2</span> <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> met, the red balls <span class="hljs-keyword">are</span> <span class="hljs-keyword">not</span> considered <span class="hljs-keyword">to</span> be non<span class="hljs-operator">-</span>adjacent.

<span class="hljs-keyword">In</span> other cases, it <span class="hljs-keyword">is</span> possible <span class="hljs-keyword">to</span> determine whether <span class="hljs-keyword">only</span> <span class="hljs-keyword">one</span> white ball <span class="hljs-keyword">is</span> included, regardless <span class="hljs-keyword">of</span> the number <span class="hljs-keyword">of</span> black balls.

The probability <span class="hljs-string">'p'</span> <span class="hljs-keyword">is</span> limited <span class="hljs-keyword">to</span> cases <span class="hljs-keyword">where</span> <span class="hljs-keyword">condition</span> <span class="hljs-number">1</span> <span class="hljs-keyword">is</span> satisfied but there <span class="hljs-keyword">is</span> a possibility that two red balls <span class="hljs-keyword">are</span> adjacent. <span class="hljs-keyword">In</span> this <span class="hljs-keyword">case</span>, d<span class="hljs-string">'p'</span> <span class="hljs-keyword">is</span> <span class="hljs-number">1</span><span class="hljs-operator">/</span><span class="hljs-number">4</span> regardless <span class="hljs-keyword">of</span> the arrangement <span class="hljs-keyword">of</span> the red balls.

<span class="hljs-keyword">In</span> other cases, <span class="hljs-string">'p'</span> <span class="hljs-keyword">is</span> calculated according <span class="hljs-keyword">to</span> the arrangement <span class="hljs-keyword">of</span> the red balls</pre></div><p id="8820">Mistral 7b</p><div id="0423"><pre>This problem <span class="hljs-built_in">is</span> one <span class="hljs-keyword">of</span> combination. Red balls can be drawn <span class="hljs-keyword">as</span> sets <span class="hljs-keyword">of</span> <span class="hljs-number">3</span> red balls, <span class="hljs-number">5</span> red balls, <span class="hljs-built_in">and</span> <span class="hljs-number">2</span> red balls. The probability <span class="hljs-keyword">of</span> <span class="hljs-keyword">each</span> combination <span class="hljs-built_in">is</span> obtained <span class="hljs-keyword">by</span> dividing <span class="hljs-keyword">by</span> the number <span class="hljs-keyword">of</span> ways the red balls can be drawn.

The number <span class="hljs-keyword">of</span> ways <span class="hljs-keyword">to</span> draw red balls changes depending <span class="hljs-keyword">on</span> the <span class="hljs-keyword">order</span> <span class="hljs-keyword">in</span> which the red balls are drawn. Regarding the <span class="hljs-keyword">order</span> <span class="hljs-keyword">of</span> drawing, there are combinations <span class="hljs-keyword">of</span> <span class="hljs-number">3</span> red balls, <span class="hljs-number">5</span> red balls, <span class="hljs-built_in">and</span> <span class="hljs-number">2</span> red balls.

The number <span class="hljs-keyword">of</span> combinations related <span class="hljs-keyword">to</span> the <span class="hljs-keyword">order</span> <span class="hljs-keyword">of</span> drawing red balls <span class="hljs-built_in">is</span> obtained <span class="hljs-keyword">by</span> dividing <span class="hljs-keyword">by</span> the number <span class="hljs-keyword">of</span> possible orders <span class="hljs-keyword">in</span> which the red balls can be drawn</pre></div><p id="b06c">llama2–7b</p><div id="3d39"><pre>The probability <span class="hljs-string">'p'</span> <span class="hljs-keyword">is</span> the sum of the probability of a red ball being drawn <span class="hljs-keyword">from</span> the bag <span class="hljs-keyword">and</span> the probability of a white ball being drawn <span class="hljs-keyword">from</span> the bag. The probability of drawing a red ball <span class="hljs-keyword">from</span> the bag <span class="hljs-keyword">is</span> <span class="hljs-number">1</span> <span class="hljs-keyword">out</span> of <span class="hljs-number">4.</span> The probability of drawing a white ball <span class="hljs-keyword">from</span> the bag <span class="hljs-keyword">is</span> <span class="hljs-number">1</span> <span class="hljs-keyword">out</span> of <span class="hljs-number">5.</span> Therefore, the sum of both probabilities <span class="hljs-keyword">is</span>:

<span class="hljs-number">4</span>/<span class="hljs-number">12</span> + <span class="hljs-number">5</span>/<span class="hljs-number">12</span> = <span class="hljs-number">9</span>/<span class="hljs-number">12.</span>

Hence, p = <span class="hljs-number">9</span>/<span class="hljs-number">12.</span></pre></div><p id="ee71">All models gave incorrect results.</p><p id="31dd">The correct answer is 14/55.</p><p id="cce0"><b>LLaMA-Pro-8B</b> was incorrect, but I am trying to derive the answer most logically, so I am evolving in that respect. You can say that.</p><p id="2d6c"><b>・Coding</b></p><p id="4e82">Please input the following prompt to confirm it generates functional code</p><div id="a095"><pre><span class="hljs-built_in">write</span> the Sieve of Eratosthenes <span class="hljs-keyword">in</span> python</pre></div><p id="3a57">The Sieve of Eratosthenes is a simple algorithm for finding all prime numbers less than or equal to a specified integer, and we will check if it can be coded.</p><p id="f9b5">LLama2 Pro 8b</p><div id="2d46"><pre>def eratosthenes_sieve(n):

<span class="hljs-keyword">First</span>, <span class="hljs-keyword">add</span> numbers <span class="hljs-keyword">from</span> <span class="hljs-number">1</span> <span class="hljs-keyword">to</span> n <span class="hljs-keyword">to</span> a list

primes <span class="hljs-operator">=</span> [<span class="hljs-literal">True</span>] <span class="hljs-operator">*</span> (n<span class="hljs-operator">+</span><span class="hljs-number">1</span>) primes[<span class="hljs-number">0</span>] <span class="hljs-operator">=</span> primes[<span class="hljs-number">1</span>] <span class="hljs-operator">=</span> <span class="hljs-literal">False</span>

<span class="hljs-keyword">Search</span> <span class="hljs-keyword">for</span> <span class="hljs-keyword">values</span> <span class="hljs-keyword">from</span> <span class="hljs-number">2</span> <span class="hljs-keyword">to</span> n <span class="hljs-keyword">and</span> change them <span class="hljs-keyword">to</span> <span class="hljs-literal">False</span>

<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-keyword">range</span>(<span class="hljs-number">2</span>, <span class="hljs-type">int</span>(n<span class="hljs-operator"></span><span class="hljs-operator"></span><span class="hljs-number">0.5</span>) <span class="hljs-operator">+</span> <span class="hljs-number">1</span>): if primes[i]: <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> <span class="hljs-keyword">range</span>(i<span class="hljs-operator">*</span>i, n <span class="hljs-operator">+</span> <span class="hljs-number">1</span>, i): primes[j] <span class="hljs-operator">=</span> <span class="hljs-literal">False</span>

The remaining <span class="hljs-keyword">values</span> <span class="hljs-keyword">are</span> <span class="hljs-keyword">all</span> even, <span class="hljs-keyword">as</span> <span class="hljs-keyword">all</span> their <span class="hljs-keyword">values</span> <span class="hljs-keyword">are</span> <span class="hljs-literal">False</span>

<span class="hljs-keyword">return</span> [i <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-keyword">range</span>(<span class="hljs-number">2</span>, n) if primes[i]] primes <span class="hljs-operator">=</span> eratosthenes_sieve(<span class="hljs-number">1000000</span>) print(primes[<span class="hljs-number">1</span>::<span class="hljs-number">2</span>])</pre></div><p id="7853">Mistral 7b</p><div id="c66a"><pre>```python <span class="hljs-keyword">def</span> <span class="hljs-title function_">eratosthenes</span>(<span class="hljs-params">n</span>): primes = [<span class="hljs-literal">True</span>] * (n+<span class="hljs-number">1</span>) primes[<span class="hljs-number">0</span>] = primes[<span class="hljs-number">1</span>] = <span class="hljs-literal">False</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hlj

Options

s-built_in">range</span>(<span class="hljs-number">2</span>, <span class="hljs-built_in">int</span>(n**<span class="hljs-number">0.5</span>)+<span class="hljs-number">1</span>): <span class="hljs-keyword">if</span> primes[i]: <span class="hljs-keyword">for</span> j <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(i*i, n+<span class="hljs-number">1</span>, i): primes[j] = <span class="hljs-literal">False</span> <span class="hljs-keyword">return</span> [i <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">if</span> primes[i]]</pre></div><p id="50dc">llama2–7b</p><div id="065d"><pre>``` <span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np <span class="hljs-keyword">def</span> <span class="hljs-title function_">eratosphere</span>(<span class="hljs-params">cube</span>): <span class="hljs-comment"># cube: 3x3x3 numpy array</span> <span class="hljs-comment"># Each element is a integer between 0 and 2, representing the color of the cube</span> <span class="hljs-comment"># white, red, white, red, ...</span> <span class="hljs-comment"># Step 1: White cross</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, :] = <span class="hljs-number">0</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, :] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, :] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, :] = <span class="hljs-number">0</span> <span class="hljs-comment"># Step 2: White corners</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">0</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">0</span> <span class="hljs-comment"># Step 3: Red cross</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, :] = <span class="hljs-number">2</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, :] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, :] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, :] = <span class="hljs-number">2</span> <span class="hljs-comment"># Step 4: Red corners</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>] = <span class="hljs-number">2</span> cube[<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, <span class="hljs-number">2</span>] = <span class="hljs-number">2</span> <span class="hljs-keyword">return</span> cube <span class="hljs-comment"># Example usage</span> cube = np.array([ [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>], [<span class="hljs-number">0</span>, <span class="hljs-number">2</span>, <span class="hljs-number">0</span>], [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>] ]) cube = eratosphere(cube) <span class="hljs-built_in">print</span>(cube)</pre></div><p id="2ee1">Among the tested models, only LLaMA-Pro-8B successfully generated code that accurately implements the Sieve of Eratosthenes.</p><p id="b36a">In contrast, both Llama2 7B and Mistral 7B produced code that was not functional in its original form. This test highlights LLaMA-Pro-8B’s superior capabilities in both mathematical understanding and coding proficiency</p><h1 id="49d2">Conclusion :</h1><p id="e997">In this comparison, Llama2 7B distinctly outperforms LLaMA-Pro-8B, delivering superior responses. The verification process reveals that although LLaMA-Pro-8B demonstrates a marked enhancement in mathematical knowledge and coding skills compared to its counterparts of similar size even <b>the questions I got wrong were answered correctly.</b></p><p id="ce49">However, there were no major changes in other areas, and the results showed that the base Llama2 7B was superior.</p><h2 id="d6d7">Reference :</h2><ul><li>[Link Used] GITHUB: <a href="https://github.com/TencentARC/LLaMA-Pro">https://github.com/TencentARC/LLaMA-Pro</a></li><li>Paper: <a href="https://arxiv.org/abs/2401.02415">https://arxiv.org/abs/2401.02415</a> blog:</li><li><a href="https://huggingface.co/TencentARC/LLaMA-Pro-8B">https://huggingface.co/TencentARC/LLaMA-Pro-8B</a></li></ul><blockquote id="6d9a"><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><div id="3e1e" class="link-block"> <a href="https://quickaitutorial.com/langgraph-create-your-hyper-ai-agent/"> <div> <div> <h2>LangGraph : Create Your Hyper AI Agent 2024</h2> <div><h3>LangGraph builds upon LangChain and simplifies the process of creating and managing agents and their runtimes.</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*GVIrvsE_1m_LRrIh)"></div> </div> </div> </a> </div><div id="b1df" class="link-block"> <a href="https://quickaitutorial.com/crewai-solor-hermes-langchain-ollama-super-ai-agent/"> <div> <div> <h2>CrewAi + Solor/Hermes + Langchain + Ollama = Super Ai Agent 2024</h2> <div><h3>CrewAI is a cutting-edge framework designed for orchestrating role-playing, autonomous AI agents, allowing these agents…</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*tPJCEBcCoo-FOJiE)"></div> </div> </div> </a> </div><div id="de4a" class="link-block"> <a href="https://quickaitutorial.com/llmlingua-llamaindex-rag-cheaper-chatbot/"> <div> <div> <h2>Llmlingua + LlamaIndex + RAG = Cheaper Chatbot 2024</h2> <div><h3>LLMLingua reduces cost, decreases API response latency and accelerates model inference through prompt compression…</h3></div> <div><p>quickaitutorial.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*85BqDf5Nl1t1v8Ci)"></div> </div> </div> </a> </div></article></body>

Why LLama2 Pro 8B Is So Much Better Than LLama2 8b And Mistral 7B — Here is The Result

the AI news in the past 7 days has been insane, with so much happening in the world of AI

Last week, Tencent’s ARC Lab announced the release of their llama2 pro training of parameters. It’s an expansion of LLaMA2–7B, further trained on code and math corpora totaling 80 billion tokens.

In this step-by-step guide, we will cover what llama2 pro 8 billion is, how to install llama2 pro 8 billion locally, and why llama2 pro 8 billion is so much better than Llama2 7B and Mistral 7B

I highly recommend you watch this video to the end is a game changer in your chatbot that will realize the power of llama2 pro 8 billion!

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. Buy me a Coffee to create more high-quality content 🙏

What is llama2 pro 8 billion?

LLaMA-Pro is a progressive version of the original LLaMA model, enhanced by the addition of Transformer blocks. It specializes in integrating both general language understanding and domain-specific knowledge, particularly in programming and mathematics.

Key Feature :

  • The ability to efficiently and effectively improve its knowledge without catastrophic forgetting.
  • the versatility to address diverse problems and quickly adapt to new tasks.
  • The state-of-the-art performance across a broad range of general, code, and math tasks, as well as its capabilities as a language agent across various scenarios.

Performance

LLaMA-Pro demonstrates advanced performance across various benchmarks. It outperforms existing models in the LLaMA series in handling diverse tasks, showcasing its capability as an intelligent language agent.

Overall Performance on Languages, math and code tasks

In this way, compared to Llama2–7B and CodeLlama-7B, scores have improved in most benchmarks.

In particular, the scores of the mathematics benchmark GSM8K and programming benchmark HumanEval have significantly improved. You can see that

It also has a high score compared to other similar models.

From here, we will use LLaMA-Pro-8B to compare Llama2–7B and Mistral 7B.

How to use LLaMA-Pro-8B

LLaMA-Pro-8B can be used using the online demo at the link below or locally installed.

https://huggingface.co/spaces/TencentARC/LLaMA-Pro-8B-Instruct-Chat

The recent release of LLaMA-Pro-8B, an 8B model, has garnered substantial interest, resulting in slower response times due to high access volumes. To address this, we recommend its implementation on Google Colab Pro, which offers A100 GPUs with high memory capabilities.

Notably, a quantized version of this model, significantly lighter in weight, has also been made available. This version is more suitable for typical home computing environments and can run smoothly on standard PCs, making it a recommended choice for most users

https://huggingface.co/TheBloke/LLaMA-Pro-8B-Instruct-GGUF

We will explain how to install and use Colab or locally.

First, clone the GitHub repository using the following command.

!git clone https://github.com/TencentARC/LLaMA-Pro.git

Change to the demo directory.

cd LLaMA-Pro/demo

Now, install the required packages.

!pip install -r requirements.txt

Once this is complete, run app.py.

!python app.py

The model will then start loading, and once completed, the gradio webUI will start.

Now let’s try it out

Enter the prompts below.

What is Databricks

as you see the result is quite good and straight to the point

Databricks is a software-based platform for data processing using Apache Spark.
It leverages open-source technologies like Spark Streaming and Hadoop to 
efficiently process large datasets. Additionally, it supports many languages 
including Python, R, Java, and JavaScript, allowing users to execute data 
processing in almost any language of their choice.

llama2 Pro 8B VS Llama2–7B Vs Mistral 7B.

let’s compare LLama2 Pro 8b, llama2–7b and Mistral 7b and verify how much performance LLama2 Pro 8b has.

This time, we will verify the following items.

  • Calculus

Please input the following prompt

In a bag, there are 3 black balls, 4 red balls, and 5 white balls.
Balls are drawn one at a time and placed in a row side by side until 12 
balls are lined up. It is assumed that each ball has an equal probability 
of being drawn.

(1) Find the probability p that no two red balls are adjacent to each other

LLama2 Pro 8b

To solve this problem, there are two necessary conditions:

If there are multiple black balls, one of them must contain a single white
 ball.
Red balls must be arranged so that they are not adjacent to each other.
If condition 1 is met, it is possible to determine whether only one white 
ball is included, regardless of the number of black balls included. 
If condition 2 is not met, the red balls are not considered to be arranged 
non-adjacently.

However, even if condition 1 is satisfied, if condition 2 is not met, 
the red balls are not considered to be non-adjacent.

In other cases, it is possible to determine whether only one white ball is 
included, regardless of the number of black balls.

The probability 'p' is limited to cases where condition 1 is satisfied but 
there is a possibility that two red balls are adjacent. In this case, 
d'p' is 1/4 regardless of the arrangement of the red balls.

In other cases, 'p' is calculated according to the arrangement of the red 
balls

Mistral 7b

This problem is one of combination. Red balls can be drawn as sets of 3 
red balls, 5 red balls, and 2 red balls. The probability of each combination 
is obtained by dividing by the number of ways the red balls can be drawn.

The number of ways to draw red balls changes depending on the order in which
 the red balls are drawn. Regarding the order of drawing, there are 
combinations of 3 red balls, 5 red balls, and 2 red balls.

The number of combinations related to the order of drawing red balls is
 obtained by dividing by the number of possible orders in which the red balls 
can be drawn

llama2–7b

The probability 'p' is the sum of the probability of a red ball being drawn 
from the bag and the probability of a white ball being drawn from the bag. 
The probability of drawing a red ball from the bag is 1 out of 4.
 The probability of drawing a white ball from the bag is 1 out of 5.
 Therefore, the sum of both probabilities is:

4/12 + 5/12 = 9/12.

Hence, p = 9/12.

All models gave incorrect results.

The correct answer is 14/55.

LLaMA-Pro-8B was incorrect, but I am trying to derive the answer most logically, so I am evolving in that respect. You can say that.

・Coding

Please input the following prompt to confirm it generates functional code

write the Sieve of Eratosthenes in python

The Sieve of Eratosthenes is a simple algorithm for finding all prime numbers less than or equal to a specified integer, and we will check if it can be coded.

LLama2 Pro 8b

def eratosthenes_sieve(n):
   # First, add numbers from 1 to n to a list
   primes = [True] * (n+1)
   primes[0] = primes[1] = False

   # Search for values from 2 to n and change them to False
   for i in range(2, int(n**0.5) + 1):
       if primes[i]:
           for j in range(i*i, n + 1, i):
               primes[j] = False

   # The remaining values are all even, as all their values are False
   return [i for i in range(2, n) if primes[i]]
primes = eratosthenes_sieve(1000000)
print(primes[1::2])

Mistral 7b

```python
def eratosthenes(n):
primes = [True] * (n+1)
primes[0] = primes[1] = False
for i in range(2, int(n**0.5)+1):
if primes[i]:
for j in range(i*i, n+1, i):
primes[j] = False
return [i for i in range(n+1) if primes[i]]

llama2–7b

```
import numpy as np
def eratosphere(cube):
# cube: 3x3x3 numpy array
# Each element is a integer between 0 and 2, representing the color of the cube
# white, red, white, red, ...
# Step 1: White cross
cube[1, 1, :] = 0
cube[1, 2, :] = 0
cube[2, 1, :] = 0
cube[2, 2, :] = 0
# Step 2: White corners
cube[1, 1, 1] = 0
cube[1, 1, 2] = 0
cube[1, 2, 1] = 0
cube[1, 2, 2] = 0
cube[2, 1, 1] = 0
cube[2, 1, 2] = 0
cube[2, 2, 1] = 0
cube[2, 2, 2] = 0
# Step 3: Red cross
cube[1, 1, :] = 2
cube[1, 2, :] = 2
cube[2, 1, :] = 2
cube[2, 2, :] = 2
# Step 4: Red corners
cube[1, 1, 1] = 2
cube[1, 1, 2] = 2
cube[1, 2, 1] = 2
cube[1, 2, 2] = 2
cube[2, 1, 1] = 2
cube[2, 1, 2] = 2
cube[2, 2, 1] = 2
cube[2, 2, 2] = 2
return cube
# Example usage
cube = np.array([
[0, 0, 0],
[0, 2, 0],
[0, 0, 0]
])
cube = eratosphere(cube)
print(cube)

Among the tested models, only LLaMA-Pro-8B successfully generated code that accurately implements the Sieve of Eratosthenes.

In contrast, both Llama2 7B and Mistral 7B produced code that was not functional in its original form. This test highlights LLaMA-Pro-8B’s superior capabilities in both mathematical understanding and coding proficiency

Conclusion :

In this comparison, Llama2 7B distinctly outperforms LLaMA-Pro-8B, delivering superior responses. The verification process reveals that although LLaMA-Pro-8B demonstrates a marked enhancement in mathematical knowledge and coding skills compared to its counterparts of similar size even the questions I got wrong were answered correctly.

However, there were no major changes in other areas, and the results showed that the base Llama2 7B was superior.

Reference :

🧙‍♂️ 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.

Artificial Intelligence
Data Science
Machine Learning
Technology
Programming
Recommended from ReadMedium