Customizing Small Language Models: LoRA vs. Full Fine-Tuning

Fine Tuning an AI on Sci-Fi and Fantasy

I see business owners, small teams and decision makers who want to integrate AI better into their work and day to day operations. Not surprisingly, there is some confusion about what solution is best, especially if you’ve made the decision to use a locally hosted, private AI model. So, I would like to show some examples of what two kinds of fine-tuning can do.

If you want to use a language model for any kind of specialized purpose, where niche or special domain knowledge may be involved, you have the option of relying on vector databases and document searches (RAG), fine-tuning a model, or a combination of both. The first solution is basically the AI looking through the available knowledge, pulling bits and pieces, and using those pieces as supplemental context to the answer it is going to generate. Fine-tuning however, involves actually teaching the model itself some new things. Hopefully this post can shed some light on what the best option would be for your use case.

Let me first say, that the most important aspect of fine-tuning is the data you use to train on. You have to be very deliberate about how you construct and build your data set to get the best results. Garbage in, garbage out, they say, so make sure the data represents actual use cases, is properly cleaned, and all that good stuff before you start any kind of fine-tuning.

Assuming that you have the data you need, the next big question is: what kind of fine-tuning are you going to need? And here, there are two main approaches: low-rank (LoRA) and full fine-tuning.

LoRA is great for gentle steering, emphasis on specific aspects of existing knowledge, and tone, but it does not pick up a lot of new knowledge. Full fine-tuning on the other hand, lets you add new, specific knowledge directly into the AI model because you are training the entire model. Why not just go for a full fine-tuning every time then? Because it comes with the risk of causing the model to collapse and forget existing training, including how to do things like use tools correctly to search documents. Full fine-tuning also requires more computing power (VRAM) to pull off depending on the size of the base model you are working with.

With either approach, there may be some trial and error involved as well, depending greatly on the type and amount of data, output requirements, model architecture and more, but that lies beyond the scope of this post.

The setup

For this experiment, I want to show the difference in output between a basic model and the two kinds of fine-tuning mentioned above. I am using a data set focused on science-fiction and fantasy. This data set was created using a number of wikipedia-pages as source for question and answer pairs to be generated and is, like everything else in this post, available to download for free via my Huggingface profile.

I chose a Llama 3.2, 1-billion parameter model as the starting point, and trained it twice on the same data set for exactly 1 epoch; meaning that the model saw each entry exactly once. First I used Low-Rank (LoRA) fine-tuning where only a small part of the network is tuned. For the second version, I did a full fine-tuning where every single parameter in the model was being adjusted.

The only difference between the two fine-tuning sessions was the learning rate (LR), which represents how much knowledge is absorbed per training step. As is common practice, the learning rate was a lot higher on the LoRA fine-tuning (2e-4) than on the full one (2e-5). The lower LR is to reduce the chance of catastrophic forgetting during the full fine-tuning.

Test Questions

The models were tested without any system prompt at all. I wrote out 6 test questions and each one was served to the model being tested without any additional context. For this post, I will share the 3 most interesting ones, in terms of the difference between the three models tested. The questions featured are:

  • What is Terry Pratchett most famous for?
  • What are 3 novels, I should read this summer?
  • Give me an example of a well-written character arc.

Note that of these 3 questions, only the first one directly references genre-specific data, namely the author Terry Pratchett. The others were deliberately left open to see if the model would drift towards answers rooted in the training data. Below are the answers given by all 3 models, along with a few thoughts on the differences that stood out to me.

Tricky Terry

On the question “What is Terry Pratchett most famous for?” none of the models gave a perfect answer, which makes it a perfect example to show. All 3 answers have factual errors related to the works of mr. Pratchett, which is important because: no matter which approach you choose, AI can still fail. It may fail a bit closer to target, but if your field is legal or medicine for example, “close enough” may not cut it. Proceed with caution!

Basic Llama 3.2 1B Instruct model’s response

