Skip to main content

A package for simulated social ensembles.

Project description

Plurals: A System for Guiding LLMs Via Simulated Social Ensembles

Package Stats 📊

PyPI - Downloads GitHub last commit GitHub Created At

Package Build (Tests/Doc Creation/PyPi Releases) 👌

Build PyPI Push to pypy

Paper 📜 (Click here!)

Documentation 📋 (Click here!)

Cite ℹ️

If you use Plurals in your research, please cite the following paper appearing at CHI 25 (Honorable Mention):

Bibtex:

@inproceedings{ashkinaze2025plurals,
  author = {Ashkinaze, Joshua and Fry, Emily and Edara, Narendra and Gilbert, Eric and Budak, Ceren},
  title = {Plurals: A System for Guiding LLMs Via Simulated Social Ensembles},
  booktitle = {CHI Conference on Human Factors in Computing Systems},
  series = {CHI '25},
  year = {2025},
  month = may,
  location = {Yokohama, Japan},
  publisher = {Association for Computing Machinery},
  address = {New York, NY, USA},
  pages = {1--27},
  numpages = {27},
  doi = {10.1145/3706598.3713675},
  url = {https://doi.org/10.1145/3706598.3713675}
}

APA:

Ashkinaze, J., Fry, E., Edara, N., Gilbert, E., & Budak, C. (2025). Plurals: A system for guiding LLMs via simulated social ensembles. In CHI Conference on Human Factors in Computing Systems (CHI '25, pp. 1-27). Association for Computing Machinery. https://doi.org/10.1145/3706598.3713675

Overview 🌌

System Diagram

Plurals is an end-to-end generator of simulated social ensembles. (1) Agents complete tasks within (2) Structures, with communication optionally summarized by (3) Moderators. Plurals integrates with government datasets (1a) and templates, some inspired by democratic deliberation theory (1b).

The building block is Agents, which are large language models (LLMs) that have system instructions and tasks. System instructions can be generated from user input, government datasets (American National Election Studies; ANES), or persona templates. Agents exist within Structures, which define what information is shared. Combination instructions tell Agents how to combine the responses of other Agents when deliberating in the Structure. Users can customize an Agent's combination instructions or use existing templates drawn from deliberation literature and beyond. Moderators aggregate responses from multi-agent deliberation.

Plurals includes support for multiple information-sharing structures (e.g., chains, graphs, debates, ensembles) and templates for customizing LLM deliberation within these.

Updates 🆕

  1. Paper to appear at CHI 2025 with Honorable Mention!
  2. Changes to debate to decrease sycophancy
  3. Names of Agents in DAG are visible to other Agents
  4. Feature update: Added a best-of-n feature for Agents. This supports things like verifiable rewards and LLM as a Judge. Best-of-n can be used inside of Structures, where different Agents have different optimizing objectives. See the tutorial on this for details.
  5. Feature update: Added Interview class for building rich, story-based personas via simulated interviews, inspired by 1. Also, an Agent can also automatically generate task-specific interview questions (returned as structured JSON), which are then used to conduct a targeted interview. See the tutorial for details.
  6. Improvement: Best-of-N generation is parallelized.

Detailed Documentation 📋

https://josh-ashkinaze.github.io/plurals/

Quick Start ⚡

Installation

pip install plurals

Set environment variables

import os
os.environ["OPENAI_API_KEY"] = 'your_openai_key'
os.environ["ANTHROPIC_API_KEY"] = 'your_anthropic_key'

Create a nationally representative ensemble of Agents portrayed by different LLMs

from plurals.agent import Agent
from plurals.deliberation import Ensemble, Moderator

task = "What, specifically, would make commuting on a bike more appealing to you? Answer from your perspective. Be specific. You are in a focus group."
agents = [Agent(persona='random', model='gpt-4o') for _ in range(20)]
ensemble = Ensemble(agents=agents, task=task)
ensemble.process()
for r in ensemble.responses:
    print(r)

Create a directed acyclic graph of Agents for story development

System Diagram
from plurals.agent import Agent
from plurals.deliberation import Graph, Moderator


story_prompt = """
Craft a mystery story set in 1920s Paris. 
The story should revolve around the theft of a famous artwork from the Louvre.
"""

agents = {
    'plot': Agent(
        system_instructions="You are a bestselling author specializing in mystery plots",
        model="gpt-4",
        combination_instructions="Develop the plot based on character and setting inputs: <start>${previous_responses}</end>"
    ),
    'character': Agent(
        system_instructions="You are a character development expert with a background in psychology",
        model="gpt-4",
        combination_instructions="Create compelling characters that fit the plot and setting: <start>${previous_responses}</end>"
    ),
    'setting': Agent(
        system_instructions="You are a world-building expert with a focus on historical accuracy",
        model="gpt-4",
        combination_instructions="Design a rich, historically accurate setting that enhances the plot: <start>${previous_responses}</end>"
    )
}

# Create a creative writing moderator
moderator = Moderator(
    persona="an experienced editor specializing in mystery novels",
    model="gpt-4",
    combination_instructions="Synthesize the plot, character, and setting elements into a cohesive story outline: <start>${previous_responses}</end>"
)

# Define edges to create a simple interaction pattern
edges = [
    ('setting', 'character'),
    ('setting', 'plot'),
    ('character', 'plot')
]

# Create the DAG structure
story_dag = Graph(
    agents=agents,
    edges=edges,
    task=story_prompt,
    moderator=moderator
)

# Process the DAG
story_dag.process()

# Print the final story outline
print(story_dag.final_response)

Issues and Features 📝

Plurals is run by a small and energetic team of academics doing the best they can [1]. To report bugs or feature requests, open a GitHub issue. We strongly encourage you to use our Bug or Feature Request issue templates; these make it easy for us to respond effectively to the issue.

[1] Language adopted from (https://github.com/davidjurgens/potato).

Some Potential Uses 🔨🔭🔦✂️

  • Persona-based experiments (Ex: Create a panel of nationally representative personas)

  • Deliberation structure experiments (What are optimal information-sharing structures?)

  • Deliberation instruction experiments (What are optimal instructions for combining information?)

  • Agent-based models (Ex: understanding contagion in AI networks)

  • Curation (Ex: To what extent can Moderator LLMs filter and select the best outputs from other LLMs?)

  • Steerable guardrails (Ex: Can LLM deliberation steer abstentions?)

  • Persuasive messaging (Use many LLMs to collaboratively brainstorm and refine persuasive messaging for different audiences; Experiment with simulated focus groups)

  • Viewpoint augmentation (Provide varied perspectives and information from multiple agents)

  • Creative ideation (e.g., get ideas from multiple LLMs with different perspectives/roles for hypothesis generation, creative ideas, or product design)

Collaborators 🤝

If you are interested in collaborating, please reach out to Joshua Ashkinaze (jashkina@umich.edu). We are actively running both human and AI experiments around (1) how and when simulated social ensembles augment humans; (2) using Plurals for moderation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plurals-0.6.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plurals-0.6-py3-none-any.whl (3.8 MB view details)

Uploaded Python 3

File details

Details for the file plurals-0.6.tar.gz.

File metadata

  • Download URL: plurals-0.6.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for plurals-0.6.tar.gz
Algorithm Hash digest
SHA256 878ceffbcbf29556bedf4e0125f5a6bf6c41d1f9d1097e5b2c38ccc821833aa2
MD5 dc893b29c55eda3928c2125e03d88967
BLAKE2b-256 a3a2b07c5213da1941749f18fa3caa2e9229ceabe383fad911597da6d324c761

See more details on using hashes here.

File details

Details for the file plurals-0.6-py3-none-any.whl.

File metadata

  • Download URL: plurals-0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for plurals-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2a7b9cd793959f465ab956105b26d1af1fa8ca21edf690ed0d9e3c0108256433
MD5 e4ce836eb10f7896c85131199daa327e
BLAKE2b-256 fb73f4db174c09c7ed94726e5e49852b823cc473b36dd3dd216e8fcdab306c54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page