LogicHaystacks / README.md
sileod's picture
Update README.md
5fcba36 verified
metadata
dataset_info:
  - config_name: no_hyp
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 215910361
        num_examples: 468
      - name: test
        num_bytes: 842478218
        num_examples: 1800
    download_size: 112400572
    dataset_size: 1058388579
  - config_name: no_hyp-graham
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 203554979
        num_examples: 468
      - name: test
        num_bytes: 794590634
        num_examples: 1800
    download_size: 118275316
    dataset_size: 998145613
  - config_name: one_ev
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 215968257
        num_examples: 468
      - name: test
        num_bytes: 842724933
        num_examples: 1800
    download_size: 112491476
    dataset_size: 1058693190
  - config_name: one_ev-graham
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 203598153
        num_examples: 468
      - name: test
        num_bytes: 794767132
        num_examples: 1800
    download_size: 118299373
    dataset_size: 998365285
  - config_name: scale
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 215968257
        num_examples: 468
      - name: test
        num_bytes: 842724933
        num_examples: 1800
    download_size: 112491476
    dataset_size: 1058693190
  - config_name: scale-graham
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 203598153
        num_examples: 468
      - name: test
        num_bytes: 794767132
        num_examples: 1800
    download_size: 118299373
    dataset_size: 998365285
  - config_name: two_ev
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 105535811
        num_examples: 234
      - name: test
        num_bytes: 689802579
        num_examples: 1548
    download_size: 88518541
    dataset_size: 795338390
  - config_name: two_ev-graham
    features:
      - name: prompt
        dtype: string
      - name: evidence_indices
        sequence: int64
      - name: 'n'
        dtype: int64
      - name: premise
        dtype: string
      - name: hypothesis
        dtype: string
      - name: label
        dtype: string
      - name: premise_tptp
        dtype: string
      - name: hypothesis_tptp
        dtype: string
      - name: proof_inputs
        sequence: string
      - name: proof
        dtype: string
      - name: ni
        dtype: int64
      - name: counterfactuals
        dtype: string
      - name: evidences_necessity
        dtype: bool
      - name: mapping
        dtype: string
      - name: n-l
        dtype: string
      - name: numbered_premises
        dtype: string
      - name: evidence
        sequence: string
      - name: no_hyp
        dtype: bool
      - name: len
        dtype: int64
    splits:
      - name: validation
        num_bytes: 99325679
        num_examples: 234
      - name: test
        num_bytes: 648714665
        num_examples: 1548
    download_size: 93232742
    dataset_size: 748040344
configs:
  - config_name: no_hyp
    data_files:
      - split: validation
        path: no_hyp/validation-*
      - split: test
        path: no_hyp/test-*
  - config_name: no_hyp-graham
    data_files:
      - split: validation
        path: no_hyp-graham/validation-*
      - split: test
        path: no_hyp-graham/test-*
  - config_name: one_ev
    data_files:
      - split: validation
        path: one_ev/validation-*
      - split: test
        path: one_ev/test-*
  - config_name: one_ev-graham
    data_files:
      - split: validation
        path: one_ev-graham/validation-*
      - split: test
        path: one_ev-graham/test-*
  - config_name: scale
    data_files:
      - split: validation
        path: scale/validation-*
      - split: test
        path: scale/test-*
  - config_name: scale-graham
    data_files:
      - split: validation
        path: scale-graham/validation-*
      - split: test
        path: scale-graham/test-*
  - config_name: two_ev
    data_files:
      - split: validation
        path: two_ev/validation-*
      - split: test
        path: two_ev/test-*
  - config_name: two_ev-graham
    data_files:
      - split: validation
        path: two_ev-graham/validation-*
      - split: test
        path: two_ev-graham/test-*

Evaluation code:


def parse(x):
    if '<answer>' in x and '</answer>' in x:
        start = x.find('<answer>') + len('<answer>')
        end = x.find('</answer>')
        x = x[start:end]
    
    lines = [i.lstrip('L').strip() for i in x.strip().strip('.').split(',')]
    return [int(i) for i in lines if i.isnumeric()]

def jaccard(list1, list2):
    intersection = len(list(set(list1).intersection(list2)))
    union = (len(set(list1)) + len(set(list2))) - intersection
    return float(intersection) / union

df['prediction']=df.prompt.parallel_apply(complete_m(m,num_retries=5)) # plug in your llm
df['metric']=df.apply(lambda x: jaccard(parse(x.prediction), x.evidence_indices), axis=1)