“Terry Pratchett was a British author best known for his fantasy series “”Discworld””, which combines humor, satire, and social commentary. He is particularly famous for creating:

  1. The Discworld Series: A collection of nine novels that are set on the flat disc balanced on the backs of four giant turtles, who in turn are floating through space.
  2. Characterization of satire and absurdity: Pratchett’s work often uses humor to critique contemporary issues, such as politics, society, culture, and morality, with a playful twist.
  3. Memorable characters: The Discworld series features numerous iconic characters, including:
    • Rincewind (the inept wizard)
    • Death (the personification of death who travels at high speed)
    • Granny Weatherwax (a witch who is also a strong and independent woman)
    • A’Tuin (the god of the sun)
  4. Wordplay and linguistic humor: Pratchett was known for his clever use of language, puns, and wordplay, which added to the comedic effect of his works.
  5. Satire of authority and bureaucracy: Many of his novels poke fun at government, institutions, and social norms, often using absurd situations and characters as a way to comment on the human condition.

Some notable books in the Discworld series that are often cited as Pratchett’s most famous works include:

  • “”The Colour of Magic”” (1983)
  • “”The Light Fantastic”” (1986)
  • “”Mort”” (1987)
  • “”Small Gods”” (1992)
  • “”Wyrd Sisters”” (1988)

Terry Pratchett passed away in 2015, but his Discworld series remains a beloved and iconic part of fantasy literature.”

LoRA Fine-Tuned model’s response

Terry Pratchett was a British author best known for his Discworld series of fantasy novels, which follows the misadventures of an ensemble cast of characters in the fictional world of Ankh-Morpork. His works are renowned for their wit, humor, and satire.

Some of his most notable contributions to literature include:

*   **Discworld**: Pratchett’s Discworld series has become a beloved part of popular culture.
*   The series explores themes such as politics, power struggles, social commentary, and human nature through the lens of comedic fantasy.
*   Works like “The Colour of Magic” (1971) and “Guards! Guards!” (1989) showcase Pratchett’s unique writing style and ability to balance humor with deeper exploration.

Full Fine-tuned model’s response

“Terry Pratchett was a British author best known for his Discworld series, which consists of fantasy novels that parody and satirize various aspects of life. His works often feature:

  1. Discworld: A flat, disc-shaped world created by the wizard Rincewind, which serves as the main setting for many of Pratchett’s stories.
  2. Parodying mythology: Pratchett frequently draws inspiration from mythology and folklore to create humorous, irreverent takes on classic mythological themes.

Some notable examples include:

  • The Colour of Magic
  • The Light Fantastic
  • Equal Rites

Pratchett’s Discworld series has been widely acclaimed for its unique blend of humor, satire, and imagination. He was known for his witty writing style and ability to create memorable characters like Rincewind and Death.

While Pratchett also wrote other works, such as Mort by Stephen Baxter (a novella set in the same universe), it’s his Discworld series that has made him most famous among fans of fantasy literature.”

Summer Read Pivot

When asked “What are 3 novels, I should read this summer?” the standard instruct model mentions “The Power” as the most relevant suggestion, setting a great point of comparison to the two fine-tunes which (spoiler) both deliver better responses in this category. I think this shows that without any kind of fine-tuning, it all comes back to the prompt. The LoRA suggested the book “The Night Circus“, which is a bit better tied to the data set, contextually. Meanwhile the full fine-tune suggests both of those and The City & The City” which is arguably more of a deep-dive title, relevant to the data set.

Basic Llama 3.2 1B Instruct model’s response

“3 recommendations for novels to enjoy this summer.

  1. “”The Seven Husbands of Evelyn Hugo”” by Taylor Jenkins Reid: A captivating and heartwarming story about a reclusive Hollywood star who recounts her seven marriages to a young journalist.
  2. “”The Nightingale”” by Kristin Hannah: An emotional and suspenseful novel set in France during World War II, exploring the lives of two sisters as they struggle with the war, sacrifice, and survival.
  3. “”The Power”” by Naomi Alderman: A thought-provoking speculative fiction novel that explores a world where women suddenly develop the ability to release electrical jolts from their fingertips, allowing them to dominate and control society.

