Live data from Hacker News

Extracting AI models from mobile apps

altayakkus.substack.com

211–220 of 250 posts

Re: Extracting AI models from mobile apps

#211
post #203

Earlier quoted context omitted.

I think the comment author means offering inference via Firebase, with the model never leaving the backend. This works, just like ChatGPT works, but has the downside of 1. You have to pay the computing for every inference 2. Your users can't access it offline 3. Your users will have to use a lot of data from their mobile network operator. 4. Your inference will be slower And since SeeingAI infers the model every seco…

That's what I thought, but the link doesn't say anything about off-device inference, it's only about storing and retrieving the model. There's just one off-hand note about cloud inference. In any case, yeah you can not download the model to the device at all, but then you have to deal with the other angle - making sure the endpoint isn't abused. Maybe a hybrid approach would work - infer just part of the model (layer…

Your second note is very interesting, having looked at the model myself this is very plausible.

For models which use a lot of input nodes, a lot of "hidden layers" and in the end just perform a softmax this may get infeasible because of the amount of data you would have to transfer.

You may have inspired a second article :)

Re: Extracting AI models from mobile apps

#212

> Keep in mind that AI models [...] are considered intellectual property Is it ironic or missing a /s? I can't really tell here.

I think it's both. It's 1. the current, unproven-in-court legal understanding, 2. standard disclaimer to cover OP's ass 3. tongue-in-cheek reference to the prevalent argument that training AI on data, and then offering it via AI is being a parasite on that original data

> reference to the prevalent argument that training AI on data, and then offering it via AI is being a parasite on that original data

Prevalent or not, phrased this way it's clear how nonsense it is. The data isn't hurt or destroyed in the process of being trained on, nor does the process deprive the data owners from their data or opportunity to monetize it the way they ordinarily would.

The right terms here are "learning from", "taking inspiration from", not "being a parasite".

(Now, feeling entitled to rent because someone invented something useful and your work accidentally turned out to be useful, infinitesimally, in making it happen - now that is wanting to be a parasite on society.)

Re: Extracting AI models from mobile apps

#213
post #44

Earlier quoted context omitted.

IANAL But, this is not true it would be a piece of the software. If there is a copyright on the app itself it would extend to the model. Even models have licenses for example LLAMA is release under this license [1] [1] https://github.com/meta-llama/llama/blob/main/LICENSE

LLMs are trained on works -- software, graphics and text -- covered by my copyright. What's the difference?

The difference is that you pulling out a model is you potentially violating copyright, while the model itself being trained on copyrighted models is potentially them violating copyrights.

I.e. the first one concerns you, the other is none of your business.

Re: Extracting AI models from mobile apps

#215
That's pretty cool! I am impressed by the Frida tool, especially to read in the binary and dump it to disk by overwriting the native method.

The author only mentions APK for Android, but what about iOS IPA? Is there an alternative method for handling that archive?

Re: Extracting AI models from mobile apps

#216

Lot of comments here seem to think that there’s no novelty. I disagree. As a new ML engineer I am not very familiar with any reverse engineering techniques and this is a good starting point. Something about ML yet it’s simple enough to follow, and my 17yr old cousin who is ambitious to start cyber security would love this article. Maybe its too advanced for him!

Thanks a lot :) My general writing style is directed mainly towards my non-technical colleagues, which I wish to inspire to learn about computers. This is no novelty, by far, it is a pretty standard use-case of Frida. But I think many people, even software developers, don't grasp the concept of "what runs on your device is yours, you just dont have it yet". Especially in mobile apps, many devs get sloppy on their mob…

I'm a mobile developer and I'm new to using Frida and other such tools. Do you have any tips or reading material on how to use things like Frida?

Re: Extracting AI models from mobile apps

#217

Earlier quoted context omitted.

Boils down to "use Frida to find the arguments to the TensorFlow call beyond the model file" Key here is, a binary model is just a bag-of-floats with primitively typed inputs and outputs. It's ~impossible to write up more than what's here because either: A) you understand reverse engineering and model basics, and thus the current content is clear you'd use Frida to figure out how the arguments are passed to TensorFlo…

> It's ~impossible to write up more than what's here Except you just did - or at least you wrote an outline for it, which is 80% of the value already.

The more impolite version of this basically says "If you can't figure out you're supposed to also use Frida to check the other arguments, you have no business trying." I agree, though, wrote a more polite version.

Re: Extracting AI models from mobile apps

#218

Earlier quoted context omitted.

Boils down to "use Frida to find the arguments to the TensorFlow call beyond the model file" Key here is, a binary model is just a bag-of-floats with primitively typed inputs and outputs. It's ~impossible to write up more than what's here because either: A) you understand reverse engineering and model basics, and thus the current content is clear you'd use Frida to figure out how the arguments are passed to TensorFlo…

> TL;Dr a request for more content is asking for a reverse engineering article to give you a full education on modal inference I don't understand what you mean: I have no clue about anything related to reverse engineering, but I ported the mistral tokenizer to Rust and also wrote a basic CPU Llama training and inference implementation in Rust, so I definitely wouldn't need an intro to model inference…

You're also not the person I'm replying to, nor do you appear in any of this comment chain, so I've definitely not implied you need an intro to inference, so I'm even more confused than you :)

Re: Extracting AI models from mobile apps

#220

"Keep in mind that AI models, like most things, are considered intellectual property. Before using or modifying any extracted models, you need the explicit permission of their owner." If weights and biases contained in "AI models" are prorietary, then for one model owner to detect infingement by another model owner, it may be necessary to download and extract.

Where the model owner is not the owner of the training data consider also that weights may be derivative works:

https://www.arxiv.org/pdf/2407.13493

Post reply on HN