Recently, I have set up a local AI in order to end my subscription that I had first with OpenAI, and then with Perplexity. More than a simple AI conversational style, the idea was to set up an agent (Hermes Agent with the model Qwen 3.6 35B A3B), which can thus access the internet, my files, tools, etc., But in conversations something strange happened.
Asking for information on my new setup capacity of running Bayesian models and what types I could run using PyMC, the agent has suddenly began to speak… in Portuguese. I initially thought that was Spanish, but it was indeed Portuguese. So what happened for my agent to switch from French to Portuguese?
At first, it is important to understand that behind a ChatGPT or other Large Language Model (LLM), there is simply a set of matrices and multiplication, which is similar to a regression, which aims to predict the next word in a sequential manner, using the context at disposal (things that has been discussed before, memory etc). It is therefore the context, which accumulated, has increased probabilities for Portuguese instead of French.
In my case, there were two themes that have triggered it :
- The python libraries for bayesian statistics (PyMC)
- The dosage of my e-liquid for my vape
Let’s dig deeper.
Trigger 1: The Data Science Magnet (pandas and PyMC)
Models are extensively trained on the data from the web, regardless of the language. However, there is a large technical community that is actively discussing of PyMC and pandas in Brazil. While conducting its research, the model has therefore extract a lot of documentation or advanced tutorials of the Portuguese-speaking community. The context being filled with mostly Portuguese, the LLM stayed consistent with the predominant language. Once the first token issued in Portuguese, the tokens following have even more chance to be issued in Portuguese.
Trigger 2: The Mathematical Precision of the Liquid Vaping
This trigger is less obvious, but has weighed heavy in the balance of mathematics. In fact, I have often described my use of liquids in ml or mg/ml, in French or in English. These values were in the context following a previous conversation. Some tokens have also been activated by mistake, reinforcing the shift to Portuguese.
Despite this context leakage, my model has quickly regained its language of origin to explain what had just happened. Although here, it is just a matter of a language switch, that could very well concern the content, or other information. This is a good reminder that we must always be vigilant in using LLMs. The solution would be to clean up the context, and restart a new conversation when you change theme.