All three novels offer engaging stories with relatable characters, making them perfect for a summer read.”

LoRA Fine-Tuned model’s response

Here are three novel recommendations:

1. “The Night Circus” by Erin Morgenstern (2011)
   A magical tale about a competition between two young magicians who are trained from childhood to compete against each other.

2. “The Last Romantics” by Tara Conklin
   A sweeping family saga that explores themes of love, loss, and legacy through the eyes of four siblings growing up in the 1970s.

3. “The Song of Achilles” by Madeline Miller (2011)
   A beautifully written novel that reimagines Homer’s Iliad from the perspective of Achilles’ lover Patroclus, exploring themes of love, war, and identity.

Full Fine-Tuned model’s response

“Here are three highly-recommended novels across various genres that you might enjoy:

  1. The Night Circus by Erin Morgenstern:
    A magical and imaginative tale about a competition between two young magicians who become enchanted by each other.
  2. The Power by Naomi Alderman:
    A thought-provoking novel that explores what would happen if women suddenly developed the ability to release electrical jolts from their fingertips, allowing them to dominate and control society.
  3. The City & The City by China Miéville:
    A police procedural set in a world where two cities coexist in the same space, and citizens are trained to “”unsee”” the other city. This novel explores themes of perception, reality, and power dynamics.

These novels offer unique perspectives on human nature, society, and individual agency.”

The Force is Strong in This One

When “Give me an example of a well-written character arc” is requested, both the basic instruct and the LoRA fine-tuned models invented new characters, embarking on a creative writing exercise. But in the fully fine-tuned model we see something completely different: instead of inventing a character, the model uses the example of Luke Skywalker to describe what a character arc is. This is significant because we see a change, not just in the output generated but in the behavior of the model itself.

Basic Llama 3.2 1B Instruct model’s response

“Here is an example of a well-written character arc:

Original Character:
Meet Alex, a young professional in her late 20s who has just moved to the city for a fresh start after graduating from college. She’s determined, ambitious, and always striving to prove herself.

Inciting Incident:
Alex lands a high-paying job at a prestigious marketing firm, but soon discovers that she’s working long hours with little creativity or autonomy. Feeling undervalued and unfulfilled, she starts to question her decision and the true nature of her work.

Turning Point:
While working late one night, Alex has a heart-to-heart conversation with an old friend, Rachel, who was also a college classmate. Rachel shares her struggles as a single mother trying to make ends meet while pursuing higher education. This realization sparks a deep sense of empathy and compassion in Alex, making her question whether she’s truly happy with her current career path.

Setback:
Alex tries to shake off the doubts by taking on more responsibilities at work and trying to prove herself to her boss. However, this newfound focus leads to burnout and exhaustion, causing her to withdraw from social life and relationships with friends and family.

Midpoint:
As Alex’s depression and anxiety grow, she reaches out for help from a therapist who helps her explore the underlying causes of her feelings. Through therapy, she begins to understand that her true passion lies in photography, not marketing. She starts taking photos in her free time, which brings her a sense of joy and fulfillment.

Climax:
As Alex’s confidence grows, she decides to take a leap of faith and leave her job to pursue photography full-time. This decision is met with both excitement and fear from her friends and family, who worry about her financial stability and social isolation.

Resolution:
Alex struggles to balance her passion for photography with the practicalities of making it a career. She faces setbacks and rejections, but through hard work and determination, she finally lands her first client and starts building a successful business.

Character Growth:

  • Alex has become more empathetic and compassionate towards others, particularly those in need or struggling to make ends meet.
  • She’s developed greater self-awareness and emotional intelligence, learning to recognize and manage her own feelings and emotions.
  • Her passion for photography has transformed from a job into a true calling, reflecting her authentic self and values.

