-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification on supportsLanguage API #29
Comments
Can you explain how you got the impression that an API with the name "supports" would trigger a download? The explainer tried to be pretty clear that only |
Oh it's because of this line: supportsLanguage(languageTag), which returns "no", "after-download", or "readily" to indicate whether the model supports conversing in a given human language. |
Right, and right above
I guess we can clarify with a cross-link to explain how downloads happen, i.e. via
In our experience model developers are relatively clear on what languages their models have been trained on, and officially "support". E.g. it is usually listed in the model card. That was our initial thinking, but maybe there's more subtlety here. |
It is still odd that supportsLanguage returns AICapabilityAvailability. Simple boolean feels appropriate.
The model card lists what was present before quantization and what the model was trained on, is there a language benchmark that should be used to validate final support - if web developers are going to rely on the language capability I am wondering if the spec should mandate a minimum score on a benchmark, otherwise developers would need to know the model or UA. |
I don't understand why it's odd. The idea is to signal whether the language is not available, is available but doing so might require an expensive download (e.g. of a LoRA or other fine-tuning), or is readily available. Developers might make different decisions based on those three possibilities. How would you signal those three possibilities with just a boolean? |
The idea of the API is that they wouldn't need to know the model or UA. They'd only need to know the return value of the API. In other words, they can rely on language X being present if |
Thanks for the explanation about LORAs per language. When a developer checks language support for multiple languages with supportsLanguage and receives 'after-download', is the expectation that the developer should proceed with create and then check supportsLanguage again to see which of the languages he was interested in are now ready? Regarding my question about benchmarks for language support, I see that the position is "We do not intend to provide guarantees of language model quality, stability, or interoperability between browsers... These are left as quality-of-implementation issues". Which means that a developer would need to check a UA string to see if he trusts a given browser's model, which is problematic, but I understand the position. |
The intention is that for any capability, if you get "after-download", you should not have to check again. "after-download" means that once you create a model with options that use that capability, the capability will be downloaded, and will work. So there's no need to check the capabilities again; you know it will work. For example: const capabilities = await ai.assistant.capabilities();
if (capabilities.supportsLanguage("ja") === "after-download") {
const session = await ai.assistant.create({
systemPrompt: "あなたは優しいくまです。"
});
// Now chat with the friendly bear. No need to check `capabilities` again. It'll definitely work.
} In practice this means code will look more like: const capabilities = await ai.assistant.capabilities();
if (capabilities.supportsLanguage("ja") !== "no") {
// This might download or might be created readily. If we care we can check in more detail,
// but many pieces of code might not care.
const session = await ai.assistant.create({
systemPrompt: "あなたは優しいくまです。"
});
// As before.
} However, I think you've highlighted a weakness with the API. Unlike with the various options for the writing assistance APIs (e.g. So, probably we should add a more explicit
This is not what I was trying to communicate. Let me try a different phrasing. Let's say a browser wants to bundle model X with their browser. Model X's system card says that it's been trained on English, Japanese, and French. The browser company is happy with their models performance on these languages and is happy for people to use it on those languages. So, the implementation of the prompt API in that browser, which uses model X, will return "readily" (or maybe "after-download") for those three languages. It will return "no" for the others. The browser has no incentive to return a positive value for other languages. It has not tested those other languages. It did not train on them. Doing so would just lead to web developers getting wrong information about the model from the capabilities API. From the web developer side, there is no need for user agent sniffing. If they ask Really, this capabilities API is just like any other capabilities API on the web. Web developers prefer using |
This comment was marked as off-topic.
This comment was marked as off-topic.
I've hidden the above comment as it appears to be a question or bug report about a specific implementation (probably Chrome's), and as such is better suited for that implementation's issue tracker (for Chrome, that's https://crbug.new/). |
These solve the problem discussed in webmachinelearning/prompt-api#29 and #16. They provide a mechanism for web developers to tell the browser to download additional material to support additional languages, and for web developers to get early errors if they know they will be trying to use a language that isn't supported. It also clearly separates input, context, and output languages, with a requirement on how the output language is produced by default (match the input). This removes the languageAvailable() API, folding it into createOptionsAvailable(). Further work might remove the AISummarizerCapabilities object altogether, since now it's mostly a wrapper around the single createOptionsAvailable() method.
These solve the problem discussed in webmachinelearning/prompt-api#29 and #16. They provide a mechanism for web developers to tell the browser to download additional material to support additional languages, and for web developers to get early errors if they know they will be trying to use a language that isn't supported. It also clearly separates input, context, and output languages, with a requirement on how the output language is produced by default (match the input). This removes the languageAvailable() API, folding it into createOptionsAvailable(). Further work might remove the AISummarizerCapabilities object altogether, since now it's mostly a wrapper around the single createOptionsAvailable() method.
Topic 1: This API feels like would suffer from conflation of intent
It might be better to have this API be a pure feature detection API
boolean supportsLanguage(languageTag)
this way the UA is free to apply heuristics to determine if a language has been requested enough number of times to trigger download of a specific model.
Topic 2: It is going to be challenging for interop if we cannot quantify what support means. We would need to think of test suites that can help validate level of support if a UA claims supportsLanguage is true. Any thoughts on how to manage this?
The text was updated successfully, but these errors were encountered: