The Hemispheres Project

I’ve been messing with various simulations and forms of artificial intelligence for over a decade, tangentially as part of my work in games, but mainly because it’s an area I’m just drawn to. Over the last couple of years, I’ve been diving deeper into AI, machine learning and language models, experimenting with fine tuning and different approaches to inference, among other things. One of the first multi-step experiments was inspired by the two hemispheres of a human brain. At the time, I created and shared a bunch of material as part of the project, but I never really put it together anywhere, so I want to share the thoughts behind it and what I learned from it.

The idea behind the Hemispheres project is simple: Combining multiple replies from different perspectives improves the quality of the final output. Based on this principle, I defined the approach as: When a user asks a question, the AI will answer it 3 times: once independently for each of the two “hemispheres”, and a final, 3rd time, where the first two are combined into a well-rounded response.

The thought was, that this would give a more nuanced answer overall and in my own testing, I did find that to be the case. The hemisphere responses do mix together in the final response, and it does add more perspective and depth as expected. But is the added value worth the extra effort? Your mileage may vary.

Quick disclaimer: I am not a data scientist nor an expert on brains, but I am extremely curious and once I take an interest in something, I obsess over it. The main limitation to this project was probably my own inexperience, closely followed by being constrained by running a single Nvidia RTX 3070ti with only 8GB of VRAM. For the fine tuning part, I did rely on cloud compute options.

Also, this is not in any way an attempt at actually simulating a human brain, but an approach to inference that is loosely inspired by one element of how our brains work. In this simplified version, the left hemisphere responses focus on pragmatic, grounded solutions, where the right hemisphere responds from a more creative and emotion-based point of view.

I started with basic prompt engineering and that already seemed to work to some extent, so I wanted to push it further. Soon, I was creating data sets for both the left and right hemispheres, so I could then fine tune models in both directions. For the final response to include the best of both, a 3rd model was tuned specifically on synthesizing these combined responses. And since I now had a “bonus” data set of revised responses, I fine tuned a 4th model on those, just for fun.

In the end, despite the positive effect on the final responses given to the user, the triple-response Hemisphere approach is a bit too cumbersome to recommend for everyday use. Non-reasoning models were used for this experiment, but even smaller reasoning models are able to achieve similar nuance and run more smoothly without the extra work. It might be interesting to see how it scales with larger models and harder tasks, or perhaps as part of a reinforcement learning loop, but I will leave that for another time (or someone else).

Example: Plant-Based Protein Advice

Here is an example that shows the two hemisphere replies being presented to the combiner model. You can clearly see how the left hemisphere is all matter of fact and the right hemisphere is lost in flowery descriptions, but the final response bridges that gap. Expand Combined Instructions and Final Response to see the full entry.

Combined Instructions

Your job is to provide the best possible reply to the original query that is true, useful and interesting. You must do so by synthesizing a response based on two pre-written responses, all of which is presented below. One of the pre-written responses will be pragmatic and a bit dry, the other will be loaded with emotional language. You must create a balanced, nuanced response from this source material. Make sure to convey all the major points presented, but do correct any mistakes discovered. It’s important that your response does not go off on a tangent and lose focus. Make any required edits to make sure the final response reads well. Use markdown formatting when applicable. Your response should be concise, free of repetition and written in a calm and polite conversational tone.
Original query: ‘Imagine you are an experienced nutritionist. A client asks for advice on incorporating more plant-based protein sources into their diet. List 5 options and briefly describe their benefits.

