I found that reducing html down to markdown using turndown or https://github.com/romansky/dom-to-semantic-markdown works well; if you want the AI to be able to select stuff, give it cheerio or jQuery access to navigate through the html document; if you need to give tags, classes, and ids to the llm, I use an html-to-pug converter like https://www.npmjs.com/package/html2pug which strips a lot of text and cuts costs. I…
Minifying HTML for GPT-4o: Remove all the HTML tags
41–50 of 52 posts
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#42We ingest your data wherever you point our crawlers and then clean it for work working in RAGs or chained LLMs.
One library we like a lot is Trafilatura [1]. It does a great job of taking the full HTML page and returning the most semantically relevant parts.
It works well for LLM work as well as generating embeddings for vectors and downstream things.
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#43One of my projects is a virtual agency of multiple LLMs for a variety of back-office services (copywriting, copy-editing, social media, job ads, etc). We ingest your data wherever you point our crawlers and then clean it for work working in RAGs or chained LLMs. One library we like a lot is Trafilatura [1]. It does a great job of taking the full HTML page and returning the most semantically relevant parts. It works w…
I use it nearly hourly for my HN summarizer HackYourNews (https://hackyournews.com).
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#44One of my projects is a virtual agency of multiple LLMs for a variety of back-office services (copywriting, copy-editing, social media, job ads, etc). We ingest your data wherever you point our crawlers and then clean it for work working in RAGs or chained LLMs. One library we like a lot is Trafilatura [1]. It does a great job of taking the full HTML page and returning the most semantically relevant parts. It works w…
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#45Earlier quoted context omitted.
Why do LLMs understand markdown really well? (besides the simple, terse and readable syntax of markdown) They say "LLMs are trained on the web", are the web pages converted from HTML into markdown before being fed into training?
I think it says in the Anthropic docs they use markdown internally (I assume that means were trained on it to a significant extent).
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#46In Elixir, I select the ` `, then remove all script and style tags. Then extract the text. This results in a kind of innerText you get in browsers, great and light to pass into LLMs. defp extract_inner_text(html) do html |> Floki.parse_document!() |> Floki.find("body") |> Floki.traverse_and_update(fn {tag, _attrs, _children} = _node when tag in ["script", "style"] -> nil node -> node end) |> Floki.text(sep: " ") |> S…
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#47I don't think that Mercury Prize table is a representative example because each column has an obviously unique structure that the LLM can key in on: (year) (Single Artist/Album pair) (List of Artist/Album pairs) (image) (citation link) I think a much better test would be something like "List of elements by atomic properties" [1] that has a lot of adjacent numbers in a similar range and overlapping first/last column t…
Good points. But I feel like even with the cities article it could still ‘cheat’ by recognising what the data is supposed to be and filling in the blanks. Does it even need to be real though? What about generating a fake article to use as a test so it can’t possibly recognise the contents? You could even get GPT to generate it, just give it the ‘Largest cities’ HTML and tell it to output identical HTML but with all t…
This isn't a good idea, if you want a fair test. See https://gwern.net/doc/reinforcement-learning/safe/2023-krako..., specifically https://arxiv.org/abs/1712.02950.
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#48I don't think that Mercury Prize table is a representative example because each column has an obviously unique structure that the LLM can key in on: (year) (Single Artist/Album pair) (List of Artist/Album pairs) (image) (citation link) I think a much better test would be something like "List of elements by atomic properties" [1] that has a lot of adjacent numbers in a similar range and overlapping first/last column t…
Additionally, using any Wiki page is misleading, as LLMs have seen their format many times during training, and can probably reproduce the original HTML from the stripped version fairly well. Instead, using some random, messy, scattered-with-spam site would be a much more realistic test environment.
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#49I’m curious. Scraping seems to come up a lot lately. What is everyone scraping? And why?
1. Pretain models with any legal, scraped content. That includes updating existing models with recent data.
2. Have our own private collection of pages we’ve looked at. Then, we can search them with a local engine.
Re: Minifying HTML for GPT-4o: Remove all the HTML tags
#50Earlier quoted context omitted.
Seems to be the most common method I've seen, it makes sense given how well LLMs understand markdown.
Why do LLMs understand markdown really well? (besides the simple, terse and readable syntax of markdown) They say "LLMs are trained on the web", are the web pages converted from HTML into markdown before being fed into training?