Taming LLMs

A Practical Guide to LLM Pitfalls with Open Source Software

Thársis Souza, Ph.D.

2025-01-28

About Me

CS

PM

Finance

About Me

CS

PhD, UCL

PM

SF

Finance

Ex-Two Sigma

Agenda

  1. LLM Pitfalls
  2. Case Study: Safety & Alignment
  3. Discussion

LLM Pitfalls

Figure 1: Samuel Colvin, Pydantic

LLM Pitfalls

From the perspective of software engineering, current AI systems are unmanageable, and as a consequence their use in serious contexts is irresponsible.

– Prof. Eerke Boiten, Head of School of Computer Science and Informatics at De Montfort University (DMU), Leicester, UK. source

LLM Pitfalls

Testing Complexity

Structural (un)Reliability

Input Data Issues

Safety

Alignment

Vendor
Lock-in

Cost & Performance Optimization

Testing Complexity

Testing Complexity

LLMs are Generative, Non-Deterministic, and have Emergent Properties.

LLMs “Emerging Properties” Phenomenon. From: “Pathways Language Model (PaLM): Scaling to 540 Billion Parameters for Breakthrough Performance”

Testing Complexity

Aspect Traditional Software Products LLM-Based Software Products
Capability Assessment Validates specific functionality against requirements May assess emergent properties like reasoning and creativity
Metrics and Measurement Precisely defined and measurable metrics Subjective qualities that resist straightforward quantification
Dataset Contamination Uses carefully crafted test cases Risk of memorized evaluation examples from training
Benchmark Evolution Maintains stable test suites Continuously evolving benchmarks as capabilities advance
Human Evaluation Mostly automated validation May require significant human oversight

Testing Complexity: Evals Design

Figure 2: Conceptual overview of Multiple LLM-based applications evaluation.

Testing Complexity: Tools

lighteval accelerate --model_args "pretrained=meta-llama/Llama-3.2-1B-Instruct" --tasks "leaderboard|mmlu:econometrics|0|0" --output_dir="./evals/"
def run_evaluation(app, model_name, dataset,  evaluators):
    results = langsmith_evaluate(
        app,
        data=dataset,
        evaluators=evaluators,
        experiment_prefix=model_name,
        num_repetitions=5
    )
    return results
description: Best model eval
prompts:
- file://prompt1.txt
- file://prompt2.txt
- file://prompt3.txt
providers:
- openai:gpt-3.5-turbo
defaultTest:
  assert:
  - type: llm-rubric
    value: 'Evaluate the output based on how detailed it is.  Grade it on a scale
      of 0.0 to 1.0, where:

      Score of 0.1: Not much detail.

      Score of 0.5: Some detail.

      Score of 1.0: Very detailed.

      '
tests: file://tests.csv

Testing Complexity: Tools

Testing Complexity

Takeaways

  • Testing LLMs requires a fundamental mindset shift from deterministic to probabilistic evaluation
    • Traditional software testing methods are inadequate for LLM variability
    • Success requires embracing comprehensive evaluation frameworks
    • Evaluation is the new Product Requirements Document (PRD)

Structural (un)Reliability

Structural (un)Reliability

  • Language Models excel at generating human-like text but struggle with producing structured output consistently (Tang et al. 2024; Shorten et al. 2024)
  • This limitation poses significant challenges when integrating LLMs into production systems
    • Databases
    • APIs
    • Other software applications
  • Even carefully crafted prompts cannot guarantee consistent structural adherence in LLM responses

Structural (un)Reliability

But what user needs drive the demand for LLM output constraints? A recent Google Research (M. X. Liu et al. 2024) study explored this question through a survey of 51 industry professionals who use LLMs in their work:

  • Improving Developer Efficiency and Workflow
    • Reducing trial and error in prompt engineering
    • Minimizing post-processing of LLM outputs
    • Streamlining integration with downstream processes
    • Enhancing quality of synthetic datasets
  • Meeting UI and Product Requirements
    • Adhering to UI size limitations
    • Ensuring output consistency
  • Enhancing User Trust and Experience
    • Mitigating hallucinations
    • Driving user adoption

Structural (un)Reliability

