|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cryptocurrency News Articles
Redefining Generative AI: Embracing Structure for Enhanced Output Precision
Apr 19, 2024 at 08:06 am
Structured generative AI empowers generative AI models to generate outputs in specific formats. This approach prevents syntax errors by limiting token selection to valid options, ensuring executable queries and parsable data structures. Additionally, consistent tokenization of punctuation and keywords simplifies the patterns that models must learn, reducing training time and improving accuracy. By harnessing the knowledge of output structures, structured generative AI provides a powerful tool for translating natural language into various structured formats.

Redefining Generative AI: Embracing Structure for Enhanced Output Precision
Introduction
Generative AI, a transformative technology revolutionizing natural language processing, has made significant strides in generating coherent and grammatically sound text. However, when it comes to producing structured output, such as SQL queries or JSON data, generative AI often falters, succumbing to errors that hinder the execution or parsing of the generated code.
Enter Structured Generative AI
To overcome this limitation, we introduce the concept of "structured generative AI," a powerful technique that constrains the generative process within predefined formats, virtually eliminating syntax errors and ensuring the validity of the output. By leveraging the knowledge of the output language's structure, structured generative AI ensures that only legitimate tokens are considered during generation, effectively eliminating syntactical errors.
Mechanism of Token Generation
Generative AI models, such as transformer architectures, generate tokens sequentially, relying on the input and previously generated tokens to determine the next selection. At each step, a classifier assigns probability values to all tokens in the vocabulary, guiding the selection of the next token.
Constraining Token Generation
Structured generative AI incorporates knowledge of the output language's structure to limit token generation. Illegitimate tokens, such as incorrect punctuation or invalid keywords, have their probabilities set to infinity (negative infinity), effectively excluding them from consideration. For instance, if a valid SQL query requires a comma after "SELECT name," all other token probabilities are set to infinity, ensuring that only a comma can be selected.
Implementation with Hugging Face
Hugging Face, a leading provider of pretrained models and tools for natural language processing, offers a convenient way to implement structured generative AI through its "logits processor" feature. This feature allows users to define a custom function that modifies the token probabilities after they have been calculated but before the final selection is made.
Example: SQL Query Generation
To demonstrate the power of structured generative AI, let's consider the task of generating SQL queries from natural language. We initialize a pretrained BART model and define a set of rules that specify which tokens are allowed to follow each other in a valid SQL query.
rules = {'Using these rules, we create a logits processor that converts the rules into token IDs and modifies the token probabilities accordingly.
Results: Enhanced SQL Query Generation
Running the BART model with the logits processor yields significant improvements in the quality of generated SQL queries. The model now adheres to the predefined rules, producing syntactically correct queries that can be executed without errors.
to_translate = 'customers emails from the us'
words = to_translate.split()
tokenized_text = tokenizer([words], is_split_into_words=True, return_offsets_mapping=True)
logits_processor = LogitsProcessorList([SQLLogitsProcessor(tokenizer)])
out = pretrained_model.generate(
torch.tensor(tokenized_text["input_ids"]),
max_new_tokens=20,
logits_processor=logits_processor)The Significance of Tokenization
Tokenization, the process of converting text into a sequence of tokens, plays a crucial role in structured generative AI. Consistent tokenization ensures that similar concepts and punctuation are represented by the same token, simplifying the model's learning process. For instance, adding spaces before words and punctuation enhances consistency and reduces the complexity of patterns that the model needs to learn.
Applications of Structured Generative AI
The applications of structured generative AI extend far beyond SQL query generation. It empowers various tasks, including:
- JSON Data Extraction: Generating structured JSON data from natural language, enabling seamless data parsing and storage.
- Query Generation: Creating executable queries for various database systems, facilitating efficient information retrieval.
- Code Generation: Producing valid code snippets in different programming languages, accelerating software development.
Conclusion
Structured generative AI is a groundbreaking technique that dramatically enhances the precision and applicability of generative AI models. By incorporating knowledge of the output language's structure, structured generative AI eliminates syntax errors and guarantees the executability of generated code. This breakthrough enables a wide range of applications, empowering users to extract information, generate queries, and produce code more efficiently and accurately.
Disclaimer:info@kdj.com
The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!
If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.
-
- Strive's Soaring Bitcoin Treasury: A New York State of Mind for Corporate Crypto
- Sep 22, 2026 at 08:05 am
- Strive continues its robust accumulation of Bitcoin, showcasing a clear strategy for corporate treasury management in the digital age. This move highlights a growing trend among companies embracing crypto as a core asset.
-
- Apple and Google Tap Stablecoin Experts, Signaling a Major Shift in Crypto Payments Strategy
- Sep 22, 2026 at 04:05 am
- Tech giants Apple and Google are actively hiring stablecoin and blockchain specialists, signaling a significant evolution in their approach to crypto payments and financial infrastructure.
-
-
- U.S. Treasury Slams Iranian Exchange BitBank with Sanctions Over Alleged IRGC Bitcoin Transfers
- Sep 21, 2026 at 04:05 am
- The U.S. Treasury Department has sanctioned Iranian crypto exchange BitBank, alleging its involvement in funneling Bitcoin to the IRGC. This action tightens the noose on Iran's digital asset infrastructure.
-
- Crypto Crossroads: Best Crypto to Buy Amidst SEC Regulation & the Rise of Pepeto
- Sep 21, 2026 at 04:05 am
- Amidst evolving SEC regulations, a new player, Pepeto, emerges as a potential 'best crypto to buy', offering innovative tools and early-bird opportunities, contrasting with established giants and fading meme coins.
-
-
- One Attacker, Multiple Tokens: Inside the Fetch.ai Breach - A New York Minute
- Sep 20, 2026 at 08:05 pm
- The Fetch.ai breach, initially thought to be a $1.5M FET token theft, has ballooned into a multi-token saga involving NTX, AGIX, and WMTX, with total attacker holdings now topping $17M. This incident highlights the critical difference between stolen and newly minted tokens, revealing deeper security implications beyond initial financial losses.
-
-
- Bitcoin, Altcoins, & Crypto-currency: A Market Surge Driven by Regulation and Innovation, Not Just Memes
- Sep 20, 2026 at 08:05 pm
- Bitcoin's unexpected leap past $80,000 ignited a broader crypto rally, fueled by shrewd regulatory moves and a distinct shift towards altcoins with genuine utility and revenue streams. This isn't your grandma's crypto market anymore.

































