SShortSingh.
Back to feed

How Prompt Hashing and RSS Caps Catch Silent Regressions in AI C++ Evals

0
·1 views

AI-generated C++ patches can pass all functional tests while still introducing hidden performance regressions, such as excess memory allocations or changed cache behavior, that standard output-only golden file checks never detect. A proposed evaluation harness addresses this by adding two explicit locks: a SHA-256 hash pinning the exact prompt used to generate a patch, and hard caps on wall-clock time and resident set size. The prompt hash is stored in a checked-in JSON contract file, so any change to the prompt text requires a deliberate commit updating the hash, preventing silent drift between eval runs. Resource budgets for time and memory must be measured on the same machine class used for grading, as mixing laptop and remote VM figures invalidates the caps. Together, these two mechanisms ensure that a green build reflects genuine correctness and performance stability, not just matching output strings.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Oracle SQL: Four Built-in JSON Functions That Transform Relational Data

Oracle Database offers four built-in SQL functions — JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, and JSON_ARRAYAGG — to convert relational table data into JSON format directly within SQL queries. JSON_OBJECT and JSON_ARRAY are scalar functions that operate row by row, producing a JSON object or array for each individual record. In contrast, JSON_OBJECTAGG and JSON_ARRAYAGG are aggregate functions that consolidate multiple rows into a single JSON document or array respectively. JSON_ARRAYAGG is particularly useful in API development and reporting, while JSON_OBJECTAGG suits scenarios requiring dynamic serialization of query results for REST APIs or NoSQL migrations. Developers can practice these functions using Oracle's standard EMP table, which contains employee fields such as EMPNO, ENAME, JOB, and SAL.

0
ProgrammingDEV Community ·

Oracle PL/SQL: How Pipelined Table Functions Outperform Regular Ones

Oracle PL/SQL offers two types of table functions — regular and pipelined — both capable of returning collections queryable directly in SQL FROM clauses. Regular table functions load the entire result set into PGA memory before returning data, leading to higher memory usage and slower time-to-first-row, making them suitable mainly for small datasets. Pipelined functions, by contrast, stream rows incrementally to the caller using the PIPE ROW construct, significantly reducing memory overhead and improving responsiveness for large ETL or real-time data operations. A key syntax rule requires that the RETURN statement in a pipelined function remain empty — passing a variable causes a PLS-00633 compilation error. Additionally, the TABLE() wrapper mandatory in Oracle 11g and earlier became optional from Oracle Database 12c Release 2 onward.

0
ProgrammingDEV Community ·

Oracle PL/SQL: Key Differences Between CASE Expression and CASE Statement

In Oracle PL/SQL, the CASE Expression and CASE Statement serve distinct purposes despite sharing similar syntax. A CASE Expression evaluates a condition and returns a single scalar value, making it suitable for assignments or inline SQL use, while a CASE Statement executes one or more procedural actions based on conditions. Their termination syntax also differs: CASE Statements close with END CASE; whereas CASE Expressions end with END. A critical behavioral difference involves unhandled cases — a CASE Statement with no matching WHEN clause and no ELSE raises a runtime ORA-06592 exception, while a CASE Expression silently returns NULL under the same circumstances. Developers should account for these distinctions to avoid unexpected runtime errors in production PL/SQL code.

0
ProgrammingDEV Community ·

Rails gem 'viewing_as' adds read-only, audited admin impersonation with write guards

Delist My Data, a personal data removal service, built a customer account impersonation feature for its admin team that enforces read-only access and maintains a transparent audit log visible to customers. Existing Rails gems like pretender and devise_masquerade handle user-switching but lack write restrictions, session timeouts, or customer-facing audit trails. The team addressed this with two protection layers: a before_action that blocks non-GET/HEAD requests during impersonation, and ActiveRecord's while_preventing_writes to catch any writes that slip through via GET routes. The solution also uses signed cookies to lock session settings like read-only mode so nothing can be altered from the browser mid-session. Last week, the company extracted the feature into an open-source gem called viewing_as for other Rails developers to use.