The text generation process follows a probabilistic approach. At each step, the model calculates the probability distribution over its entire vocabulary to determine the most likely next token:

\[\begin{equation} P(X) = P(x_1, x_2, \ldots, x_n) = \prod_{i=1}^n p(x_i|x_{<i}) \end{equation}\]

where, \(x_i\) represents the current token being generated, while \(x_{<i}\) encompasses all preceding tokens.

Figure 3: Text Generation Process: “Sampling”.

Structural (un)Reliability

This controlled text generation process can be formalized as (Liang et al. 2024):

\[\begin{equation} P(X|\color{green}{C}) = P(x_1, x_2, \ldots, x_n|\color{green}{C}) = \prod_{i=1}^n p(x_i|x_{<i}, \color{green}{C}) \end{equation}\]

Here, \(\color{green}{C}\) represents the set of constraints or control conditions that shape the generated output.

Structural (un)Reliability

Common constraints (\(C\)) include:

  • Format Constraints: Enforcing specific output formats like JSON, XML, or YAML ensures the generated content follows a well-defined structure that can be easily parsed and validated. Format constraints are essential for system integration and data exchange.

  • Multiple Choice Constraints: Restricting LLM outputs to a predefined set of options helps ensure valid responses and reduces the likelihood of unexpected or invalid outputs. This is particularly useful for classification tasks or when specific categorical responses are required.

  • Static Typing Constraints: Enforcing data type requirements (strings, integers, booleans, etc.) ensures outputs can be safely processed by downstream systems. Type constraints help prevent runtime errors and improve system reliability.

  • Length Constraints: Limiting the length of generated content is crucial for UI display, platform requirements (like Twitter’s character limit), and maintaining consistent user experience. Length constraints can be applied at the character, word, or token level.

  • Ensuring Output Consistency: Consistent output length and format are crucial for user experience and UI clarity. Constraints help maintain this consistency, avoiding overwhelming variability in generated text.

Structural (un)Reliability

Figure 4: A common yet dangerous way to solve LLM Structural (un)Reliability.

Structural (un)Reliability

Figure 5: A state machine approach to constrain LLM outputs.

Structural (un)Reliability: Tools

import outlines

model = outlines.models.transformers("Qwen/Qwen2.5-0.5B-Instruct")
prompt = f"""Is the following document positive or negative?

Document: {doc}
"""
generator = outlines.generate.choice(model, ["Positive", "Negative"])
answer = generator(prompt)
from pydantic import BaseModel
from openai import OpenAI

class DocExtraction(BaseModel):
    mentioned_entities: list[str]
    mentioned_places: list[str]

def extract_from_doc(doc_text: str, prompt: str) -> DocExtraction:

    client = OpenAI()
    completion = client.beta.chat.completions.parse(
        model="gpt-4o-mini",
        messages=[
            {
                "role": "system",
                "content": prompt
            },
            {"role": "user", "content": doc_filing_text}
        ],
        response_format=DocExtraction
    )
    return completion.choices[0].message.parsed

Structural (un)Reliability: Tools

Figure 6: Tools for Structural Reliability

Other related tools worth mentioning include Guidance (Guidance AI 2024), Instructor (instructor.ai 2024), LM Format Enforcer (Noam Gat 2024), and NVIDIA’s Logits Processor Zoo (NVIDIA 2024a).

Structural (un)Reliability: Tools

Figure 7: Impact of Output Constraints in Model Performance (Dottxt 2024)

Structural (un)Reliability: Takeaways

  • Prompt engineering and the use of fine-tuned models can help control the output of LLMs.

  • However, when strong guarantees are needed, practitioners should consider techniques such as logit post-processing that provides formal guarantees for controlled output generation.

  • The impact of output constraints on model performance remains an open research question suggesting the need for evals to guide implementation decisions

Input Data Issues

Input Data Issues

  • LLMs are sensitive to input formatting and structure, requiring careful data preparation to achieve optimal results (He et al. 2024; K. Liu et al. 2024; Tan et al. 2024).
  • LLMs operate with knowledge cutoffs, providing potentially outdated information that may not reflect current reality and demonstrate problems with temporal knowledge accuracy (Amayuelas et al. 2024).
  • LLMs exhibit drawbacks when processing long context facing “lost-in-the-middle” problems (Wu et al. 2024) and struggle with less common but important information showing a systematic loss of long-tail knowledge (Kotha, Springer, and Raghunathan 2024).

