[HN Gopher] Vectorizing the Code of Federal Regulations
___________________________________________________________________
Vectorizing the Code of Federal Regulations
Author : gk1
Score : 57 points
Date : 2022-03-16 16:36 UTC (6 hours ago)
(HTM) web link (max.io)
(TXT) w3m dump (max.io)
| leobg wrote:
| Cool project!
|
| Do you have a working search demo people can try?
| binarymax wrote:
| working on it ;)
| TuringNYC wrote:
| Thanks for this. We've been doing something similar with the
| Universal Sentence Encoder en masse
| (https://www.tensorflow.org/hub/tutorials/semantic_similarity...)
|
| Curious if anyone has recommendations on good stashes or datasets
| of already-encoded embeddings? This sounds geeky but to some
| extent, I dont even "care" about the original text but would love
| to just get the embedding vectors and play with those.
| binarymax wrote:
| BEIR is what you're looking for :). There should be stashes of
| vectors for the datasets floating around.
|
| https://paperswithcode.com/paper/beir-a-heterogenous-benchma...
| gennarro wrote:
| Have seen many attempts to work with the dataset! It's a fun
| challenge. https://ecfr.report and ecfr.io come to mind, but .gov
| is still the best.
| RicoElectrico wrote:
| If anybody was confused by the title:
|
| Vectorizing usually refers to compilers (or people) re-writing
| code taking advantage of vector instructions (like AVX, SSE).
|
| What the author did is more commonly reffered to as embedding by
| the ML community.
|
| So, a better title would be: Generating embeddings for the Code
| of Federal Regulations.
| binarymax wrote:
| Actually it does both :)
|
| Mighty is built in Rust with avx turned on. But I get your
| point. I kinda dislike the name embeddings. It's super niche,
| and not easy to explain to most people I talk to that aren't
| working in ML. I always arrive at saying "well, embeddings are
| a vector...". So this saves a step.
|
| Many more people know what a vector is, if they have some
| college math experience.
| trhway wrote:
| >But if you don't know how to work in this hierarchy, it is
| difficult to find information. Also, if you don't know the
| specific keyword "Enrollee", you will spend a long time trying to
| find what you need. Contemporary search now uses dense vectors
| that embed language meaning, so recall is much more robust.
|
| One more situation where raw power of hardware - building the
| vectors in this case - beats the old "knowledge engineering"
| approach as previously one would use ontology to get generalized
| term and siblings for the user's search term.
| binarymax wrote:
| Hi all, author here! My submission fell of the new page after 5
| minutes sometime this morning and really glad to see it get re-
| posted.
|
| AMA!
| Gollapalli wrote:
| I think vectorizing and eventually algorithmizing federal
| regulations is important work and will be important for outcome
| driven federal policy, and I'm glad that you're doing it.
| binarymax wrote:
| Thanks! I hope newcomers see the importance, beauty, and
| complexity of the dataset and run with it as well. The more
| interested the better. "Augmented Federal Register" would be
| of real help for better crafting final rules as well - which
| is another area I'm looking into - as FR is truly organic.
| KarlKemp wrote:
| It's completely impossible without strong AI.
|
| As but one example: contracts often include the phrase "a
| reasonable effort".
|
| Here's a definition: "Reasonable Efforts means, with respect
| to a given goal, the efforts that a reasonable person in the
| position of the promisor would use so as to achieve that goal
| as expeditiously as possible"
|
| Try defining that in an algorithm!
| binarymax wrote:
| I don't think full-automation would even be a goal - not
| when crafting laws for humans!
|
| But perhaps better tools can be built to make the process
| more efficient, less biased, and less redundant.
| bluetwo wrote:
| I have worked with eCFR and have thought about some ideas for
| processing large sections and how it might be useful.
|
| What are your larger plans here? Do you have an interface in
| mind for searching or organizing things?
| binarymax wrote:
| Oh yeah I could tinker forever, it's an amazing dataset that
| I think needs more attention from the ML community. Glad to
| see the working team at https://www.ecfr.gov/ finally making
| their search better, as Cornell Law has been the defacto go
| to forever (for me at least).
|
| I think an amazing eCFR search experiment would be
| transformer vectors in a graph, using the hierarchy,
| citations, and references as edges to (sub)paragraph and
| section nodes - perhaps even using a modified HNSW somehow.
| The graph that exists there now isn't leveraged enough.
|
| Per this dataset itself, I already output to Vespa formatted
| JSON (as noted in https://github.com/maxdotio/ecfr-prepare
| )...and the resulting vectors from the inference get appended
| to the original JSON doc as a field.
|
| I have a Vespa schema hat I need to upload (that doesnt
| include the vector field yet but can be added using the Vespa
| vector search walkthroughs). It's been a busy day but I'll
| quickly try to find a place to put it for now :)
|
| --EDIT-- Pushed the schema to the above repo, and some bash.
| You'll need Docker and to follow the Vespa MSMARCO
| instructions first at
| https://docs.vespa.ai/en/tutorials/text-search-semantic.html
| to get used to the engine.
___________________________________________________________________
(page generated 2022-03-16 23:01 UTC)