# Would maximizing (instead of minimizing) error of an LLM/HMM lead to complex behavior?

Imagine we have some sort of "next token predictor," either with transformer architecture, LSTM, or just a HMM (though the terminology I use here will be less aligned to HMMs, I believe the question is generalizable to all generative NLP).

We reverse the cost function. That is, we are training to maximize error instead of minimizing it. In the case where error is neither maximized nor minimized, the behavior will be fairly boring. However, a model which is maximizing error may still need to learn patterns of syntax and which words usually follow one another in order to avoid them. I would expect that in some abstract way, it may behave creatively, because it is trying to produce output which is not in the training data, and is furthest away from it. In fact, it ideally should understand the user's query in order to avoid using words that follow it.

This makes me think the output may be non-boring, although probably not practically useful.

You cannot really invert the loss, because that's undefined most likely.

Take linear regression with OLS, then we know that the loss function is quadratic wrt the parameters (assuming to have 1 covariate only):

Now, if you try to maximize that function, you would quickly see that they don't have any maximum, so you would just get ginormous predictions, and no pattern would be caught/learnt

• For this type of model, more variation around the regression line could be achieved amplifying the error variance Commented Nov 20, 2023 at 16:15
• @JaumeOliverLafont what do you mean? "we are training to maximize error instead of minimizing it." it's pretty well mathematically defined, and no matter what you do, you cannot get a better solution worsening the error (note that "Allowing for some transitions other than those observed" does not fall in the category of this definition the OP is asking) Commented Nov 20, 2023 at 20:54
• I mean the error e in y=wx + b + e. You estimate w and b as usual -minimizing- but then generate y for given x with larger noise, so it has larger deviation around the expected value. Commented Nov 20, 2023 at 21:03
• The transitions make sense in the context of HMM then OP mentions. Commented Nov 20, 2023 at 21:04
• @JaumeOliverLafont I might agree with you, that might seem a exploration-exploitation strategy, however HMM are trained to maximize $p(y_i|y_{j<i}, x)$, and to do so we assume that $x,y$ and the conditional are some fixed distribution... if you increase the noise, you might end up in a low density region of your space, that your model has never seen, so doesn't know how to behave Commented Nov 20, 2023 at 21:07

In HMM, a simple mechanism to reduce overfitting and therefore generating variety in the system output is tweaking the transition matrix A and/or the symbol emission probability B. Allowing for some transitions other than those observed in the training data or other symbols in states where they were not actually seen before can introduce a richer behavior.