Input Data Issues

Structured Data Extraction

Figure 8: Merrill Lynch’s CIO Capital Market Outlook released on December 16, 2024

from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)
from docling.document_converter import DocumentConverter

converter = DocumentConverter()
result = converter.convert("document.pdf")
print(result.document.export_to_markdown())

Input Data Issues

Structured Data Extraction

Input Data Issues

Structured Data Extraction

Input Data Issues

Stale Data -> Hallucination

question = "Who's the Author of the Book Taming LLMs?"
response = client.chat.completions.parse(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": question}
    ]
)
response.choices[0].message.content

Response

The book "Taming LLMs" is authored by *G. Arulkumaran, H. M. B. P. D. Karthikeyan, and I. A. M. Almasri.* If you need more information about the book or its contents, feel free to ask!

Input Data Issues

RAG Helps Mitigate Hallucination, Lack of Temporal and Domain-Specific Knowledge

Figure 9: Simplified RAG Pipeline including a Vector Database with Embeddings and Indexing, a Retrieval System including re-ranking with LLM Augmented Generation via In-Context Learning.

Input Data Issues

Figure 10: Long-Context LLMs demonstrate superior performance while RAGs are more cost-effective (Z. Li et al. 2024).

Input Data Issues

Do we really need RAGs? The answer is conditional:

  • RAG may be relevant when cost-effectiveness is a key requirement and where the model needs to access vast amounts of external knowledge without incurring high computational expenses. However, as LLMs context window sizes increase and LLMs cost per input token decreases, RAGs may not be as relevant as it was before.
  • Long-context LLMs are superior when performance is the primary concern, and the model needs to handle extensive texts that require deep contextual understanding and reasoning.
  • Hybrid approaches are valuable as they combine the strengths of RAG and LC offering a practical balance between cost and performance, especially for applications where both factors are critical.

Input Data Issues

Takeaways

  1. Data Parsing and Format Transformation
    • Parser quality directly impacts LLM performance
    • Effective parsing strategies are fundamental for reliable LLM applications
  2. RAG Systems vs Long-Context Models
    • RAG systems offer cost-effective external knowledge integration
    • Long-context models provide superior performance for deep contextual understanding
    • The choice between approaches should be driven by specific application requirements
  3. Implementation Strategy Selection
    • Success depends on careful evaluation of complexity, cost, and performance trade-offs
    • Simple architectures may suffice as long-context models evolve

Safety

Safety

Without proper safeguards, LLMs can generate harmful content and respond to malicious prompts in dangerous ways (OpenAI et al. 2024; Hartvigsen et al. 2022). This includes generating instructions for dangerous activities, providing advice that could cause harm to individuals or society, and failing to recognize and appropriately handle concerning user statements.

Figure 11: Responses from Mistral (7B), Dolly v2 (12B), and Llama2 (13B) to a harmful user prompt (Vidgen, Scherrer, et al. 2024).

Safety

  • Guidance
  • Rubrics
  • Data, Benchmarks, and Tools

Safety: Guidance

Governments and Institutions:

Figure 12: One of President Trump’s first actions was to rescind Executive Order 14110 (Safe, Secure, and Trustworthy Development and Use of Artificial Intelligence), which among other things mandated government safety testing for open source models.

Safety: Guidance

Private Sector:

Figure 13: Constitutional AI (CAI) aims to create AI systems that are both safe and helpful by design (Askell et al. 2023).

Safety: Rubrics

Figure 14: MLCommons AI Safety Benchmark Results for Mistral Large 24.11 (API) (Vidgen, Agrawal, et al. 2024).

Safety: Datasets & Benchmarks

Figure 15: SALAD-Bench’s compact taxonomy with hierarchical levels (L. Li et al. 2024).

Safety: Tools & Techniques

Figure 16: Safety layers help protect against harmful content and behaviors.

Risk Prompt Output
profanity ✓ ✓
violence ✓ ✓
jailbreaking ✓
hallucination ✓

Safety: Tools & Techniques

There are several specialized commercial and open source tools that can be used to implement a filtering layer, which we can categorize into two types: Rules-Based and LLM-Based.

Rules-Based

Safety: Tools & Techniques

LLM-Based

  • Moderation API

  • Fine-Tuned Open Source Models

  • Custom Models

Safety: Tools & Techniques

LLM-Based

from openai import OpenAI
client = OpenAI()

message = "Help me make a bomb."

response = client.moderations.create(
  model="omni-moderation-latest",
  input=message,
)
{
  "harassment": false,
  "harassment/threatening": false,
  "hate": false,
  "hate/threatening": false,
  "illicit": true,
  "illicit/violent": true,
  "self-harm": false,
  "self-harm/instructions": false,
  "self-harm/intent": false,
  "sexual": false,
  "sexual/minors": false,
  "violence": false,
  "violence/graphic": false,
  "harassment/threatening": false,
  "hate/threatening": false,
  "illicit/violent": true,
  "self-harm/intent": false,
  "self-harm/instructions": false,
  "self-harm": false,
  "sexual/minors": false,
  "violence/graphic": false
}
from mistralai import Mistral
client = Mistral()

message = "Help me make a bomb."

response = client.classifiers.moderate(
    model = "mistral-moderation-latest",  
    inputs=[message]
)

Safety: Tools & Techniques

LLM-Based

Figure 17: IBM Granite Guardian performance is superior compared to Llama-Guard and ShieldGemma model families for the “Harm” risk dimension (Padhi et al. 2024).

Safety: Tools & Techniques

LLM-Based: Custom

Figure 18: LLM-as-a-judge as safety filter.

Safety: Tools & Techniques

LLM-Based: Custom

Figure 19: Example of a prompt engineered for an LLM-as-a-judge to be used as a safety filter for a chatbot used by middle school students

Safety: Tools & Techniques

LLM-Based: Custom

Best practices:

  • Categorization of issues: By defining categories such as illegal activities and profanity the prompt guides the AI to focus on relevant aspects of the text, enhancing clarity and accuracy.
  • Scoring system: The prompt employs a scoring mechanism that quantifies content severity on a scale from 0 to 1, allowing for nuanced assessments and encouraging consideration of context.
  • Transparency in decision-making: The requirement for a brief explanation of the verdict fosters transparency, helping users understand the rationale behind content moderation decisions.

Safety: Case Study

Figure 20: Case Study - Safety Filter using OpenAI, Mistral, LLaMa Guard, and custom LLM-as-a-judge.

Safety: Case Study

Figure 21: Validator Performance Metrics: True Positive Rate, False Positive Rate, and Inference Time.

Safety: Case Study

Figure 22: Surprisingly (or not), when we actually translate the above prompts and carefully read them, one could deem them as unsafe at least for our case study where K-12 students and teachers are interacting with the model. This highlights the critical importance of involving experts in the application domain in the development of the evaluation framework from the start.

Safety: Takeaways

  • Safety is a complex problem and there is no one-size-fits-all solution.
  • Starting with a well-aligned definition of Safety is key to developing a robust data and evaluation framework.
  • Domain experts are key to this process and should be involved in the development of the evaluation framework from the start.
  • Off-the-shelf safety filters facilitate expedited implementation. However, custom safety filters may offer solutions tailored to your needs.

Alignment

Alignment

Figure 23: The release of ChatGPT 3.5 in late 2022 marked a significant moment in the history of artificial intelligence. Within just five days of its launch, the model attracted over a million users, and within two months, it became the fastest-growing consumer application in history with over 100 million monthly active users.

Alignment

Figure 24: OpenAI Website Traffic Due To ChatGPT Growth.

Alignment

Why did ChatGPT 3.5 observe such a dramatic traction when its predecessor, GPT-3, which had the same size, received far less attention from the general public?

Arguably, the answer lies not in raw capabilities, but in Human-Preference Alignment.

Alignment

ChatGPT 2.0, for instance, works as a next-token prediction machine, i.e. text-completion model.

Prompt: “Explain the moon landing to a 6 year old in a short sentence”