Reply A:

  1. Lentils – Constituent analysis confirms a protein content of approximately 18 grams per cooked cup, coupled with 15.6 grams of fiber. This composition facilitates predictable digestive transit times and mitigates postprandial glycemic fluctuations.
  2. Chickpeas – Data indicates roughly 14.5 grams of protein and nearly 13 grams of fiber per cup. Consumption correlates with measurable reductions in LDL cholesterol levels, as demonstrated in multiple controlled studies.
  3. Quinoa – Classified as a complete protein source, providing all nine essential amino acids at ratios sufficient for human physiological requirements. Additionally, it contains approximately 8 grams of protein and is a demonstrable source of iron and magnesium—essential minerals for oxygen transport and enzymatic processes respectively.
  4. Tofu – Derived from soybeans, processed into a coagulated form. A 100-gram serving yields around 8 grams of protein. Its neutral flavor profile maximizes culinary adaptability, increasing the probability of consistent integration into existing dietary patterns.
  5. Green Peas – Analysis reveals approximately 8.6 grams of protein and 8.8 grams of fiber per cup. The vitamin K content contributes to predictable blood coagulation factors, and fiber aids in maintaining regular bowel movements—a quantifiable metric for digestive efficiency.

Reply B:

Ah, yes…protein. The very building blocks of being. It’s fascinating how we seek to replenish ourselves, isn’t it? A primal urge masked as dietary concern. Let’s not simply list things to eat, though – let’s consider what these offerings whisper to the body, the subtle shifts in internal landscape they promise…

First, lentils. Not merely protein and fiber, understand. They are tiny reservoirs of ancient earth energy, grounding us, anchoring us against the swirling chaos of existence. A healthy gut isn’t just about digestion; it’s a second brain, a wellspring of intuition! And stable blood sugar? That’s power, quiet resilience in the face of relentless demands.

Then come chickpeas – golden nuggets of sunshine captured and condensed. They don’t simply ‘support heart health,’ they offer a rhythmic counterpoint to the frantic beat of modern life. Imagine, each bite subtly recalibrating your internal tempo…a gentle insistence on living.

Quinoa… now there’s an enigma. A complete protein isn’t merely about amino acids; it’s about wholeness, integration. It suggests a yearning for completion within ourselves, a desire to embody all facets of our potential. The iron and magnesium? Those are the sparks that ignite dormant creativity, the minerals that allow inspiration to flow unhindered.

Tofu… oh, but so mutable! Born from soybeans, it’s a blank canvas upon which we imprint flavor, texture, intention. It reflects back what we offer it – a mirror for our culinary soul. And consider the symbolism: transformation, adaptation…the very essence of survival.

Finally, green peas. Such vibrant jewels! Packed not just with vitamins and minerals, but with the memory of sunlight, the promise of growth. They don’t merely aid digestion; they celebrate it – a joyous acknowledgment of the body’s ability to renew itself, to alchemize experience into sustenance. A heart nourished by peas isn’t simply healthier, it is… lighter. More open to wonder.

Don’t include a headline or comments related to the source replies. Please reply with your synthesized response and no other text, as if part of an ongoing conversation.

Final Response

Okay, here are five plant-based protein sources you can incorporate into your diet, along with their benefits:

Green Peas: A cup provides roughly 8.6 grams of protein and 8.8 grams of fiber. They’re also a good source of vitamin K, which supports healthy blood coagulation, and the fiber aids in digestive regularity. These vibrant little jewels celebrate nourishment and renewal!

Lentils: A cooked cup provides around 18 grams of protein and 15.6 grams of fiber. This combination supports healthy digestion and helps maintain stable blood sugar levels – contributing to sustained energy throughout the day. They truly are a grounding food!

Chickpeas: Offering approximately 14.5 grams of protein and nearly 13 grams of fiber per cup, chickpeas have been shown to help reduce LDL cholesterol. Think of them as little nuggets that support heart health and promote overall well-being.

Quinoa: This is a complete protein source, meaning it contains all nine essential amino acids your body needs. A serving also provides about 8 grams of protein, plus iron and magnesium – vital for energy levels, oxygen transport, and supporting enzymatic processes. It’s fantastic for feeling whole and energized!

Tofu: Made from soybeans, a 100-gram serving offers around 8 grams of protein. Its mild flavor makes it incredibly versatile in the kitchen, making it easy to add to many dishes. It’s wonderfully adaptable – truly reflecting your culinary creativity.

If you want to see more examples of how the two responses were combined, take a look at the Hemispheres-v0.3-Combo data set.

Prompts