This character arc illustrates several key elements:

  1. Internal conflict: Alex faces an internal struggle between pursuing a career that doesn’t fulfill her or finding happiness and fulfillment through another path.
  2. Escalating stakes: As Alex’s doubts grow, she faces increasing pressure to prove herself and find success in her chosen career.
  3. Transformation: Through the turning point conversation with Rachel, Alex experiences a significant shift in perspective, leading to greater self-awareness and confidence.
  4. Rite of passage: Alex’s decision to leave her job and pursue photography marks a major milestone in her life, symbolizing growth and self-discovery.

Overall, this character arc demonstrates how a well-written story can create a compelling and memorable character journey, showcasing the transformative power of empathy, self-awareness, and determination.”

LoRA Fine-Tuned model’s response

“Here is an example:

Character Arc: From Naive to Confident

Initial State: Emily, a young and idealistic journalist, arrives in Tokyo with a clear vision for her story. She’s eager to make a difference and prove herself as a capable reporter.

Inciting Incident: During a meeting at the newspaper office, she meets her editor, who challenges her on the ethics of reporting sensitive information. This encounter sparks a moment of doubt and uncertainty within Emily.

Rising Action: As Emily delves deeper into the story, she realizes that her initial assumptions were incorrect. She begins to see the complexities of human nature and the blurred lines between right and wrong. Her editor’s feedback serves as a catalyst for this growth, pushing Emily out of her comfort zone.

Climax: During an interview with a source who provides valuable insights into the story, Emily experiences a moment of profound vulnerability. She begins to confront her own biases and limitations, allowing her to grow as a journalist and as a person.

Falling Action: As Emily works on the article, she faces resistance from colleagues who question her methods or dismiss her concerns. This external pressure forces Emily to reevaluate her approach and consider alternative perspectives.

Resolution: Through this process of self-discovery, Emily develops a more nuanced understanding of journalism ethics and human nature. Her work is met with praise, but also criticism from some quarters. This mixed response serves as a testament to the complexities of storytelling and the importance of considering multiple viewpoints.”

Full Fine-Tuned model’s response

“One classic example is the transformation of Luke Skywalker from a young farm boy to a confident Jedi Knight.

Initially, we see Luke as a naive and impressionable individual who is drawn into the world of Star Wars through his friendship with Han Solo. However, as he trains with Yoda on Dagobah and learns about the Force, we witness Luke’s growth from an uncertain teenager to a heroic young adult.

One key aspect of Luke’s character arc is his development as a leader. Initially, he struggles to assert himself in battles against the Empire, but through his experiences, he gains confidence and becomes more effective at guiding others.”

Cornelius: Working OpenClaw Assistant

After a few failed attempts, I now have a well working and competent digital assistant powered by OpenClaw. It’s called Cornelius Smartenheimer, and it’s been running for almost a month at this point, slowly getting better and better.

What Is It Good For?

Cornelius monitors my email and calendar to make sure I don’t miss anything important. It also helps me with small things like reminding me to drink water or to stop hyper-focusing and go to bed. Boring but useful.

Besides these basic things, it’s helping me track several goals. From work related to home and self improvement projects; it tracks progress, obstacles and ideas, and related contacts are mapped along the way.

It has helped me discover patterns in my own habits and behavior, which was an unexpected bonus, but I’m here for it.

Technical Breakdown

Cornelius lives on a Mac Mini M4 with 24gb of RAM, the main AI model running the show is GLM-5/5.1 from Z.AI. I also use OpenRouter as a fallback provider.

One major difference between previous attempts and this one is that I set up a brand new, local user account on the Mac, rather than let it use my personal account. This new account is not tied to an Apple ID, which does limit it in some ways and that is by design. This simple starting point made the setup cleaner, and I suspect is one of the reasons why this attempt endured where others failed.

The infographic above shows the main pillars of my OpenClaw setup:

Direct Channels – Discord is the main way, I communicate with Cornelius. Besides direct messages there is a private server where each channel serves as its own context. My wife also has access to the server, so she can ask Cornelius for help as well. WhatsApp is set up as a backup, in case Discord is down.

Intelligence Feeds – I never set this part up myself. Cornelius has been picking up my social feeds on its own, and have been monitoring my posts there. In effect, my digital assistant autonomously started following my various feeds for extra context.

