Querying browser compat data with a LLM

I’ve been noodling about a lot with LLMs recently and naturally I wanted to see if they could help me with my role. There’s a lot of places I’ve found them to be useful, but an area where I’ve struggled is their data sources not being up to date with the current state of the web.
I build a lot of sites and speak to a lot of Web Developers and a huge problem we have is knowing what APIs are supported so that I can use and rely on it in my sites without having to worry about compatibility as much.


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan

I've been noodling about a lot with LLMs recently and naturally I wanted to see if they could help me with my role. There's a lot of places I've found them to be useful, but an area where I've struggled is their data sources not being up to date with the current state of the web.

I build a lot of sites and speak to a lot of Web Developers and a huge problem we have is knowing what APIs are supported so that I can use and rely on it in my sites without having to worry about compatibility as much. There are a number of sites that have this information (canisuse and MDN), however if the LLM isn't up to date on the latest state of browsers then we can't query compatibility information.

Luckily, the raw Browser Compat Data by MDN is here to the rescue (again), and the team build and maintain the BCD data as an ongoing and always up to date resource in JSON. This gave me an idea - if I can load this data into my Polymath instance then I might be able to ask a question like:

  • I need to use Safari, Firefox and Chrome - is CSS Grid ok to use?
  • When did CSS Grid become useable in Safari, Firefox and Chrome?

The hypothesis I had was that we have all the data so an LLM might be able to infer decent results to questions like the above.

The first step I tried was to pass some raw JSON data into GPT-4 and see what it could infer - It worked okay but it doesn't have a clear comprehension of the data format so it made a lot of mistakes, for example if it saw support value "mirror", it outputted "supported in Chrome" and not the base engine (i.e, Safari on iOS mirrors Safari or WebKit). The answer was good enough for me that I decided that I wanted to flesh it out a bit more and try and massage the input data into something the LLM might better work with.

My hypothesis was that the LLM might parse written English better, so I quickly threw together a complete list of all the APIs tracked by BCD with an English description of the support matrix that expanded on the data in the JSON file. For example, here is the support data for acos (you can see the code in my github repo).

I then ingested all the data into my Polymath instance (creating the Embedding vectors) and uploaded it to the data store so that you can now query it like so: When did CSS acos arrive in Chrome? and I need to use Safari, Firefox and Chrome - can I use css.acos?

A fun experiment and it seems to work well, but it's only as good as the data I put in and the quality of the LLM (I imagine it can make up things so I wouldn't really trust the output just yet).


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan


Print Share Comment Cite Upload Translate Updates
APA

Paul Kinlan | Sciencx (2023-04-11T13:19:43+00:00) Querying browser compat data with a LLM. Retrieved from https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/

MLA
" » Querying browser compat data with a LLM." Paul Kinlan | Sciencx - Tuesday April 11, 2023, https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/
HARVARD
Paul Kinlan | Sciencx Tuesday April 11, 2023 » Querying browser compat data with a LLM., viewed ,<https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/>
VANCOUVER
Paul Kinlan | Sciencx - » Querying browser compat data with a LLM. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/
CHICAGO
" » Querying browser compat data with a LLM." Paul Kinlan | Sciencx - Accessed . https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/
IEEE
" » Querying browser compat data with a LLM." Paul Kinlan | Sciencx [Online]. Available: https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/. [Accessed: ]
rf:citation
» Querying browser compat data with a LLM | Paul Kinlan | Sciencx | https://www.scien.cx/2023/04/11/querying-browser-compat-data-with-a-llm/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.