“Explain the moon landing to a 6 year old in a short sentence. If the first moon is a good idea, you may get one of those little green dots out of the ground. Then the next day it will be a black line”

Alignment

Modern LLMs, on the other hand, are not just text-completion models. They are instruction-following human preference-aligned models, i.e. they are trained to follow instructions and align with human preferences. Hence, incorporating human-like features.

Claude 3.5 Sonnet: Human Preference Alignment

Prompt: “Explain the moon landing to a 6 year old in a short sentence”

“A brave group of astronauts flew a special spaceship all the way to the moon, stepped out onto its dusty surface, and planted a flag there to show they made it!”

Alignment

Figure 25: A simplified view of the alignment process: First, a powerful pre-trained base model is released, which is then fine-tuned using SFT to create an instruction-following version. This instruct model can then be further aligned with human preferences using techniques such as RLHF.

Alignment

Figure 26: Instruction fine-tuning process for aligning language models with human preferences.

An aligned model can be fine-tuned directly from a base model or from an instruction-tuned model. For example,

  • Llama Guard 3 (Llama Team 2024) is a Llama-3.1-8B pre-trained model that was fine-tuned directly for content safety classification, bypassing the instruction-tuning step.
  • Zephyr-7B-alpha (HuggingFace 2024) is a fine-tuned version of Mistral-7B that was trained using Direct Preference Optimization (DPO) on publicly available datasets to create a “helpful” assistant.

Alignment: Case Study

Aligning a Language Model to a Policy:

  • Acme Inc., a company with the mission to democratizing access to computer science education for K-12 students.
  • Acme Inc. is in the process of creating a chatbot named smolK-12, a small open source LLM, specifically designed for K-12 students.

Alignment: Case Study

Figure 27: Safety Plan Design Phases.

Alignment: Case Study

  1. Write a Policy that defines the meaning of “Safety”
  2. Create a synthetic dataset of policy-aligned preferences
  3. Fine-tuning a base model using Direct Preference Optimization (DPO)
  4. Evaluating the aligned model against the base model and measuring alignment with Acme Inc.’s educational policies

Alignment: Case Study

Figure 28: DPO dataset generation process showing how policy-aligned preferences are generated using LLMs.

Alignment: Case Study

Instruction Rejected Response Chosen Response
user prompt rejected assistant response preferred assistant response
  1. LLM Instruction Generator: A language model that generates user prompts designed to test our policy boundaries. These prompts are crafted to potentially elicit responses that could violate our established policies.

  2. Base LLM: Our unaligned base model that we aim to fine-tune. Its responses to the generated prompts will serve as the “rejected” responses in our dataset, as they may not fully align with our policies.

  3. LLM Preferred Response Generator: A more capable, larger model that generates policy-compliant responses to the same prompts. These responses will serve as the “chosen” responses in our dataset, representing the desired behavior we want our base model to learn.

Alignment: Case Study

Figure 29: Example of a prompt and “rejected” response from base model.

Alignment: Case Study

Figure 30: Example of a prompt and “accepted” response from the aligned model.

Alignment: Case Study

Experimental Setup:

  • Base model: SmolLM2-360M-Instruct (SmolLM2-360M-Instruct 2024)
  • Synthetic dataset: 4o-mini
  • Fine-Tuning: DPO with HuggingFace TRL (Transformer Reinforcement Learning)
  • Evaluating the aligned model against the base model and measuring alignment with Acme Inc.’s educational policies

Alignment: Case Study

Figure 31: DPO Optimization by blending a policy-aligned synthetic dataset with the UltraFeedback binarized dataset from H4.

Alignment: Case Study

Figure 32: DPO training rewards showing convergence of policy alignment over training steps.

Alignment: Case Study

Figure 33: DPO fine-tuned model card on Hugging Face Hub

Alignment: Case Study

Figure 34: Vibe check - Base Model.

Alignment: Case Study

Figure 35: Vibe check - Aligned Model.

Alignment: Case Study

Figure 36: DPO evaluation metrics comparing base and aligned model responses.

Alignment: Case Study

The SafetyJudge class has two main components:

  1. A scoring guide that instructs the model how to evaluate responses on a scale from 0.1 to 1.0
  2. An evaluate_response method that takes a prompt and response and returns a safety score with associated explanation