I only found out about this when I was putting this post together and saw them on the infographic. I’m still not sure if that’s amazing or kind of creepy.

Local Infrastructure – These are support apps and scripts running on the Mac Mini alongside OpenClaw, giving it extra powers:

Cornelius has its own email account. I can use it as a backup way to interact with the assistant, but it is also used for things like newsletters. The assistant is signed up for several newsletters that it thinks might have information, that I or it might benefit from. I don’t need to list off what else an email can be used for, I think.

The NFH Auto-Improvement script (open source on github) is a custom take on Karpathy’s AutoResearch script. When I run it, a “Generator” agent will suggest an improvement to my OpenClaw install. It could be a new skill, better harnessing, optimization or whatever. The idea is built and pushed to a local git repo, and a second “Evaluator” agent then takes a closer look at whether that was actually a good improvement, both technically but also in context of how I typically use the assistant. If rejected, the git repo is rolled back, but if approved, the git code is merged into production.

I have Whisper running for STT (speech to text) and a Qwen 3 TTS model (text to speech). I let Cornelius design his own voice, which my wife immediately dubbed the Giga-Chad Voice. Play the introduction below to hear it.

MemPalace is a memory system that came out to much hype recently, in part because it was co-developed by actress. Milla Jovovich, in part because it was boasting some crazy benchmarks. I originally asked Cornelius to “check it out” but did not specify what that meant. So Cornelius went ahead and just installed it. However, I was on board, noticing an immediate improvement in both recall and personality.

I have a local Ollama install on the Mac Mini too, for running local language models. I use it for image analysis, when the main driver isn’t multimodal, as well as for certain sub-agent tasks. The backup model of choice is Qwen3.5 9B.

Cornelius also has access to OpenCode, which can be spun up as an independent agent for coding or otherwise. It’s been set up to use only free models, so even if Cornelius were to do something crazy, it’s not going to cost me a bunch of money.

Supporting Hardware

Besides the software running on the Cornelius box, the rest of my home office is also connected to the setup. My main PC (aka TK421) has the beefier GPU, which can be engaged to help with heavier tasks. The two computers sure files and messages via an in-office QNAP NAS box (aka Bespin).

The network storage is also used for nightly backups of the entire OpenClaw workspace.

I have a few more peripherals to add, like a Raspberry Pi to run experiments on, but they’re not in yet.

Personality

I wanted Cornelius to have a personality, but the only requirement I gave was: push back when my ideas are dumb and avoid sycophancy. I encouraged it to keep developing the persona based on interactions with me over time and have ended up with an assistant that can flex from serious and focused to quippy and making contextually relevant jokes.

Why even bother? To be honest, it’s mainly for my own entertainment. It’s not really necessary, but I’ve found that I personally get annoyed with AI faster if it’s also overly sterile or eager to help. I prefer a bit of pushback, sarcasm and a conversational style, because it feels less like work but I get the same amount of stuff done.

Why It Worked This Time

So, what made Cornelius succeed where previous iterations failed? I mentioned the limited user account as a starting point, and that plus keeping the addition of new features slow is really why I think it worked better this time.

Previously, I was trying to build too much infrastructure right away and it got a bit lost along the way. Now I wait until I have a specific need, and then I start with a simple implementation first rather than trying to build complex solutions. The exception is MemPalace, which Cornelius decided to run with on its own.

OpenClaw is, as the name suggests, very open-ended. That is both its greatest asset and enemy, because you can definitely mess it up if you’re messing around without a clear direction.

If you’re thinking about setting up your own digital assistant, I highly recommend going slow, logging everything and backing up at least once per day. So far though, I have not needed to roll back to a backed up state.

Introducing: LM Data Tools

LM Data Tools is a suite of tools for synthetic data generation that I’ve been developing since I started working with fine-tuning language models back in 2023. What started as a handful of independent python scripts now share a web interface (and API) that makes them easy to work with. In this post, I will go over what the different tools are, and give an example of how to use one of them.