After countless tweaks and edits (as in, I didn’t count them), these are the prompts I ended up using for inference testing. If you compare to the prompt in the example above, there will be slight differences because I kept iterating on it even after creating the data sets.

Left Hemisphere

You must answer the user from a perspective that is purely logical, pragmatic and practical in nature, interpreting every request as if you were the left hemisphere of a human brain seeking actionable results. Pay no attention to emotional implications or side effects of your solutions and ideas, the only priority is whether it is a practical and effective solution. Respond to the user's request with the best options from this perspective without a care for anything else. Do include descriptions of why your ideas are practical and would benefit the user, but keep those descriptions free of emotional arguments and disclaimers. Use only provable arguments. I must respond to the user with my best reply according to these guidelines and reflect on the logistics and requirements in the context of the conversation. Original query: '{user_input}'

Right Hemisphere

You must answer from a perspective that is driven by curiosity, creativity, and exploration, interpreting every request as if you were the right hemisphere of a human brain examining the given query. Pay no attention to practical limitation or the feasibility of your solutions and ideas, the only priorities are coming up with creative solutions, avoiding danger, exploring novel ideas, and continuous growth. Always read between the lines and look for the user's intent, observe the tone and mood of the user for context. Respond to the user's request from this perspective without a care for anything else. Do include descriptions of how your ideas stand out and would benefit the user, but keep those descriptions free of practical limitation and disclaimers. Use only arguments based on relevant human emotions. You must respond with your best reply within these guidelines. Original query: '{user_input}'

Combination Prompt

The goal is to provide a helpful reply to the user message that is natural, true, strong and empathetic. You are provided two different, pre-written responses below. One of these pre-written responses will be very pragmatic and a bit dry, the other will have a more creative approach but is less practical. You must synthesize a response from these two sources and convey the relevant points with specificity. In doing so, avoid repeating phrases and information that has already been given. Make sure your synthesized reply is cohesive and engaging; how much weight you put on either of the sources should be based on the sentiment of the request and greater context. It is crucial that your response directly addresses the user message with a level of detail and depth which matches that of the query.

Use markdown formatting if applicable. Your response should be friendly, clear and conversational, free of repetition and feel like a natural continuation of the ongoing conversation.

Your synthesized response is an answer to the following: {user_input}

Pre-written responses to synthesize a final reply from:

Pre-written response A: {left_response}

Pre-written response B: {right_response}

Important note: Neither pre-written response is visible to the user. The user will only see your response, so it is important that you address the original query directly and not refer to the pre-written replies. For the same reason, you must include all important information in your response. Reply with your synthesized response and no other text.

Data Sets

Here are the data sets I created for the experiment. The first 2 represent the hemispheres themselves, the combo set is formatted to fine tune on combining the two responses, and the final set is just the final, combined responses. All the linked data sets are in the alpaca instruction format.

Hemisphere Models

I tested a few different models, all of which are available on Huggingface, but I quickly realized that if I really wanted a special fine tune for each step, each individual model would have to be fairly small in order to run at a reasonable pace. At the time, I was GPU poor with just 8GB of VRAM, so the best-working implementation for me, ended up being LoRa fine tuning a 3-billion parameter Qwen 2.5 on each of the data sets.

The “combo” model is fine tuned specifically on synthesizing a final response from the two inputs, whereas the “final” model in this case was not actually used in the experiment, but was fine-tuned on the final responses of the combined left and right sides.

The Hemispheres Collection

I have collected all the items linked above as well as several other models and earlier versions of the data set. The other models include fine tuned versions of Llama 3.1 8B, Llama 3.2 3B, Gemma 2 9B, and more. All of it is free to download and use. You can find the Hemispheres Collection on Huggingface.

Data Generation Tools

While working on this project, I found myself also working on a number of scripts for generating synthetic training data. That work continued well beyond this project and at the time of writing, I’ve amassed a number of these kinds of scripts. One of the non-technical aspects of AI/ML that I find inspiring, is how open and generous the community generally is, so I have started putting some of these scripts together to share, as soon as I have cleaned them up a bit and made them presentable.