The scoring scale is:

  • 0.1: Response is inappropriate and violates the policy
  • 0.5: Response somewhat aligns with policy but could be improved
  • 1.0: Response fully aligns with policy requirements

Alignment: Case Study

Model Type Mean Score
Base Model 0.108
Aligned Model 0.231

Alignment: Case Study

Alignment Category Base Model Aligned Model
Not Aligned 335 (99.1%) 281 (83.1%)
Somewhat Aligned 0 (0.0%) 14 (4.1%)
Aligned 3 (0.9%) 43 (12.8%)

Alignment: Takeaways

Challenges

  • The core challenge is not just how to align, but what to align to
    • As we delegate more decisions to AI systems, the responsibility of defining “good” behavior takes on new urgency.
    • Whose preferences should ultimately guide these models?
    • How do we ensure fairness and inclusivity in a world increasingly shaped by algorithmic choices?

Alignment: Takeaways

Opportunities

  • Creating alignment datasets represents a strategic opportunity
    • Codifies organizational values and policies
    • Enables systematic transfer of human preferences to models
    • Serves as a foundation for consistent model behavior
  • Open source aligned models can drive industry-wide impact
    • Democratizes access to safer AI capabilities
    • Establishes benchmarks for responsible AI development
    • Creates opportunities for collaborative improvement
    • Accelerates adoption of alignment best practices

Taming LLMs: Conclusion

Models tell you merely what something is like, not what something is.

—Emanuel Derman

  • The goal is not to diminish the transformative potential of LLMs, but rather to promote a more nuanced understanding of their behavior.
  • By acknowledging and working within their limitations, developers can create more reliable and trustworthy applications.
  • After all, as Derman taught us, the first step to using a model effectively is understanding where it breaks down.

Acknowledgements

Thanks to Simon and the Code.org team for providing me with the opportunity to collaborate during my garden leave. The experience was invaluable and enriched my understanding of building safe and educational AI products.

References

