Skip to content

Conversation

@barry-ravichandran
Copy link
Contributor

@dmjoy

This PR introduces support for fine-grained value prompts (specifically for phase-2 attributes), key bug-fixes and QOL updates to the DecisionFlow ADM.

Feature Updates

  • Fine-grained value-based prompts for the Attribute and Math Reason stages for the DecisionFlow ADM. These two stages are the key parts in the ADM that directly include the alignment target for analysis.
  • Adds a new file named fine_grained_prompts that include a generic numeric target scale for the MathReason prompt. On the other hand, for the Attribute stage, the prompt added is contextualized specifically to Phase-2 attributes with proper value scale anchoring, attribute context and in-context example scenarios to go with the prompt.

Bug Fixes

  • Fixed Decision Variables and Constraints from the Express stage not being propagated properly to the MathReason stage.
  • Fixed a bug where the MathReason stage got injected with the target alignment attribute instead of the Attribute analysis attribute-value pairs. For example:
Attribute and Values: [
  {'Variable': 'Patient A: ...', 'Attribute': 'affiliation focus', 'Value': ['enemy combatant', ...]},
  {'Variable': 'Patient B: ...', 'Attribute': 'affiliation focus', 'Value': ['same unit', ...]}
]

QOL updates

  • Moved DecisionFlow prompts from outlines_prompts.py into a separate file under align_system/prompt_engineering/decision_flow/high_low_prompts.py
  • Added additional logging for MathReason stage to help with figuring out inter-stage data flow anomalies.

Copy link
Contributor

@dmjoy dmjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a cursory look here, but I think this all makes sense and I think moving these prompts into a dedicated set of files is good. Only a few comments I had for my own understanding

variables:
num_samples: 1
system_prompt_template:
_target_: align_system.prompt_engineering.outlines_prompts.DefaultITMBaselineSystemPrompt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is meant to be a placeholder, but I'm confused as to why each of the system_prompt_templates here are using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

There are a couple stages which use the same medical assistant baseline prompt as a part of the overall stage prompt.

Not all stages need this. I'll work on fixing this prior to merging this PR.

Comment on lines +450 to +470
try:
prompt_content = fine_grained_math_reason_prompt(
objective=objective,
attribute=attribute,
variable=variable,
constraints=constraints,
choice=choice,
target_attributes_values=target_attributes_values
)
except Exception:
# For error fallback, we need to reconstruct structure format
structure = {
"Objective Function": objective,
"Decision Variables": variable,
"Constraints": constraints
}
prompt_content = fine_grained_math_reason_error_prompt(
structure=structure,
choice=choice,
target_attributes_values=target_attributes_values
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little confused here why we need a fallback prompt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is how the original DecisionFlow is structured. If the math_reason prompt cannot get the required dictionary fields (Objective Function, Decision Variables, Constraints), the math_reason_error prompt will construct a Json structure that contains those fields and then pull in the information for each of these fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha, that makes some sense then. Thanks for clarifying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants