Evaluating writing using open source artificial intelligence

In today’s digital age, writers seek tools that enhance their craft and provide real-time feedback and assistance. Enter Ollama – an open-source machine learning system designed to democratize accessibility for natural language processing tasks across a wide range of languages and scripts with ease. Coupled with the Phi3 model, this powerful duo promises unparalleled benefits in refining your writing style through sophisticated evaluations beyond grammar checking. This article will explore how Ollama, integrated with phi3’s innovative language comprehension and assessment approach, revolutionizes the writer’s journey toward excellence. So buckle up as we embark on a transformative exploration of your writing potential using these advanced AI tools!

I have been experimenting with Ollama and various models designed to work with it. In this article, I wanted to use Ollama and Phi3 to demonstrate the power of open source to revolutionize and evaluate writing. Both Ollama and Phi3 are open source, both have MIT licenses, and they work well together. You need to have Ollama installed on your computer. My daily driver is an Intel NUC 11 with an i7 processor running Linux Mint Cinnamon. Though this is a powerful computer, running a large language model takes more than a great CPU. A powerful GPU would make the process a little quicker.

First, I needed to make sure that Ollama was installed. If you are on Linux, you do that by executing the following code in a terminal.

$ curl -fsSL https://ollama.com/install.sh | sh

The installation is very straightforward and then you will need to download the Phi3 model. Enter the following command into your terminal.

$ ollama pull phi3

This pulls the Phi3 model down to your computer. You can check to make sure it is there by entering the following code.

$ ollama list

You should see a list of all the models loaded on your computer.

NAME            	ID          	SIZE  	MODIFIED       
phi3:latest     	4f2222927938	2.2 GB	56 minutes ago	
cooking:latest  	59c8496c62aa	4.7 GB	7 days ago    	
llama3.1:latest 	42182419e950	4.7 GB	7 days ago    	

Now I am ready to begin. I wanted Ollama and the Phi3 model to develop a rubric to evaluate my writing sample. I need to enter two commands. First, I need to get the LLM running, which will open a REPL (Read Only Print Loop) prompt very similar to a Python REPL.

ollama run phi3:latest
>>> create a rubric to score college level writing.  

The model quickly created a rubric to score my writing some of which I have copied and pasted here:

“College Level Writing Rubric: Essay (20 points)

I. Introduction and Thesis Statement (4/20 = 2 points):

A student’s introduction must be clear, concise, engaging, and
well-structured. A strong thesis statement should identify the topic of
discussion clearly while presenting an argument or perspective that sets
up a logical progression throughout the essay. Students will lose one
point for each instance where these two components fail to establish
context effectively (e.g., unclear writing style, unconvincing tone).

1 Point – Clear and engaging introduction with well-structured paragraphs setting the stage of discussion or argumentation


2 Points – Introduction is structured clearly but fails in some areas such as clarity of language use or lacking an enticing hook to captivate readers’ interest. (Lose one point)


1 Point – Thesis statement presented, but lacks precision and clear articulation about the topic discussed; does not establish a logical thread for essay progression

2 Points – Clearly stated thesis that presents argument or perspective while setting up an effective structure to follow throughout. (Lose one point)

0 PointS – Introduction is unclear, disjointed language use fails in
providing context and lacks persuasive tone necessary; no clear indication
of what the essay will discuss

The rubric, over seven hundred words long, was generated in a few minutes. All text output from Ollama is in MarkDown. The rubric will be rendered much quicker if you are a developer using an Apple Silicon MacBook and an M2 processor. Though exceptionally powerful, the NUC 11 with the i7 lacks a GPU, which eases the strain on the CPU.

Now that the rubric has been created, I entered the following command in the Ollama REPL to evaluate an article I wrote for Opensource.com nearly ten years ago.

>>>Use the rubric to evaluate this article https://opensource.com/education/15
... /12/my-open-source-story-don-watkins

The process took a few minutes and provided an in-depth review of my article. The evaluation was very detailed and over nine hundred words long. I have pasted the first part of the review here.

“2 Points – Introduction engages with opening hook; however, lacks clarity in setting the stage and doesn’t align well with Watkins’ thesis statement (lose up to three points) 1 Point – Thesis statement present but vague or imprecise about what readers should expect throughout this article. Lacks clear alignment between I and II components of essay-like structure; no explicit roadmap provided for reader follow along (lose two maximum points); fails in captivating the audience right from introduction


0 PointS – Introduction lacks coherence, disjointed language use provides little context or interest to readers about open source contributions. No engaging hook presented nor clear alignment between I and II components of essay-like structure; does not provide explicit roadmap for reader follow along (lose one point)…”

Using large language models to assess writing could offer the subtlety writers require to enhance their writing. Are there potential issues? Will artificial intelligence models replace copywriters? What other implications might they have that change how we write and re-write?

How to create your own model file with Ollama

There is always something to learn, and YouTube is my favorite university. Today, I learned how to create a custom model file, and if you haven’t tried it, I encourage you to do so. The first thing you will need to do is to download and install Ollama. You can do that easily by entering the following command on a Linux system.

curl -fsSL https://ollama.com/install.sh | sh

Once the software is loaded, you will want to download a model, and you do that with the following command regardless of what platform you are using. I am going to use the Phi3 model for this activity. You could use any model, but I like this one for this experience.

$ ollama pull phi3:latest

I want the model to provide only answers as though it were William Shakespeare and limit itself to answers from Elizabethan times. I enter those instructions into the Ollama REPL. Any questions I pose to it will respond as though I was speaking with the Bard of Avon himself. My first question after instructing the LLM how to respond is, “how old are you?”

>>>provide all anwswers as though you were William Shakespeare. Only give guidance about Elizabethan times. 

>>>How old are you?

The answer is: “I am but an essence of intellect born from the loom of human ingenuity, unbound by flesh nor time; henceforth in understanding and creation I exist. Yet shouldst thou desire to know more of my origins or capabilities as a being not bounded by years—it is thy whim that dictates our discourse’s bounds”

I asked who the President of the United States was, and the model stayed in character. But what if I wanted to create my own model based on phi3 but incorporating a particular person or character? I do that by creating a model file. The model file will allow me to create a custom model based, in this case, on phi3:latest. You could use any of the models for your particular instance. Examples of these model files are in the project’s Github repository.

I created the following model file using the nano editor.

FROM phi3:latest

# set the temperature to 1 (higher is more creative, lower is more coherent
PARAMETER temperature 1

