flashtext
clownfish
flashtext | clownfish | |
---|---|---|
8 | 11 | |
5,535 | 302 | |
- | - | |
0.0 | 4.3 | |
6 months ago | 12 months ago | |
Python | Python | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
flashtext
-
Show HN: LLMs can generate valid JSON 100% of the time
I have some other comment on this thread where I point out why I don’t think it’s superficial. Would love to get your feedback on that if you feel like spending more time on this thread.
But it’s not obscure? FlashText was a somewhat popular paper at the time (2017) with a popular repo (https://github.com/vi3k6i5/flashtext). Their paper was pretty derivative of Aho-Corasick, which they cited. If you think they genuinely fucked up, leave an issue on their repo (I’m, maybe to your surprise lol, not the author).
Anyway, I’m not a fan of the whatabboutery here. I don’t think OG’s paper is up to snuff on its lit review - do you?
-
[P] what is the most efficient way to pattern matching word-to-word?
The library flashtext basically creates these tries based on keywords you give it.
-
What is the most efficient way to find substrings in strings?
Seems like https://github.com/vi3k6i5/flashtext would be better suited here.
-
[P] Library for end-to-end neural search pipelines
I started developing this tool after using haystack. Pipelines are easier to build with cherche because of the operators. Also, cherche offers FlashText, Lunr.py retrievers that are not available in Haystack and that I needed for the project I wanted to solve. Haystack is clearly more complete but I think also more complex to use.
-
How can I speed up thousands of re.subs()?
For the text part not requiring regex, https://github.com/vi3k6i5/flashtext might help
-
My first NLP pipeline using SpaCy: detect news headlines with company acquisitions
Spacy for parsing the Headlines, remove stop words etc. might be ok but I think the problem is quite narrow so a set of fixed regex searches might work quite well. If regex is too slow, try: https://github.com/vi3k6i5/flashtext
-
What tech do I need to learn to programmatically parse ingredients from a recipe?
I would probably use something like [flashtext](https://github.com/vi3k6i5/flashtext) which should not be too hard to port to kotlin.
- Quickest way to check that 14000 strings arent in An original string.
clownfish
-
Show HN: LLMs can generate valid JSON 100% of the time
I'm not sure how this is different than:
https://github.com/1rgs/jsonformer
or
https://github.com/newhouseb/clownfish
or
https://github.com/mkuchnik/relm
or
https://github.com/ggerganov/llama.cpp/pull/1773
or
https://github.com/Shopify/torch-grammar
Overall there are a ton of these logit based guidance systems, the reason they don't get tons of traction is the SOTA models are behind REST APIs that don't enable this fine-grained approach.
Those models perform so much better that people generally settle for just re-requesting until they get the correct format (and with GPT-4 that ends up being a fairly rare occurrence in my experience)
- OpenAI Function calling and API updates
-
Adding GPT to a web app. The real experience.
I can see some specific problems there, like malformed json (or json not matching intended schema being generated). Approaches like https://github.com/1rgs/jsonformer and https://github.com/newhouseb/clownfish could be interesting there, as well as approaches to validate outputs like https://medium.com/@markherhold/validating-json-patch-requests-44ca5981a7fc (references jsonpatch which could be interesting as well, but the approach is somewhat agnostic to how the changes actually get applied while still allowing you to enforce structure around what changes and how).
-
When you lose the ability to write, you also lose some of your ability to think
https://github.com/newhouseb/clownfish
Structural Alignment: Modifying Transformers (like GPT) to Follow a JSON Schema
- Clownfish: Constrained Decoding for LLMs Against JSON Schema
-
Jsonformer: A bulletproof way to generate structured output from LLMs
Oh nice! I built a similar system a few weeks ago: https://github.com/newhouseb/clownfish
I think the main differentiating factor here is that this is better if you have a simpler JSON schema without enums or oneOf constraints. If you do have these constraints, i.e. let's say you wanted an array of different types that represented a items on a menu { kind: pizza, toppings: [pepperoni] } or { kind: ice_cream, flavor: vanilla | strawberry } then you would need something more sophisticated like clownfish that can ask the LLM to pick specific properties.
-
Prompt injection: what’s the worst that can happen?
And on the other end, there's https://github.com/newhouseb/clownfish to force the model to produce structured output.
-
Teaching ChatGPT to Speak My Son’s Invented Language
It doesn't help with repetition, but when it comes to force structure on the output data, this approach looks interesting:
https://github.com/newhouseb/clownfish
TL;DR: it exploits the fact that the model returns probabilities for all the possible following tokens to enforce a JSON schema on the output as it is produced, backtracking as needed.
- Structural Alignment: Modifying Transformers (Like GPT) to Follow a JSON Schema
- Structural Alignment of LLMs with ControLogits
What are some alternatives?
KeyBERT - Minimal keyword extraction with BERT
jsonformer - A Bulletproof Way to Generate Structured JSON from Language Models
rake-nltk - Python implementation of the Rapid Automatic Keyword Extraction algorithm using NLTK.
lmql - A language for constraint-guided and efficient LLM programming.
magnitude - A fast, efficient universal vector embedding utility package.
outlines - Structured Text Generation
Optimus - :truck: Agile Data Preparation Workflows made easy with Pandas, Dask, cuDF, Dask-cuDF, Vaex and PySpark
evals - Evals is a framework for evaluating LLMs and LLM systems, and an open-source registry of benchmarks.
yake - Single-document unsupervised keyword extraction
ChatGPT_DAN - ChatGPT DAN, Jailbreaks prompt
gensim - Topic Modelling for Humans
kodumisto - GitHub Issue as ChatGPT Prompt; ChatGPT's Response as a Pull Request