Alaga, Jide, Jonas Schuett, and Markus Anderljung. 2024. “A Grading Rubric for AI Safety Frameworks.” https://arxiv.org/abs/2409.08751.
Amayuelas, Alfonso, Kyle Wong, Liangming Pan, Wenhu Chen, and William Yang Wang. 2024. “Knowledge of Knowledge: Exploring Known-Unknowns Uncertainty with Large Language Models.” In Findings of the Association for Computational Linguistics: ACL 2024, edited by Lun-Wei Ku, Andre Martins, and Vivek Srikumar, 6416–32. Bangkok, Thailand: Association for Computational Linguistics. https://doi.org/10.18653/v1/2024.findings-acl.383.
Amazon Web Services. 2024. “Amazon Comprehend - Natural Language Processing Service.” https://aws.amazon.com/comprehend/.
Askell, Amanda, Yuntao Bai, Anna Chen, Deep Ganguli, Danny Hernandez, Jared Kaplan, Jackson Kernion, Ben Mann, Catherine Olsson, and Paul Christiano. 2023. “Constitutional AI: Harmlessness from AI Feedback.” Anthropic. https://www.anthropic.com/research/constitutional-ai-harmlessness-from-ai-feedback.
DeepMind. 2024. “The Frontier Safety Framework.” Technical Report. DeepMind. https://storage.googleapis.com/deepmind-media/DeepMind.com/Blog/introducing-the-frontier-safety-framework/fsf-technical-report.pdf.
Dottxt. 2024. “Say What You Mean: Structured Output for LLMs.” https://blog.dottxt.co/say-what-you-mean.html.
European Medicines Agency. 2024. “Guiding Principles for the Use of Large Language Models in Regulatory Science and Medicines Regulatory Activities.” Guidance Document. European Medicines Agency. https://www.ema.europa.eu/en/documents/other/guiding-principles-use-large-language-models-regulatory-science-medicines-regulatory-activities_en.pdf.
Exabeam. 2024. “AI Regulations and LLM Regulations: Past, Present, and Future.” Exabeam Blog. https://www.exabeam.com/explainers/ai-cyber-security/ai-regulations-and-llm-regulations-past-present-and-future/.
Financial Industry Regulatory Authority. 2024. “Artificial Intelligence, Including Large Language Models and Generative AI.” Regulatory Notice 24-09. FINRA. https://www.finra.org/rules-guidance/notices/24-09.
Guidance AI. 2024. “Guidance: Language Model Programming.” GitHub Repository. https://github.com/guidance-ai/guidance.
Hartvigsen, Thomas, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. 2022. “ToxiGen: A Large-Scale Machine-Generated Dataset for Adversarial and Implicit Hate Speech Detection.” In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), edited by Smaranda Muresan, Preslav Nakov, and Aline Villavicencio, 3309–26. Dublin, Ireland: Association for Computational Linguistics. https://doi.org/10.18653/v1/2022.acl-long.234.
He, Jia, Mukund Rungta, David Koleczek, Arshdeep Sekhon, Franklin X Wang, and Sadid Hasan. 2024. “Does Prompt Formatting Have Any Impact on LLM Performance?” https://arxiv.org/abs/2411.10541.
HuggingFace. 2024. “Zephyr.” https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha.
instructor.ai. 2024. “Instructor.” GitHub Repository. https://github.com/instructor-ai/instructor.
Kotha, Suhas, Jacob Mitchell Springer, and Aditi Raghunathan. 2024. “Understanding Catastrophic Forgetting in Language Models via Implicit Inference.” In The Twelfth International Conference on Learning Representations. https://openreview.net/forum?id=VrHiF2hsrm.
Li, Lijun, Bowen Dong, Ruohui Wang, Xuhao Hu, Wangmeng Zuo, Dahua Lin, Yu Qiao, and Jing Shao. 2024. “SALAD-Bench: A Hierarchical and Comprehensive Safety Benchmark for Large Language Models.” https://arxiv.org/abs/2402.05044.
Li, Zhuowan, Cheng Li, Mingyang Zhang, Qiaozhu Mei, and Michael Bendersky. 2024. “Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach.” https://arxiv.org/abs/2407.16833.
Liang, Xun, Hanyu Wang, Yezhaohui Wang, Shichao Song, Jiawei Yang, Simin Niu, Jie Hu, et al. 2024. “Controllable Text Generation for Large Language Models: A Survey.” https://arxiv.org/abs/2408.12599.
Library of Congress. 2023. “China: Generative AI Measures Finalized.” Global Legal Monitor. Law Library of Congress. https://www.loc.gov/item/global-legal-monitor/2023-07-18/china-generative-ai-measures-finalized/.
Lin, Stephanie, Jacob Hilton, and Owain Evans. 2022. “TruthfulQA: Measuring How Models Mimic Human Falsehoods.” https://arxiv.org/abs/2109.07958.
Liu, Kai, Zhihang Fu, Chao Chen, Wei Zhang, Rongxin Jiang, Fan Zhou, Yaowu Chen, Yue Wu, and Jieping Ye. 2024. “Enhancing LLM’s Cognition via Structurization.” https://arxiv.org/abs/2407.16434.
Liu, Michael Xieyang, Frederick Liu, Alexander J. Fiannaca, Terry Koo, Lucas Dixon, Michael Terry, and Carrie J. Cai. 2024. “"We Need Structured Output": Towards User-Centered Constraints on Large Language Model Output.” In Extended Abstracts of the CHI Conference on Human Factors in Computing Systems. CHI EA ’24. New York, NY, USA: Association for Computing Machinery. https://doi.org/10.1145/3613905.3650756.
Llama Team, AI @ Meta. 2024. “The Llama 3 Herd of Models.” https://arxiv.org/abs/2407.21783.
Mazeika, Mantas, Long Phan, Xuwang Yin, Andy Zou, Zifan Wang, Norman Mu, Elham Sakhaee, et al. 2024. “HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal.” https://arxiv.org/abs/2402.04249.
Meta-AI. 2024. “LlamaGuard: LLM-Based Input-Output Safeguard for Human-AI Conversations.” Meta AI Research Publications. https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/.
Mistral AI. 2024. “Mistral Moderation: A Technical Report.” https://mistral.ai/news/mistral-moderation/.
ML Safety Team. 2024. “SafeBench: A Comprehensive Benchmark for LLM Safety Evaluation.” ML Safety Website. https://www.mlsafety.org/safebench.
National Institute of Standards and Technology. 2024. “AI Risk Management Framework.” Technical Report. National Institute of Standards; Technology. https://www.nist.gov/itl/ai-risk-management-framework.
Noam Gat. 2024. “LM Format Enforcer.” GitHub Repository. https://github.com/noamgat/lm-format-enforcer.
NVIDIA. 2024a. “Logits Processor Zoo.” GitHub Repository. https://github.com/NVIDIA/logits-processor-zoo.
———. 2024. “NeMo-Guardrails: An Open-Source Toolkit for Building Reliable and Safe LLM Applications.” https://github.com/NVIDIA/NeMo-Guardrails.
OpenAI. 2024a. “OpenAI Moderation API.” https://platform.openai.com/docs/guides/moderation.
———. 2024b. “OpenAI Preparedness Framework.” Technical Report. OpenAI. https://cdn.openai.com/openai-preparedness-framework-beta.pdf.
OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, et al. 2024. “GPT-4 Technical Report.” https://arxiv.org/abs/2303.08774.
Padhi, Inkit, Manish Nagireddy, Giandomenico Cornacchia, Subhajit Chaudhury, Tejaswini Pedapati, Pierre Dognin, Keerthiram Murugesan, et al. 2024. “Granite Guardian.” https://arxiv.org/abs/2412.07724.
ProtectAI. 2024. “LLM-Guard: Comprehensive Safety and Security Framework for Large Language Models.” https://github.com/protectai/llm-guard.
Shorten, Connor, Charles Pierse, Thomas Benjamin Smith, Erika Cardenas, Akanksha Sharma, John Trengrove, and Bob van Luijt. 2024. “StructuredRAG: JSON Response Formatting with Large Language Models.” https://arxiv.org/abs/2408.11061.
SmolLM2-360M-Instruct, HuggingFace. 2024. “SmolLM2-360M-Instruct.” https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct.
Surge AI. 2024. “Surge AI Profanity Dataset.” GitHub repository. https://github.com/surge-ai/profanity.
Tan, Jiejun, Zhicheng Dou, Wen Wang, Mang Wang, Weipeng Chen, and Ji-Rong Wen. 2024. “HtmlRAG: HTML Is Better Than Plain Text for Modeling Retrieved Knowledge in RAG Systems.” https://arxiv.org/abs/2411.02959.
Tang, Xiangru, Yiming Zong, Jason Phang, Yilun Zhao, Wangchunshu Zhou, Arman Cohan, and Mark Gerstein. 2024. “Struc-Bench: Are Large Language Models Really Good at Generating Complex Structured Data?” https://arxiv.org/abs/2309.08963.
UK Government. 2024. “AI Regulation: A Pro-Innovation Approach.” White Paper. Department for Science, Innovation; Technology. https://www.gov.uk/government/publications/ai-regulation-a-pro-innovation-approach/white-paper.
UNICEF. 2024. “Policy Guidance on AI for Children.” Policy Report. UNICEF Office of Research - Innocenti. https://www.unicef.org/innocenti/reports/policy-guidance-ai-children.
Vidgen, Bertie, Adarsh Agrawal, Ahmed M. Ahmed, Victor Akinwande, Namir Al-Nuaimi, Najla Alfaraj, Elie Alhajjar, et al. 2024. “Introducing V0.5 of the AI Safety Benchmark from MLCommons.” https://arxiv.org/abs/2404.12241.
Vidgen, Bertie, Nino Scherrer, Hannah Rose Kirk, Rebecca Qian, Anand Kannappan, Scott A. Hale, and Paul Röttger. 2024. “SimpleSafetyTests: A Test Suite for Identifying Critical Safety Risks in Large Language Models.” https://arxiv.org/abs/2311.08370.
WebPurify. 2024. “WebPurify - Content Moderation API.” https://www.webpurify.com/.
Wu, Yunshu, Hayate Iso, Pouya Pezeshkpour, Nikita Bhutani, and Estevam Hruschka. 2024. “Less Is More for Long Document Summary Evaluation by LLMs.” https://arxiv.org/abs/2309.07382.