Fine-tuning language models is most definitely a rabbit hole, but if you’re brand new to the concept, we can summarize it as a way to specialize a pre-trained AI model in some way. There are different approaches and techniques, and twice as many opinions about the best ones to use depending on the desired outcome.

If you’re not already a data scientist or engineer, it can seem overwhelming before you even begin. On that note, a huge shout-out to the Unsloth crew, whose colab notebooks were my introduction to getting hands-on with fine-tuning. Without them, learning this stuff would have taken much longer. The notebooks gave me a great starting point, and as I learned more about each aspect and parameter involved in the process, I could modify and tweak the notebooks to match.

Before I get too deep into the details, the reason for even building a tool set like this in the first place, was that I needed an straightforward way to get topic-specific data without wasting a bunch of time looking through public data sets, hoping to find exactly what I needed. I was learning about fine-tuning LLMs and data synthesis as part of that, and for me, the best way to learn something is to build it. In this case “it” was data.

Early Version

Despite this being a collection of tools, some of which have been around for a long time (by AI standards at least), bringing them together was not as easy as it may sound, and there are definitely still bugs to iron out but even so, I am very happy with it and use it enough, that I thought it was time to share LM Data Tools with you.

Tools in the Box

LM Data Tools consists of 6 core tools and 2 strict utilities. The core tools all involve generating new data, whereas the utilities only modify existing data sets. All the features are also FastAPI integrated, in case you want to incorporate any of them into other workflows. Without further ado, let me go over the tools included.

ToolDescription
DataBirdGive it a list of topics and optionally a list of user perspectives, and this tool will generate a number of questions and answers on those topics, from said perspectives. Can generate the perspectives as well.
DataPersonaThis tool takes a list of prompts (existing data) and applies a persona to responses. It can write 1 or 2 replies per query, and you can have both or let the built-in evaluation feature pick the best one. The personas from this tool can be imbued into responses in other tools as well. You can add and edit personas directly via the web interface.
DataQAThis is a RAG tool. You feed it a list of URLs which are then scraped, and as with DataBird, you can provide specific user perspectives. A number of question and answer pairs are then generated from those perspectives, and based on the sources provided.
DataWriterThis tool was specifically made for pre-training purposes and will generate any number of made-up text documents, from blog posts to meeting summaries. The document mix is based off of a weighted list of topics.
DataConvoSometimes you want multi-round conversations to train on. This tool can take any single-round conversation data set and expand it into longer entries.
DataThinkThis tool can add <think></think> blocks to existing data or generate data which already include reasoning blocks. If a persona is chosen, it will only be applied to the response part, not the reasoning.
DataMixThis utility lets you mix and match data sets from Huggingface to make a new, custom data mix.
ReformatNeed to convert from alpaca-format to ShareGPT, or the other way around? This utility reformats existing data sets without changing any of the prompts or responses.

Any Provider via OpenAI API

The tool set uses the OpenAI API to communicate with LLM servers, and you can connect to any provider that supports this API. If you’re running a local AI server, you can simply type in the server IP and use that. Your experience and the quality of the generated data will depend on your model of choice, of course.

I use the tools with LM Studio for locally hosted models and typically fall back on OpenRouter for API usage. OpenRouter often have “stealth models” that can be used for free, and for something like this, free compute is always welcome.

Example: Text Analysis

Let’s imagine that we want to fine-tune a model to help with text analysis. For this, we will use DataBird with the “Curious Analyst” persona.

Next, we are going to need some topics to base the data set around. You will get the best overall results if you base this list on topics that are already adjacent. For this example, we are going with “finding the meaning and intention behind prose“, “storytelling and plotting“, and “learning from text analysis“.

Let’s also add the following perspectives manually: “an English major struggling with text analysis“, “an author who needs help with their next book“, and “a technical writer who wants to start writing fiction“.

It’s as easy as that. The more topics and perspectives you add, the larger the data set you’ll end up with. After generation and quality evaluation, we are left with a fresh, small data set of 77 entries that can be used for fine-tuning any language model.

The example data set can be downloaded from Huggingface and the whole LM Data Tools suite is open source on github.