Live data from Hacker News

Lamini Memory Tuning: 10x Fewer Hallucinations

lamini.ai

51–60 of 63 posts

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#51
post #49

It feels like the two dumb ways to customize an open LLM are fine tuning and RAG. The former is expensive and complicated, the latter adds complexity to your queries but doesn't require up front compute for retraining. I couldn't tell how expensive this is up front, or what complexity it adds to the setup. Anyone know? It's definitely an interesting idea but if you have to pay $100k for all that LoRA, what margins ar…

What do you think is complicated about RAG? I'm not arguing that it's effortless, but it's not that complicated? Genuinely interested to hear other people's pain points.

Well, you need to generate embeddings usually, and then query and filter those, but it isn't that complicated for sure.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#52
post #14

Earlier quoted context omitted.

I think there is an expert router layer to decide which loras to be integrated at inference time. But they also mention that they freeze the weights for router during training. So it is unclear to me how the router was trained on what loss.

Interesting. That’s kind of surprising to me - it would mean with every new Lora they’d need to fine tune the router, no? Embedding a description of the Lora and using RAG to pull the nearest Loras in the embedding space is where my mind goes; it’s super extensible, minimal additional training for customer use cases, and the way the Loras probably work it’s not terrible to pull a few extras. Anyway I just speculate —…

That's where it is confusing to me. They mentioned that for LoRA fine-tuning, the router weights are frozen, so you don't update the routing when training different concept. But how that expert router is trained? Could be a pretraining with some aux loss to encourage diversity.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#53

The website says: > At inference time, the model retrieves the most relevant experts at each layer and merges back into the base model to respond to the user query. The paper says: > At inference time, only the relevant experts are retrieved from the index, allowing the LLM to store a large number of facts while maintaining low inference latency. We use specialized GPU kernels written in Triton Tillet et al. (2019) t…

Agreed, I looked through their “paper” and while it goes through the motions of a scientific paper, there’s barely any reproducible methodology. A single page in their paper, including the diagram. They do reference some papers I’m not familiar with and say their method is “similar”. If you check the huggingface page mentioned in a footnote, they have two directories: one for a model, and the other which contains a F…

That’s fair - I’ll try to go through the weekend and write out some of the equations for the kernel that loads the weights out of the index and does the adaptor ops. It’s inspired by cross attention in retro but there are some differences for training stability and to use as an adaptor rather than training from scratch.

I consider that paper an early draft - hot off the press so to say - it needs review & editing before we would submit it to a conference. I tend to prefer a few rounds of open review before a final submission these days anyways - so appreciate the feedback

I think the main idea should be reproducible - you can repeat the randomization and generalization tests with any LLM and get similar training curves and eval results - it just wouldn’t be efficient.

We have tried it on about 5 real customer use cases with different facts and good success. Obviously we can’t publish customer data to reproduce which is why we focused on the randomization tests in the paper .

There are also some missing hyper parameters from the appendix as well we will add eventually

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#54
post #7

Woww, very creative and interesting idea: I understand it as: train a bunch of fact-based LoRAs to zero loss (they mention 100k different ones), then use RAG to pick the appropriate Loras for a query. So cool. The only moat I can think of for such a company would be proprietary fact loras- basically licensing a modern ai encyclopedia. Anyway, really nice idea.

Bit late to the party and I'm not into the AI scene, but from glossing over the three key papers they cite to describe their model, my take is as follows.

The idea from LoRA[1] is to take pre-trained, dense weights W_0 for a model and adapt them to new training data by using the weights W = W_0 + BA for inference. The key is that the matrices A and B have a very low rank[2] compared to W_0. Training is then done by treating W_0 as constant, and only updating the A and B matrices.

The idea from MoE[3] is to pick just a few "experts" from a large number using Softmax, and insert them between other layers in a neural network. The "experts" can be just some simple matrices or neural networks in their own right.

The Lamini model seems to combine these ideas, where they use several "experts" layered between the BA matrices. However instead of just a simple Softmax to select the "experts" they use (chunked?) cross-attention[4], and a much larger number of "experts" compared to the MoE paper. From what I gather the cross-attention allows the expert selection to react to the context, unlike the more naive plain Softmax gating approach.

Similarly to LoRA, they train the Lamini model by keeping the pre-trained LLM weights constant. From what I can gather they do a bit of training on the cross-attention layer but then freeze that too, to avoid the cross-attention layer favoring the same "experts" all the time.

The idea then is to train the "experts" and the LoRA layer on facts until the combined model (W above) gets each fact correct (zero loss).

Thus when the model "sees" a keyword in a sentence, a set of "experts" will steer/adjust the output of the pre-trained LLM to output the correct fact. Or at least that's how I imagine it works.

What's less clear to me is what exactly the "experts" are and how they are combined.

Since they're used to adjust the weights of the combined model, I it makes the most sense to my un-trained eye that they're simple matrices as mentioned in the MoE paper. Given they're layered between the low-rank portions of the LoRA section, they're necessarily relatively small matrices, so having millions of these "expert" matrices doesn't add too many parameters overall.

And while they're portrayed as stacked in the Lamini paper, suggesting matrix multiplication, matrices are generally not commutative[5]. So to the un-trained eye it seems likely the "experts" are simply added like in the MoE paper.

But yeah, I'm very much not an expert and the paper was more like a conference poster at best, lacking a lot of detail, so this might be all gibberish and I'd appreciate being corrected.

[1]: https://arxiv.org/abs/2106.09685

[2]: https://en.wikipedia.org/wiki/Rank_factorization

[3]: https://arxiv.org/abs/1701.06538

[4]: https://arxiv.org/abs/2112.04426

[5]: https://en.wikipedia.org/wiki/Commuting_matrices

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#55

Am I the only one that cringes at "10x fewer?" How do I multiply positive numbers and get something smaller? Is "1/10th" or "90% less" not better arithmetic? Maybe I should have done more gooder at math but it hurts my ears (eyes).

They're speaking to the lay community. The lay community is not known for using precise language. If they had used language like yours, the lay community probably wouldn't have received the key message: "10x better".

On the other side, it seems clear that the scientific community was able to deduce the intended meaning of "10x fewer".

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#56
post #7

Woww, very creative and interesting idea: I understand it as: train a bunch of fact-based LoRAs to zero loss (they mention 100k different ones), then use RAG to pick the appropriate Loras for a query. So cool. The only moat I can think of for such a company would be proprietary fact loras- basically licensing a modern ai encyclopedia. Anyway, really nice idea.

Bit late to the party and I'm not into the AI scene, but from glossing over the three key papers they cite to describe their model, my take is as follows. The idea from LoRA[1] is to take pre-trained, dense weights W_0 for a model and adapt them to new training data by using the weights W = W_0 + BA for inference. The key is that the matrices A and B have a very low rank[2] compared to W_0. Training is then done by t…

Thanks for this substantive reply.

In this case, the experts could literally be routing / weighting of the LoRas, so it could be a 1x100k (or 1mm or whatever) vector , binary, maybe for simplicity and size. Or floats that are capped to 1/0 at inference time, but trained as floats.

The thing that’s a little weird to me is that you’d need to keep retraining the experts. But, I guess it may just be part of the pipeline for adding custom knowledge to the system.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#57

Earlier quoted context omitted.

Bit late to the party and I'm not into the AI scene, but from glossing over the three key papers they cite to describe their model, my take is as follows. The idea from LoRA[1] is to take pre-trained, dense weights W_0 for a model and adapt them to new training data by using the weights W = W_0 + BA for inference. The key is that the matrices A and B have a very low rank[2] compared to W_0. Training is then done by t…

Thanks for this substantive reply. In this case, the experts could literally be routing / weighting of the LoRas, so it could be a 1x100k (or 1mm or whatever) vector , binary, maybe for simplicity and size. Or floats that are capped to 1/0 at inference time, but trained as floats. The thing that’s a little weird to me is that you’d need to keep retraining the experts. But, I guess it may just be part of the pipeline…

> In this case, the experts could literally be routing / weighting of the LoRas

Hmm yes, good point. Hard to tell with so little to go on.

edit: I assumed they were matrices given they were squares in the figure, just squashed to fit in the LoRA stackup, and given that they'd be low-dimensional so few parameters due to that.

> The thing that’s a little weird to me is that you’d need to keep retraining the experts.

Yeah my impression was this is more for static knowledge, like if you wanted to have a Wikipedia-assistant say.

It got me thinking though, if it could be a stepping stone towards something more dynamic. Say could you use something like the W = W_0 + dW idea to tweak the cross-attention mechanism to select newly added experts somehow?

Again, not into the AI scene, just like entertaining these shower thoughts.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#58
post #18

Doesn't this make the "AI" even less creative and more like full-text-search instead? What makes some data a "fact"? If everything is written in the training data, in the end, won't everything be treated like a fact? So the LLM will have 100% accuracy and 0% creativity.

Whats wrong with that?

If "AI" simply allowed people to search data without having to structure it then apply very rigid search terms, that would be in a win in my book.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#59
post #18

Doesn't this make the "AI" even less creative and more like full-text-search instead? What makes some data a "fact"? If everything is written in the training data, in the end, won't everything be treated like a fact? So the LLM will have 100% accuracy and 0% creativity.

Whats wrong with that? If "AI" simply allowed people to search data without having to structure it then apply very rigid search terms, that would be in a win in my book.

Nothing wrong, only that AI seems to be transforming into the next search engine, as opposed to AGI.

Re: Lamini Memory Tuning: 10x Fewer Hallucinations

#60
post #14
post #7

Woww, very creative and interesting idea: I understand it as: train a bunch of fact-based LoRAs to zero loss (they mention 100k different ones), then use RAG to pick the appropriate Loras for a query. So cool. The only moat I can think of for such a company would be proprietary fact loras- basically licensing a modern ai encyclopedia. Anyway, really nice idea.

I think there is an expert router layer to decide which loras to be integrated at inference time. But they also mention that they freeze the weights for router during training. So it is unclear to me how the router was trained on what loss.

I am old enough to remember the use of yellow pages to find teh right expert
Post reply on HN