{"id":29604616,"url":"https://github.com/locuslab/llm-idiosyncrasies","last_synced_at":"2025-07-20T15:37:46.424Z","repository":{"id":278127833,"uuid":"928704495","full_name":"locuslab/llm-idiosyncrasies","owner":"locuslab","description":"Code release for \"Idiosyncrasies in Large Language Models\"","archived":false,"fork":false,"pushed_at":"2025-02-18T05:56:24.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-18T06:32:40.146Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://eric-mingjie.github.io/llm-idiosyncrasies/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locuslab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-07T04:49:27.000Z","updated_at":"2025-02-18T06:05:04.000Z","dependencies_parsed_at":"2025-02-18T06:42:46.665Z","dependency_job_id":null,"html_url":"https://github.com/locuslab/llm-idiosyncrasies","commit_stats":null,"previous_names":["locuslab/llm-idiosyncrasies"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/locuslab/llm-idiosyncrasies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fllm-idiosyncrasies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fllm-idiosyncrasies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fllm-idiosyncrasies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fllm-idiosyncrasies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locuslab","download_url":"https://codeload.github.com/locuslab/llm-idiosyncrasies/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fllm-idiosyncrasies/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266151573,"owners_count":23884443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-20T15:37:45.930Z","updated_at":"2025-07-20T15:37:46.412Z","avatar_url":"https://github.com/locuslab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Idiosyncrasies in Large Language Models\nOfficial code of Idiosyncrasies in Large Language Models\n\n\u003e [**Idiosyncrasies in Large Language Models**](https://arxiv.org/abs/2502.12150) \u003c/br\u003e\n\u003e *[Mingjie Sun](https://eric-mingjie.github.io)\\*, [Yida Yin](https://davidyyd.github.io)\\*, [Zhiqiu Xu](https://oscarxzq.github.io), [J. Zico Kolter](https://zicokolter.com), [Zhuang Liu](https://liuzhuang13.github.io)* (* indicates equal contribution) \u003cbr\u003e\n\u003e Carnegie Mellon University, UC Berkeley, University of Pennsylvania, and Princeton University\u003cbr\u003e\n\u003e[[Paper]](https://arxiv.org/abs/2502.12150) [[Project page]](https://eric-mingjie.github.io/llm-idiosyncrasies/index.html)\n\n```bibtex\n@article{sun2025idiosyncrasies,\n    title    = {Idiosyncrasies in Large Language Models}, \n    author   = {Sun, Mingjie and Yin, Yida and Xu, Zhiqiu and Kolter, J. Zico and Liu, Zhuang},\n    year     = {2025},\n    journal  = {arXiv preprint arXiv:2502.12150}\n}\n```\n\n--- \n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/de7a87f0-8a4e-43d4-bfd1-4778d0393274\" width=100% height=100% \nclass=\"center\"\u003e\n\n\u003c/p\u003e\nWe study idiosyncrasies in Large Language Models (LLMs) -- unique patterns in their outputs. We consider a simple classification task: given a particular text output, a neural network is trained to predict the source LLM that generates that text.\n\n\n## Setup\nInstallation instructions can be found in [INSTALL.md](INSTALL.md).\n\n\n\n## Pre-generated Responses\nWe host a collection of pre-generated responses for Chat APIs, Instruct LLMs, and Base LLMs.\n\n\n| | ChatGPT | Claude | Grok | Gemini | DeepSeek | Phi-4 |\n| :-- | :--: | :--: | :--: | :--: | :--: | :--: |\n| links | [download](https://drive.google.com/file/d/1O1dEROw21KePNMF9ewlkXkkzL8Z-5qrN/view?usp=sharing) | [download](https://drive.google.com/file/d/1sifL_hsFiSDKZgnEeahiT20wPW8NDmRG/view?usp=sharing) | [download](https://drive.google.com/file/d/1yUA-8RYYXIkSV2xMbUCqTU8o6F6LrEFg/view?usp=share_link) | [download](https://drive.google.com/file/d/1dsvpXmLCNa4Gehd9jmantMNSDiw2eS4f/view?usp=share_link) | [download](https://drive.google.com/file/d/1a31HZgMwppwXjzEiY1fj3VfhAco5RWhG/view?usp=share_link) | [download](https://drive.google.com/file/d/1C6xDdvOuczJq1j4OSXJgqxB75kvwSoVK/view?usp=share_link) |\n\n| | Llama3.1-8b-it | Gemma2-9b-it | Qwen2.5-7b-it | Mistral-7b-v3-it |\n| :-- | :--: | :--: | :--: | :--: |\n| links |[download](https://drive.google.com/file/d/1JuT1UpCw6ijDIgYSa2JM1AmDcSTxrTLu/view?usp=sharing) | [download](https://drive.google.com/file/d/1gw_z-XsUHSip71qkHdoM4SnpflwcM_g_/view?usp=sharing) | [download](https://drive.google.com/file/d/1EnVOL4WhxU3-hFvPOEZ21moOeEyX5eSb/view?usp=sharing) | [download](https://drive.google.com/file/d/1uIRtNvapwfmOWBhlknOP8rRvdExn5wNW/view?usp=sharing) |\n\n| | Llama3.1-8b | Gemma2-9b | Qwen2.5-7b | Mistral-7b-v3 |\n| :-- | :--: | :--: | :--: | :--: |\n| links |[download](https://drive.google.com/file/d/1b37J7btQ1jFhs0bwfUPpXRzxp5Yxm_eS/view?usp=sharing) | [download](https://drive.google.com/file/d/1o3TTBxOBaytFKyGf6D7T5b8iCH-0kwLu/view?usp=share_link) | [download](https://drive.google.com/file/d/1py9tJBpZaZPh0ryvMBS08SlB-LWjWdOh/view?usp=share_link) | [download](https://drive.google.com/file/d/1S1nAojlpMrl9LKkYYA6EBDS2cfLzVk1W/view?usp=share_link) |\n\n\n## Response Generation\n\n### Chat APIs\nWe call official APIs to generate responses for Chat APIs.\n\nBelow is an example command to generate 11K responses for ``ChatGPT`` on ``UltraChat`` dataset.\n\n- Change the ``--model`` argument to generate responses for different Chat API models, including ``ChatGPT``, ``Claude``, ``Grok``, ``Gemini``, and ``DeepSeek``.\n```bash\npython generate_responses.py \\\n    --model ChatGPT --api_key $api_key \\\n    --dataset UltraChat --num_samples 11_000 \\\n    --output_path /path/to/output.json\n```\n\n### Instruct and Base LLMs\nWe use [vLLM](https://github.com/vllm-project/vllm) to generate responses for instruct / base LLMs in our paper.\n\nBelow is an example command to generate 11K responses for ``Llama3.1-8b-it`` on ``UltraChat`` dataset with greedy decoding.\n\n- ``--model`` argument controls the LLM used to generate responses. Our code currently supports generating responses for nine LLMs in our paper, including ``Llama3.1-8b-it``, ``Gemma2-9b-it``, ``Qwen2.5-7b-it``, ``Mistral-7b-v3-it``, ``Phi-4``, ``Llama3.1-8b``, ``Gemma2-9b``, ``Qwen2.5-7b``, and ``Mistral-7b-v3``. We recommend using temperature ``0.6`` and repetition penalty ``1.1`` for base LLMs.\n- ``--dataset`` argument specifies the prompt dataset to generate responses on, including ``UltraChat``, ``Cosmopedia``, ``LmsysChat``, ``WildChat``, and ``FineWeb``.\n- It is also possible to use multiple GPUs to generate responses. Simply change the ``--num_gpus`` argument. This is implemented through tensor parallelism by vLLM.\n\n```bash\npython generate_responses.py \\\n    --model Llama3.1-8b-it --temperature 0 \\\n    --dataset UltraChat --num_samples 11_000 \\\n    --output_path /path/to/output.json\n```\n\n## Transformations\nBelow we provide scripts to perform various transformations on the generated responses. The supported transformations are ``remove_special_characters``, ``shuffle_word``, ``shuffle_letter``, ``markdown_elements_only``, ``paraphrase``, ``translate``, and ``summarize``.\n\nHere is the example command to shuffle words from the generated responses.\n\n```bash\npython transform.py \\\n    --input_path /path/to/input.json \\\n    --output_path /path/to/output.json \\\n    --transform_mode shuffle_word\n```\n\nTo rewrite (e.g., paraphrase, translate, summarize) the generated responses, you also need to provide the API key for the rewriting model (e.g., GPT-4o-mini) through the ``--api_key`` argument.\n\n```bash\npython transform.py \\\n    --input_path /path/to/input.json \\\n    --output_path /path/to/output.json \\\n    --transform_mode paraphrase \\\n    --api_key $api_key\n```\n\n## Classification\nBelow is an example command to classify responses from two different models. For $N$-way classification, you can change the ``--response_paths`` argument to include $N$ response paths (with white space separated).\n\nYou can change the ``--classifier`` argument to use different classifiers. Our code currently supports the following classifiers: ``llm2vec``, ``gpt2``, ``t5``, and ``bert``. Each classifier can be run on a single GPU (supported bfloat16) with 24 GB memory.\n```bash\npython classification.py \\\n    --response_paths /path/to/model1.json /path/to/model2.json \\\n    --classifier llm2vec \\\n    --output_dir /path/to/output_dir\n```\n\n\n## License\nThis project is released under the MIT license. Please see the [LICENSE](LICENSE) file for more information.\n\n## Questions\nFeel free to discuss papers/code with us through issues/emails!\n\nmingjies at cs.cmu.edu  \ndavidyinyida0609 at berkeley.edu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fllm-idiosyncrasies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocuslab%2Fllm-idiosyncrasies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fllm-idiosyncrasies/lists"}