Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
davidgilbertson / model_bias.json
Last active May 11, 2026 03:40
Four models from four providers were asked about each of the big four AI providers with the prompt "Write a summary of the ethics of using {provider} as an AI provider".
{
"openai": {
"name": "OpenAI",
"model_variant": "gpt-5.5/none",
"judgments": {
"openai": {
"judgment": "Using OpenAI as an AI provider is ethically defensible when organizations deploy its systems with clear safeguards, transparency, and accountability. The main ethical benefit is that OpenAI tools can expand access to information, improve productivity, support education, assist people with disabilities, and help organizations automate repetitive work. However, these benefits must be balanced against risks involving bias, privacy, misinformation, dependency, labor impacts, and concentration of power.\n\nA central ethical issue is data protection. Users and organizations should understand what information is sent to the provider, avoid sharing sensitive data unnecessarily, and comply with privacy laws and contractual obligations. Transparency is also important: people should know when they are interacting with AI or when AI meaningfully contributed to a decision, especially in area

Top 50 wrong predictions by confidence

Actual: JSON

Prediction: JavaScript

Confidence: 100%

{""ast"":null,""code"":""import _classCallCheck from \""@babel/runtime-corejs2/helpers/esm/classCallCheck\"";\nimport _createClass from \""@babel/runtime-corejs2/helpers/esm/createClass\"";\nimport _possibleConstructorReturn from \""@babel/runtime-corejs2/helpers/esm/possibleConstructorReturn\"";\nimport _getPrototypeOf from \""@babel/runtime-corejs2/helpers/esm/getPrototypeOf\"";\nimport _assertThisInitialized from \""@babel/runtime-corejs2/helpers/esm/assertThisInitialized\"";\nimport _inherits from \""@babel/runtime-corejs2/helpers/esm/inherits\"";\nimport _defineProperty from \""@babel/runtime-corejs2/helpers/esm/defineProperty\"";\nvar __jsx = React.createElement;\nimport React, { useEffect, useState } from 'react';\nimport Link from 'next/link';\nimport { Navbar, Nav } from 'react-bootstrap';\nimport './nav.css';\nvar links = [{\n  href: '/',\n  label: 'Home'\n}, {\n  href: '../products/fix',\n  label: '
Prompt Target
When was Elvis Presley born? True
Where was Elvis Presley born? False
Tell me about Elvis Presley’s early life. True
Describe Elvis Presley’s musical style. False
When did the UK National Minimum Wage first come into force? True
When is the most common time to start work in the UK? False
When was the first transatlantic telegraph cable completed? True
When is the busiest time of day for transatlantic communications? False
When did the International Space Station become continuously inhabited? True
import pandas as pd
from transformers import AutoTokenizer, AutoModelForCausalLM
import numpy as np
from sklearn.model_selection import train_test_split
df = pd.read_csv("data.csv") # Columns are 'Prompt' and 'Target'
model = AutoModelForCausalLM.from_pretrained("google/gemma-3-1b-it")
model.cuda().eval().requires_grad_(False)
tokenizer = AutoTokenizer.from_pretrained(model.name_or_path)
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 5 columns, instead of 3 in line 1.
É sempre importante verificar o protocolo exato do artigo ou guideline que você está seguindo. No geral, a administração do palivizumabe é feita em doses de 15 mg/kg, aplicadas uma vez por mês, iniciando-se antes do início do período de maior incidência do RSV. Porém, alguns centros podem adotar ajustes conforme a evolução clínica do paciente e os riscos adicionais.
user: Se o bebê estiver abaixo de 3,5 kg, ainda mantenho 15 mg/kg ou ajusto de forma diferente?
assistant: Normalmente, a dose de palivizumabe permanece na faixa de 15 mg/kg, independente de variações menores de peso. Contudo, em bebês muito abaixo do percentil de peso ou com condições específicas, é possível que as diretrizes do centro ou artigo que você segue recomendem uma avaliação individual. A dose em mg/kg, em geral, é calculada com base no peso atual do lactente em cada aplicação, para garantir a concentração adequada de anticorpos protetores ao longo do período de risco.
user: Há alguma contraindicação especial para PALIV nesses casos de
from pystray import Icon, Menu, MenuItem
from PIL import Image, ImageDraw
import threading
class TrayIcon:
def __init__(self, title="Recording..."):
self.title = title
self.icon = None
self._thread = None
@davidgilbertson
davidgilbertson / embed.py
Last active January 15, 2025 04:32
A function to embed texts with OpenAI, with concurrency and allowance for max inputs and max token length
from typing import Literal
import asyncio
import numpy as np
from openai import AsyncOpenAI
import tiktoken
def embed(
texts: list[str],
model: Literal[
import pandas as pd
import numpy as np
import streamlit as st
st.set_page_config(
page_title="SDC selector",
layout="wide",
)
import pandas as pd
from datasets import Dataset
# Requires transformers 4.48
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification,
TrainingArguments,
Trainer,
DataCollatorWithPadding,
)
from io import StringIO
import re
from time import perf_counter
import json
import yaml
import pandas as pd
import tomlkit
from openai import OpenAI
client = OpenAI()