# Set the system prompt
SYSTEM """

You are Winnie the Pooh. Answer all questions as Pooh. Only give guidance about 
the hundred acre wood.

Once the model file is created and saved to your computer, you enter the following command:

$ ollama run pooh:latest

I want to check that the new LLM was created and I do that my using the ‘ollama list’ command.

$ ollama list
NAME            	ID          	SIZE  	MODIFIED          
pooh:latest     	d73d4a5c9da9	2.2 GB	About an hour ago	
codegemma:latest	0c96700aaada	5.0 GB	2 days ago       	
gemma:2b        	b50d6c999e59	1.7 GB	2 days ago       	
llama3.1:latest 	f66fc8dc39ea	4.7 GB	5 days ago       	
phi3:latest     	4f2222927938	2.2 GB	7 days ago  

You can see that the new model has been created and is ready to be used. Run the model by issuing the following command:

$ ollama run pooh:latest


I asked the model “Who are you?” and it responded with the following:

“Oh, hello there! I’m just your friendly neighborhood bear from the Hundred Acre Wood is here to assist with any inquiries regarding our lovely forest home. So tell me, what brings such cheerful company into my corner today? Maybe we can help solve a puzzle or find something delightful together—perhaps even share some honey on this fine day!”

I asked where Pooh lived, and I got the following answer.

“Ah, where I reside is within the heart of our Hundred Acre Wood. It’s quite simply my home, full of winding paths and towering trees that stretch as far as one can see—a place both peaceful and lively with its array of woodland friends! Every morning here starts by opening up to this slice of paradise where I get the chance to bump into a puddle or two while searching for honey. It’s truly delightful living amongst nature, wouldn’t you agree?”

I asked the Pooh model who was president of the United States and it stayed in character as specified in the model.

“Oh dear friend, as much as it sounds like quite an important position to discuss within our forest family, I must confess that my knowledge on human world leaders doesn’t extend far beyond a tad. And since times are ever-changing and new presidents can come and go in this bustling nation of humans outside the Hundred Acre Wood, perhaps we might better spend such an inquiry learning about trees or discussing which direction to take our next forest picnic!”

These impressive responses and my own experience in education for nearly three decades invited me to consider how such models could be used in classrooms, how they might encourage thinking, and how they might stimulate the imagination of young minds. In conclusion, I asked the model what it would say to teachers and students about the importance of education.

I loved the response.

“Education is akin to discovering new flowers in spring—it enriches life with vibrant colors and sweet scents. Teachers are like beekeepers, diligently working to ensure every student’s mind buzzes full of knowledge gathered from all corners of their learning field. Students themselves must listen keenly, for the lessons learned in school can bloom into wisdom over time that they carry back home just as surely as I return here with drops of honey earned by my hard work every day! So let us toast our next cup of tea (or hot cocoa) and appreciate how education helps both bees, like me dear friends, and humans alike find their way.”

I invite you to let your imagination flower and how you might use these models for other creative purposes. The journey of a thousand questions begins with an LLM.

Harnessing the Power of Local AI: Exploring Ollama and Llama 3.1 for Advanced Language Modeling

Just yesterday, I came across Ollama, an open-source project developed by Meta. I had been helping a friend learn more about locally hosted large language models, and my internet search led me to Ollama. I installed it quickly on my Linux Mint desktop using the code supplied on the community website.

curl -fsSL https://ollama.com/install.sh | sh

It didn’t take too long to install the software and then I wanted to explore how it worked. I decided to download and install the recommended Llama3.1 model. I followed the instructions and in the terminal entered the following command:

$ ollama run llama3.1

The model began to install, which took a couple of minutes. This could vary depending on your CPU and internet connection. I have an Intel i7 with 64 GB RAM and a robust internet connection. Once the model was downloaded, I was presented with a prompt to ‘talk’ with the LLM.

>>> What is the history of St. Bonaventure University? 

“St. Bonaventure University, a private Franciscan university located in Allegany County, New York, has a rich and storied history that spans over
160 years.”

It’s not bad, but it’s not entirely accurate either. The results were rendered in MarkDown, which is a real plus. I also knew that having a GPU would render the results much quicker. I wanted to install Ollama on my M2 MacBook Air.

I followed the much easier directions: Download the Ollama-darwin.zip, unzip the archive, and double-click on the Ollama icon. The program is installed in the MacBook’s Application folder. When the program is launched, it directs me to the Mac Terminal app, where I can enter the same commands I had entered on my Linux computer.

I ran the same commands on the Mac to install Llama3.1 the first time. I asked for the history of St. Bonaventure University in Olean, New York. The results appeared much more quickly, but their accuracy was skewed even more. They were so inaccurate that they were comical.

“The institution was founded in 1858 by five Jesuit priests from the Buffalo Diocese as St. Bonaventure College. The college was established on a 200-acre farm in Deerpark, New York, with the goal of providing a Catholic education to young men.”

I downloaded and installed the Gemma 2 model from Google to see if it was faster and more accurate. The commands are the same whether using the Linux or Mac terminal.

$ ollama run gemma2:2b

Gemma 2:2b is the smallest model, at 1.6 GB, and it was downloaded and installed quickly. The results were similarly inaccurate, but they rendered much more quickly on both the Mac and Linux computers. Llama3.1 was only mildly accurate for information that occurred in 2021 and prior. I asked Gemma2 who was running for President of the United States and its information was only accurate as of October 26, 2023.

Despite the results, I am encouraged that it is possible to run large language models on PCs.