Acrovations
← All articles

    Quality

    5 mistakes AI models make in code, and how reviewers catch them

    13 November 20264 min readBy the Acrovations team

    AI-generated code is often clean, well-named and confidently explained, which is exactly why its mistakes are easy to miss. These are the five patterns our engineers see most when evaluating code for AI training projects.

    1. It quietly drops a requirement

    The code solves a simpler version of the task. Asked to remove duplicates while keeping order, a model returns:

    return list(set(items))   # order is lost

    How we catch it: re-read the prompt and tick off every requirement before reading the code at all.

    2. Edge cases crash it

    The happy path works, but an empty list, a single item or a negative number breaks it:

    def average(xs):
        return sum(xs) / len(xs)   # ZeroDivisionError on []

    How we catch it: run the code with small, nasty inputs: empty, one element, duplicates, very large values, unusual characters.

    3. It invents an API

    Models sometimes call functions or parameters that look plausible but do not exist, or existed only in an old version of a library.

    How we catch it: actually run the code and check unfamiliar calls against the official documentation for the stated version.

    4. It opens a security hole

    The classic example is building a database query from user input:

    cur.execute(f"SELECT * FROM users WHERE email = '{email}'")   # SQL injection
    cur.execute("SELECT * FROM users WHERE email = %s", (email,))  # safe

    How we catch it: ask “what if this input came from an attacker?” for every value that crosses a trust boundary: queries, file paths, shell commands, HTML.

    5. It is correct but slow

    Checking membership in a list inside a loop turns a quick task into an O(n²) one that times out on real data. Using a set or a dictionary usually fixes it.

    How we catch it: estimate the complexity, then test with a realistic data size, not just the three-item example.

    Why the review matters for training

    In AI training projects, the reviewer’s job is not only to reject bad code, but to explain precisely what is wrong and provide a correct version. That explanation becomes training data, and it is how the next version of the model learns to avoid the same mistake. You can see a full example in the Code evaluation tab on our homepage.

    Need experienced engineers to evaluate or write code for your AI model?

    Talk to our team →
    ← What is RLHF?All articles →

    Якість

    5 помилок ШІ-моделей у коді та як рецензенти їх виявляють

    13 листопада 20264 хв читанняКоманда Acrovations

    Код, написаний ШІ, часто охайний, з добрими назвами та впевненими поясненнями — саме тому його помилки легко пропустити. Ось п’ять шаблонів, які наші інженери бачать найчастіше, оцінюючи код у проєктах з навчання ШІ.

    1. Тихо ігнорує вимогу

    Код розв’язує спрощену версію задачі. На прохання видалити дублікати зі збереженням порядку модель повертає:

    return list(set(items))   # порядок втрачено

    Як виявляємо: перечитуємо завдання й відмічаємо кожну вимогу ще до того, як дивитися на код.

    2. Падає на граничних випадках

    Основний сценарій працює, але порожній список, один елемент чи від’ємне число все ламають:

    def average(xs):
        return sum(xs) / len(xs)   # ZeroDivisionError для []

    Як виявляємо: запускаємо код на малих «підступних» даних: порожніх, з одним елементом, дублікатами, дуже великими значеннями, незвичними символами.

    3. Вигадує API

    Моделі іноді викликають функції чи параметри, що виглядають правдоподібно, але не існують або існували лише в старій версії бібліотеки.

    Як виявляємо: справді запускаємо код і звіряємо незнайомі виклики з офіційною документацією для зазначеної версії.

    4. Відкриває діру в безпеці

    Класичний приклад — запит до бази даних, зібраний із введення користувача:

    cur.execute(f"SELECT * FROM users WHERE email = '{email}'")   # SQL-ін’єкція
    cur.execute("SELECT * FROM users WHERE email = %s", (email,))  # безпечно

    Як виявляємо: для кожного значення, що перетинає межу довіри (запити, шляхи до файлів, команди оболонки, HTML), питаємо: «а якщо це введе зловмисник?»

    5. Правильний, але повільний

    Перевірка наявності елемента у списку всередині циклу перетворює швидку задачу на O(n²), яка не вкладається в час на реальних даних. Зазвичай допомагає множина чи словник.

    Як виявляємо: оцінюємо складність і тестуємо на реалістичному обсязі даних, а не лише на прикладі з трьох елементів.

    Чому рецензія важлива для навчання

    У проєктах з навчання ШІ завдання рецензента — не лише відхилити поганий код, а й точно пояснити, що не так, і надати правильну версію. Це пояснення стає навчальними даними, і саме так наступна версія моделі вчиться не повторювати помилку. Повний приклад — у вкладці «Оцінювання коду» на головній сторінці.

    Потрібні досвідчені інженери для оцінювання чи написання коду для вашої ШІ-моделі?

    Зв’язатися з командою →
    ← Що таке RLHF?Усі статті →
    Acrovations

    © 2026 Acrovations LLC · EDRPOU 34535014

    BlogTerms of UsePrivacy Policy